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

@ -4,7 +4,7 @@ import (
"context" "context"
"net" "net"
"github.com/go-gost/core/chain" "github.com/go-gost/core/hop"
"github.com/go-gost/core/metadata" "github.com/go-gost/core/metadata"
) )
@ -14,5 +14,5 @@ type Handler interface {
} }
type Forwarder interface { type Forwarder interface {
Forward(chain.Hop) Forward(hop.Hop)
} }

View File

@ -1,6 +1,10 @@
package chain package hop
import "context" import (
"context"
"github.com/go-gost/core/chain"
)
type SelectOptions struct { type SelectOptions struct {
Addr string Addr string
@ -29,6 +33,9 @@ func ProtocolSelectOption(protocol string) SelectOption {
} }
type Hop interface { type Hop interface {
Nodes() []*Node Select(ctx context.Context, opts ...SelectOption) *chain.Node
Select(ctx context.Context, opts ...SelectOption) *Node }
type NodeList interface {
Nodes() []*chain.Node
} }