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