lotus/lib/jsonrpc/options.go
2020-05-01 21:30:32 +02:00

26 lines
447 B
Go

package jsonrpc
import (
"time"
"github.com/gorilla/websocket"
)
type Config struct {
ReconnectInterval time.Duration
proxyConnFactory func(func() (*websocket.Conn, error)) func() (*websocket.Conn, error) // for testing
}
var defaultConfig = Config{
ReconnectInterval: time.Second * 5,
}
type Option func(c *Config)
func WithReconnectInterval(d time.Duration) func(c *Config) {
return func(c *Config) {
c.ReconnectInterval = d
}
}