Transport init
This commit is contained in:
@@ -118,7 +118,7 @@ var (
|
||||
"random": selector.NewSelector,
|
||||
}
|
||||
|
||||
DefaultTransports = map[string]func([]string, ...transport.Option) transport.Transport{
|
||||
DefaultTransports = map[string]func(...transport.Option) transport.Transport{
|
||||
"http": transport.NewTransport,
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ func (c *cmd) Before(ctx *cli.Context) error {
|
||||
}
|
||||
|
||||
if t, ok := c.opts.Transports[name]; ok {
|
||||
n := t(strings.Split(ctx.String("transport_address"), ","))
|
||||
n := t(transport.Addrs(strings.Split(ctx.String("transport_address"), ",")...))
|
||||
*c.opts.Transport = n
|
||||
} else {
|
||||
return fmt.Errorf("Transport %s not found", name)
|
||||
|
@@ -28,7 +28,7 @@ type Options struct {
|
||||
Brokers map[string]func(...broker.Option) broker.Broker
|
||||
Registries map[string]func(...registry.Option) registry.Registry
|
||||
Selectors map[string]func(...selector.Option) selector.Selector
|
||||
Transports map[string]func([]string, ...transport.Option) transport.Transport
|
||||
Transports map[string]func(...transport.Option) transport.Transport
|
||||
|
||||
// Other options for implementations of the interface
|
||||
// can be stored in a context
|
||||
@@ -114,7 +114,7 @@ func NewSelector(name string, s func(...selector.Option) selector.Selector) Opti
|
||||
}
|
||||
|
||||
// New transport func
|
||||
func NewTransport(name string, t func([]string, ...transport.Option) transport.Transport) Option {
|
||||
func NewTransport(name string, t func(...transport.Option) transport.Transport) Option {
|
||||
return func(o *Options) {
|
||||
o.Transports[name] = t
|
||||
}
|
||||
|
Reference in New Issue
Block a user