1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-12-26 20:15:26 -05:00

remove use of context.WithValue in transport

This commit is contained in:
Darien Raymond
2018-11-21 14:54:40 +01:00
parent d2d0c69f17
commit 5279296f03
32 changed files with 212 additions and 297 deletions

View File

@@ -125,14 +125,14 @@ func (d *DokodemoDoor) Process(ctx context.Context, network net.Network, conn in
if !d.config.FollowRedirect {
writer = &buf.SequentialWriter{Writer: conn}
} else {
tCtx := internet.ContextWithBindAddress(context.Background(), dest)
tCtx = internet.ContextWithStreamSettings(tCtx, &internet.MemoryStreamConfig{
ProtocolName: "udp",
SocketSettings: &internet.SocketConfig{
Tproxy: internet.SocketConfig_TProxy,
},
})
tConn, err := internet.DialSystem(tCtx, net.DestinationFromAddr(conn.RemoteAddr()))
sockopt := &internet.SocketConfig{
Tproxy: internet.SocketConfig_TProxy,
}
if dest.Address.Family().IsIP() {
sockopt.BindAddress = dest.Address.IP()
sockopt.BindPort = uint32(dest.Port)
}
tConn, err := internet.DialSystem(ctx, net.DestinationFromAddr(conn.RemoteAddr()), sockopt)
if err != nil {
return err
}