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"
)
@ -38,11 +37,7 @@ func (h *relayHandler) handleConnect(ctx context.Context, conn net.Conn, network
return
}
r := (&chain.Router{}).
WithChain(h.chain).
WithRetry(h.md.retryCount).
WithLogger(h.logger)
cc, err := r.Dial(ctx, network, address)
cc, err := h.router.Dial(ctx, network, address)
if err != nil {
resp.Status = relay.StatusNetworkUnreachable
resp.WriteTo(conn)