Chore: Limit sing* dependencies to shadowsocks_2022 only (#6286)

https://github.com/XTLS/Xray-core/pull/6286#issuecomment-4658968225
This commit is contained in:
𐲓𐳛π³ͺ𐳂𐳐 𐲀𐳒𐳦𐳫𐳒 π²₯𐳔𐳛π³ͺπ³Œπ³‘π³–π³‡
2026-06-09 18:55:42 +08:00
committed by GitHub
parent 3239d21168
commit 95e9816223
7 changed files with 34 additions and 142 deletions
+6 -23
View File
@@ -10,7 +10,6 @@ import (
B "github.com/sagernet/sing/common/buf"
"github.com/sagernet/sing/common/bufio"
N "github.com/sagernet/sing/common/network"
"github.com/sagernet/sing/common/uot"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/common/errors"
@@ -29,10 +28,9 @@ func init() {
}
type Outbound struct {
ctx context.Context
server net.Destination
method shadowsocks.Method
uotClient *uot.Client
ctx context.Context
server net.Destination
method shadowsocks.Method
}
func NewClient(ctx context.Context, config *ClientConfig) (*Outbound, error) {
@@ -56,9 +54,6 @@ func NewClient(ctx context.Context, config *ClientConfig) (*Outbound, error) {
} else {
return nil, errors.New("unknown method ", config.Method)
}
if config.UdpOverTcp {
o.uotClient = &uot.Client{Version: uint8(config.UdpOverTcpVersion)}
}
return o, nil
}
@@ -82,11 +77,7 @@ func (o *Outbound) Process(ctx context.Context, link *transport.Link, dialer int
errors.LogInfo(ctx, "tunneling request to ", destination, " via ", o.server.NetAddr())
serverDestination := o.server
if o.uotClient != nil {
serverDestination.Network = net.Network_TCP
} else {
serverDestination.Network = network
}
serverDestination.Network = network
connection, err := dialer.Dial(ctx, serverDestination)
if err != nil {
return errors.New("failed to connect to server").Base(err)
@@ -149,15 +140,7 @@ func (o *Outbound) Process(ctx context.Context, link *transport.Link, dialer int
}
}
if o.uotClient != nil {
uConn, err := o.uotClient.DialEarlyConn(o.method.DialEarlyConn(connection, uot.RequestDestination(o.uotClient.Version)), false, singbridge.ToSocksaddr(destination))
if err != nil {
return err
}
return singbridge.ReturnError(bufio.CopyPacketConn(ctx, packetConn, uConn))
} else {
serverConn := o.method.DialPacketConn(connection)
return singbridge.ReturnError(bufio.CopyPacketConn(ctx, packetConn, serverConn))
}
serverConn := o.method.DialPacketConn(connection)
return singbridge.ReturnError(bufio.CopyPacketConn(ctx, packetConn, serverConn))
}
}