move hop out of chain

This commit is contained in:
ginuerzh
2023-09-28 21:01:25 +08:00
parent 6d0e88635b
commit b0bd45c1b8
2 changed files with 13 additions and 6 deletions

View File

@ -1,34 +0,0 @@
package chain
import "context"
type SelectOptions struct {
Addr string
Host string
Protocol string
}
type SelectOption func(*SelectOptions)
func AddrSelectOption(addr string) SelectOption {
return func(o *SelectOptions) {
o.Addr = addr
}
}
func HostSelectOption(host string) SelectOption {
return func(o *SelectOptions) {
o.Host = host
}
}
func ProtocolSelectOption(protocol string) SelectOption {
return func(o *SelectOptions) {
o.Protocol = protocol
}
}
type Hop interface {
Nodes() []*Node
Select(ctx context.Context, opts ...SelectOption) *Node
}