add vhost for node
This commit is contained in:
parent
eb9d483127
commit
c2a1dd2a89
@ -4,6 +4,7 @@ import "context"
|
||||
|
||||
type SelectOptions struct {
|
||||
Addr string
|
||||
Host string
|
||||
}
|
||||
|
||||
type SelectOption func(*SelectOptions)
|
||||
@ -14,6 +15,12 @@ func AddrSelectOption(addr string) SelectOption {
|
||||
}
|
||||
}
|
||||
|
||||
func HostSelectOption(host string) SelectOption {
|
||||
return func(o *SelectOptions) {
|
||||
o.Host = host
|
||||
}
|
||||
}
|
||||
|
||||
type Hop interface {
|
||||
Nodes() []*Node
|
||||
Select(ctx context.Context, opts ...SelectOption) *Node
|
||||
|
@ -14,6 +14,7 @@ type NodeOptions struct {
|
||||
Resolver resolver.Resolver
|
||||
HostMapper hosts.HostMapper
|
||||
Metadata metadata.Metadata
|
||||
Host string
|
||||
}
|
||||
|
||||
type NodeOption func(*NodeOptions)
|
||||
@ -42,6 +43,12 @@ func HostMapperNodeOption(m hosts.HostMapper) NodeOption {
|
||||
}
|
||||
}
|
||||
|
||||
func HostNodeOption(host string) NodeOption {
|
||||
return func(o *NodeOptions) {
|
||||
o.Host = host
|
||||
}
|
||||
}
|
||||
|
||||
func MetadataNodeOption(md metadata.Metadata) NodeOption {
|
||||
return func(o *NodeOptions) {
|
||||
o.Metadata = md
|
||||
|
@ -182,6 +182,7 @@ func (r *Router) dial(ctx context.Context, network, address string) (conn net.Co
|
||||
InterfaceDialOption(r.options.IfceName),
|
||||
SockOptsDialOption(r.options.SockOpts),
|
||||
LoggerDialOption(r.options.Logger),
|
||||
TimeoutDialOption(r.options.Timeout),
|
||||
)
|
||||
if err == nil {
|
||||
break
|
||||
|
Loading…
Reference in New Issue
Block a user