add more options for kcp dialer/listener

This commit is contained in:
ginuerzh 2024-03-09 20:58:22 +08:00
parent 25dcf536c6
commit d9b7585856
4 changed files with 14 additions and 2 deletions

View File

@ -49,7 +49,12 @@ func (d *kcpDialer) parseMetadata(md mdata.Metadata) (err error) {
d.md.config.KeepAlive = mdutil.GetInt(md, "kcp.keepalive")
d.md.config.Interval = mdutil.GetInt(md, "kcp.interval")
d.md.config.MTU = mdutil.GetInt(md, "kcp.mtu")
d.md.config.RcvWnd = mdutil.GetInt(md, "kcp.rcvwnd")
d.md.config.SndWnd = mdutil.GetInt(md, "kcp.sndwnd")
d.md.config.SmuxVer = mdutil.GetInt(md, "kcp.smuxver")
d.md.config.SmuxBuf = mdutil.GetInt(md, "kcp.smuxbuf")
d.md.config.StreamBuf = mdutil.GetInt(md, "kcp.streambuf")
d.md.config.NoComp = mdutil.GetBool(md, "kcp.nocomp")
d.md.handshakeTimeout = mdutil.GetDuration(md, handshakeTimeout)
return

2
go.mod
View File

@ -7,7 +7,7 @@ require (
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d
github.com/gin-contrib/cors v1.5.0
github.com/gin-gonic/gin v1.9.1
github.com/go-gost/core v0.0.0-20240131151724-a06608ccafbf
github.com/go-gost/core v0.0.0-20240309124515-fea73cf68235
github.com/go-gost/gosocks4 v0.0.1
github.com/go-gost/gosocks5 v0.4.0
github.com/go-gost/plugin v0.0.0-20240103125338-9c84e29cb81a

2
go.sum
View File

@ -51,6 +51,8 @@ github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg=
github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU=
github.com/go-gost/core v0.0.0-20240131151724-a06608ccafbf h1:akQ96Ibm+P7IftDluZPoMCzBzbLR/TjFu8Wpjy3H7hM=
github.com/go-gost/core v0.0.0-20240131151724-a06608ccafbf/go.mod h1:ndkgWVYRLwupVaFFWv8ML1Nr8tD3xhHK245PLpUDg4E=
github.com/go-gost/core v0.0.0-20240309124515-fea73cf68235 h1:2iju5ndwCnazCaOcacxJaVFf3J/yb0L0ebXYh2J4rik=
github.com/go-gost/core v0.0.0-20240309124515-fea73cf68235/go.mod h1:ndkgWVYRLwupVaFFWv8ML1Nr8tD3xhHK245PLpUDg4E=
github.com/go-gost/gosocks4 v0.0.1 h1:+k1sec8HlELuQV7rWftIkmy8UijzUt2I6t+iMPlGB2s=
github.com/go-gost/gosocks4 v0.0.1/go.mod h1:3B6L47HbU/qugDg4JnoFPHgJXE43Inz8Bah1QaN9qCc=
github.com/go-gost/gosocks5 v0.4.0 h1:EIrOEkpJez4gwHrMa33frA+hHXJyevjp47thpMQsJzI=

View File

@ -52,7 +52,12 @@ func (l *kcpListener) parseMetadata(md mdata.Metadata) (err error) {
l.md.config.KeepAlive = mdutil.GetInt(md, "kcp.keepalive")
l.md.config.Interval = mdutil.GetInt(md, "kcp.interval")
l.md.config.MTU = mdutil.GetInt(md, "kcp.mtu")
l.md.config.SmuxVer = mdutil.GetInt(md, "kcp.smuxVer")
l.md.config.RcvWnd = mdutil.GetInt(md, "kcp.rcvwnd")
l.md.config.SndWnd = mdutil.GetInt(md, "kcp.sndwnd")
l.md.config.SmuxVer = mdutil.GetInt(md, "kcp.smuxver")
l.md.config.SmuxBuf = mdutil.GetInt(md, "kcp.smuxbuf")
l.md.config.StreamBuf = mdutil.GetInt(md, "kcp.streambuf")
l.md.config.NoComp = mdutil.GetBool(md, "kcp.nocomp")
l.md.backlog = mdutil.GetInt(md, backlog)
if l.md.backlog <= 0 {