Documentation ¶
Index ¶
Constants ¶
View Source
const ( WriteTimeoutFieldName = "client.socket.timeout.write" ReadTimeoutFieldName = "client.socket.timeout.read" WriteTimeoutDefault = 10 * time.Second ReadTimeoutDefault = 10 * time.Second )
Variables ¶
View Source
var Component = &app.Component{ Constructor: func(container container.Container) error { return container.Provides( NewConfig, func(config *Config, configurator configurator.Configurator, appConfig *app.Config, conn net.Conn, informer logger.Informer) Client { c := NewWithConfigurator(config, configurator, conn, informer) c.Use(append([]middleware.Func{middleware.Logger(informer)}, middleware.ReadWriteCounter(appConfig, informer)...)...) return c }, ) }, BindFlags: func(flagSet *pflag.FlagSet, container container.Container) error { return container.Invoke(func(config *Config) { flagSet.DurationVar(&config.WriteTimeout, WriteTimeoutFieldName, WriteTimeoutDefault, "socket write timeout") flagSet.DurationVar(&config.ReadTimeout, ReadTimeoutFieldName, ReadTimeoutDefault, "socket read timeout") }) }, }
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { net.Conn Use(middlewares ...middleware.Func) Client SetConnector(connector net.Conn) }
func NewWithConfigurator ¶
func NewWithConfigurator(config *Config, configurator configurator.Configurator, conn net.Conn, informer logger.Informer) Client
type Config ¶
func Configuration ¶
func Configuration(config *Config, configurator configurator.Configurator) *Config
Click to show internal directories.
Click to hide internal directories.