Remove usage of ShadowConn for ssHandler and ssConnector (#68)
The new ss library has integrated the function of ShadowConn.
This commit is contained in:
@@ -14,7 +14,6 @@ import (
|
||||
"github.com/go-gost/go-shadowsocks2/utils"
|
||||
"github.com/go-gost/gosocks5"
|
||||
ctxvalue "github.com/go-gost/x/ctx"
|
||||
"github.com/go-gost/x/internal/util/ss"
|
||||
"github.com/go-gost/x/registry"
|
||||
)
|
||||
|
||||
@@ -102,11 +101,7 @@ func (c *ssConnector) Connect(ctx context.Context, conn net.Conn, network, addre
|
||||
}
|
||||
|
||||
target := socks.Addr(rawaddr[:n])
|
||||
_, padding, err := utils.GeneratePadding()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
conn, err = c.client.WrapConn(conn, target, padding, nil)
|
||||
conn, err = c.client.WrapConn(conn, target)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -118,7 +113,7 @@ func (c *ssConnector) Connect(ctx context.Context, conn net.Conn, network, addre
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
sc = ss.ShadowConn(conn, nil)
|
||||
sc = conn
|
||||
|
||||
return sc, nil
|
||||
}
|
||||
|
||||
@@ -93,13 +93,8 @@ func (c *ssuConnector) Connect(ctx context.Context, conn net.Conn, network, addr
|
||||
return ss.UDPClientConn(pc, conn.RemoteAddr(), taddr, c.md.udpBufferSize, &c.client, &c.sessionMap), nil
|
||||
}
|
||||
|
||||
_, padding, err := utils.GeneratePadding()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
target := socks.ParseAddr(taddr.String())
|
||||
conn, err = c.tcpClient.WrapConn(conn, target, padding, nil)
|
||||
conn, err := c.tcpClient.WrapConn(conn, target)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ require (
|
||||
github.com/gin-contrib/cors v1.7.2
|
||||
github.com/gin-gonic/gin v1.10.1
|
||||
github.com/go-gost/core v0.3.3
|
||||
github.com/go-gost/go-shadowsocks2 v0.1.1
|
||||
github.com/go-gost/go-shadowsocks2 v0.1.2
|
||||
github.com/go-gost/gosocks4 v0.0.1
|
||||
github.com/go-gost/gosocks5 v0.4.2
|
||||
github.com/go-gost/plugin v0.2.1
|
||||
|
||||
@@ -51,10 +51,8 @@ github.com/gin-gonic/gin v1.10.1 h1:T0ujvqyCSqRopADpgPgiTT63DUQVSfojyME59Ei63pQ=
|
||||
github.com/gin-gonic/gin v1.10.1/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
|
||||
github.com/go-gost/core v0.3.3 h1:YN15FQptQoNB0MlMR283C99w2EeGql9Cm+4QVlN6zs0=
|
||||
github.com/go-gost/core v0.3.3/go.mod h1:WGI43jOka7FAsSAwi/fSMaqxdR+E339ycb4NBGlFr6A=
|
||||
github.com/go-gost/go-shadowsocks2 v0.1.0 h1:aIJwIe9raITw/aiVFTETstJ0TFpIcurwwhJVqT39vic=
|
||||
github.com/go-gost/go-shadowsocks2 v0.1.0/go.mod h1:866zFNNI3He6Wef1M/IvAjTal74WhcfKfBgRpTlkKys=
|
||||
github.com/go-gost/go-shadowsocks2 v0.1.1 h1:jHHmHXELQmEheXam65yOm5GhXytqgJT9fHeHLuSNSWQ=
|
||||
github.com/go-gost/go-shadowsocks2 v0.1.1/go.mod h1:866zFNNI3He6Wef1M/IvAjTal74WhcfKfBgRpTlkKys=
|
||||
github.com/go-gost/go-shadowsocks2 v0.1.2 h1:qgTUQS6aCGzsFArjiKjLP0a7zEVtEYVCRVc5LjOsaVk=
|
||||
github.com/go-gost/go-shadowsocks2 v0.1.2/go.mod h1:866zFNNI3He6Wef1M/IvAjTal74WhcfKfBgRpTlkKys=
|
||||
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.2 h1:IianxHTkACPqCwiOAT3MHoMdSUl+SEPSRu1ikawC1Pc=
|
||||
|
||||
@@ -19,7 +19,6 @@ import (
|
||||
ictx "github.com/go-gost/x/internal/ctx"
|
||||
xnet "github.com/go-gost/x/internal/net"
|
||||
"github.com/go-gost/x/internal/util/sniffing"
|
||||
"github.com/go-gost/x/internal/util/ss"
|
||||
tls_util "github.com/go-gost/x/internal/util/tls"
|
||||
rate_limiter "github.com/go-gost/x/limiter/rate"
|
||||
xstats "github.com/go-gost/x/observer/stats"
|
||||
@@ -141,7 +140,7 @@ func (h *ssHandler) Handle(ctx context.Context, conn net.Conn, opts ...handler.H
|
||||
return
|
||||
}
|
||||
target := wrappedConn.Target()
|
||||
conn = ss.ShadowConn(wrappedConn, nil)
|
||||
conn = wrappedConn
|
||||
|
||||
conn.SetReadDeadline(time.Now().Add(h.md.readTimeout))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user