1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-26 09:25:23 +00:00

don't use new address if not in redirect mode

This commit is contained in:
Darien Raymond 2019-01-14 22:57:53 +01:00
parent f79f0a83c9
commit 35432832c4
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -78,13 +78,17 @@ func (d *DokodemoDoor) Process(ctx context.Context, network net.Network, conn in
Address: d.address,
Port: d.port,
}
destinationOverridden := false
if d.config.FollowRedirect {
if outbound := session.OutboundFromContext(ctx); outbound != nil && outbound.Target.IsValid() {
dest = outbound.Target
destinationOverridden = true
} else if handshake, ok := conn.(hasHandshakeAddress); ok {
addr := handshake.HandshakeAddress()
if addr != nil {
dest.Address = addr
destinationOverridden = true
}
}
}
@ -121,7 +125,7 @@ func (d *DokodemoDoor) Process(ctx context.Context, network net.Network, conn in
writer = buf.NewWriter(conn)
} else {
//if we are in TPROXY mode, use linux's udp forging functionality
if !d.config.FollowRedirect {
if !destinationOverridden {
writer = &buf.SequentialWriter{Writer: conn}
} else {
sockopt := &internet.SocketConfig{