This commit is contained in:
ginuerzh
2021-11-15 12:55:05 +08:00
parent 3fe5084629
commit ce3d62759a
38 changed files with 788 additions and 291 deletions

View File

@ -6,6 +6,7 @@ import (
"time"
"github.com/go-gost/gosocks5"
"github.com/go-gost/gost/pkg/chain"
"github.com/go-gost/gost/pkg/handler"
"github.com/go-gost/gost/pkg/internal/bufpool"
"github.com/go-gost/gost/pkg/internal/utils/socks"
@ -16,6 +17,14 @@ func (h *socks5Handler) handleUDPTun(ctx context.Context, conn net.Conn, req *go
"cmd": "udp-tun",
})
if !h.md.enableUDP {
reply := gosocks5.NewReply(gosocks5.NotAllowed, nil)
reply.Write(conn)
h.logger.Debug(reply)
h.logger.Error("UDP relay is diabled")
return
}
if h.chain.IsEmpty() {
addr := req.Addr.String()
@ -56,7 +65,7 @@ func (h *socks5Handler) handleUDPTun(ctx context.Context, conn net.Conn, req *go
return
}
r := (&handler.Router{}).
r := (&chain.Router{}).
WithChain(h.chain).
WithRetry(h.md.retryCount).
WithLogger(h.logger)