add protocol option for node
This commit is contained in:
11
chain/hop.go
11
chain/hop.go
@ -3,8 +3,9 @@ package chain
|
||||
import "context"
|
||||
|
||||
type SelectOptions struct {
|
||||
Addr string
|
||||
Host string
|
||||
Addr string
|
||||
Host string
|
||||
Protocol string
|
||||
}
|
||||
|
||||
type SelectOption func(*SelectOptions)
|
||||
@ -21,6 +22,12 @@ func HostSelectOption(host string) SelectOption {
|
||||
}
|
||||
}
|
||||
|
||||
func ProtocolSelectOption(protocol string) SelectOption {
|
||||
return func(o *SelectOptions) {
|
||||
o.Protocol = protocol
|
||||
}
|
||||
}
|
||||
|
||||
type Hop interface {
|
||||
Nodes() []*Node
|
||||
Select(ctx context.Context, opts ...SelectOption) *Node
|
||||
|
Reference in New Issue
Block a user