From b0bd45c1b8629cd2d99f3c60525de5b12b8cfe85 Mon Sep 17 00:00:00 2001 From: ginuerzh Date: Thu, 28 Sep 2023 21:01:25 +0800 Subject: [PATCH] move hop out of chain --- handler/handler.go | 4 ++-- {chain => hop}/hop.go | 15 +++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) rename {chain => hop}/hop.go (72%) diff --git a/handler/handler.go b/handler/handler.go index 84d1a69..26d288d 100644 --- a/handler/handler.go +++ b/handler/handler.go @@ -4,7 +4,7 @@ import ( "context" "net" - "github.com/go-gost/core/chain" + "github.com/go-gost/core/hop" "github.com/go-gost/core/metadata" ) @@ -14,5 +14,5 @@ type Handler interface { } type Forwarder interface { - Forward(chain.Hop) + Forward(hop.Hop) } diff --git a/chain/hop.go b/hop/hop.go similarity index 72% rename from chain/hop.go rename to hop/hop.go index 4cf5a64..ddb434a 100644 --- a/chain/hop.go +++ b/hop/hop.go @@ -1,6 +1,10 @@ -package chain +package hop -import "context" +import ( + "context" + + "github.com/go-gost/core/chain" +) type SelectOptions struct { Addr string @@ -29,6 +33,9 @@ func ProtocolSelectOption(protocol string) SelectOption { } type Hop interface { - Nodes() []*Node - Select(ctx context.Context, opts ...SelectOption) *Node + Select(ctx context.Context, opts ...SelectOption) *chain.Node +} + +type NodeList interface { + Nodes() []*chain.Node }