add resolver for router

This commit is contained in:
ginuerzh
2021-12-30 23:07:05 +08:00
parent a6671a468e
commit a430384bba
22 changed files with 362 additions and 318 deletions

View File

@ -6,7 +6,6 @@ import (
"net"
"time"
"github.com/go-gost/gost/pkg/chain"
"github.com/go-gost/gost/pkg/handler"
"github.com/go-gost/relay"
)
@ -30,12 +29,7 @@ func (h *relayHandler) handleForward(ctx context.Context, conn net.Conn, network
h.logger.Infof("%s >> %s", conn.RemoteAddr(), target.Addr())
r := (&chain.Router{}).
WithChain(h.chain).
WithRetry(h.md.retryCount).
WithLogger(h.logger)
cc, err := r.Dial(ctx, network, target.Addr())
cc, err := h.router.Dial(ctx, network, target.Addr())
if err != nil {
// TODO: the router itself may be failed due to the failed node in the router,
// the dead marker may be a wrong operation.