add sockopts config

This commit is contained in:
ginuerzh
2022-03-29 23:04:12 +08:00
parent 78089d8887
commit 47cfc087e9
11 changed files with 115 additions and 36 deletions

View File

@ -154,7 +154,7 @@ func (h *httpHandler) handleRequest(ctx context.Context, conn net.Conn, req *htt
}
if network == "udp" {
return h.handleUDP(ctx, conn, network, req.Host, log)
return h.handleUDP(ctx, conn, log)
}
if req.Method == "PRI" ||

View File

@ -13,7 +13,7 @@ import (
"github.com/go-gost/core/logger"
)
func (h *httpHandler) handleUDP(ctx context.Context, conn net.Conn, network, address string, log logger.Logger) error {
func (h *httpHandler) handleUDP(ctx context.Context, conn net.Conn, log logger.Logger) error {
log = log.WithFields(map[string]any{
"cmd": "udp",
})

View File

@ -34,7 +34,7 @@ func (h *socks5Handler) parseMetadata(md mdata.Metadata) (err error) {
if bs := mdata.GetInt(md, udpBufferSize); bs > 0 {
h.md.udpBufferSize = int(math.Min(math.Max(float64(bs), 512), 64*1024))
} else {
h.md.udpBufferSize = 1024
h.md.udpBufferSize = 1500
}
h.md.compatibilityMode = mdata.GetBool(md, compatibilityMode)