add chain hop

This commit is contained in:
ginuerzh
2022-09-20 11:48:30 +08:00
parent 50d443049f
commit 41ff9835a6
8 changed files with 293 additions and 527 deletions

20
chain/hop.go Normal file
View File

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