add protocol option for node

This commit is contained in:
ginuerzh
2022-11-30 10:47:27 +08:00
parent 0f0679a3ec
commit 8effb0b8b9
2 changed files with 16 additions and 2 deletions

View File

@ -15,6 +15,7 @@ type NodeOptions struct {
HostMapper hosts.HostMapper
Metadata metadata.Metadata
Host string
Protocol string
}
type NodeOption func(*NodeOptions)
@ -49,6 +50,12 @@ func HostNodeOption(host string) NodeOption {
}
}
func ProtocolNodeOption(protocol string) NodeOption {
return func(o *NodeOptions) {
o.Protocol = protocol
}
}
func MetadataNodeOption(md metadata.Metadata) NodeOption {
return func(o *NodeOptions) {
o.Metadata = md