Skip to content

Commit

Permalink
fix: fix wireguard outbound not work with the sniffer
Browse files Browse the repository at this point in the history
  • Loading branch information
wwqgtxx committed Dec 11, 2022
1 parent 02d3468 commit 8fa6bd1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions adapter/outbound/wireguard.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ func (w *WireGuard) DialContext(ctx context.Context, metadata *C.Metadata, opts
}
conn, err = N.DialSerial(ctx, w.tunDevice, "tcp", M.ParseSocksaddr(metadata.RemoteAddress()), addrs)
} else {
conn, err = w.tunDevice.DialContext(ctx, "tcp", M.ParseSocksaddr(metadata.Pure().RemoteAddress()))
port, _ := strconv.Atoi(metadata.DstPort)
conn, err = w.tunDevice.DialContext(ctx, "tcp", M.SocksaddrFrom(metadata.DstIP, uint16(port)))
}
if err != nil {
return nil, err
Expand Down Expand Up @@ -242,7 +243,8 @@ func (w *WireGuard) ListenPacketContext(ctx context.Context, metadata *C.Metadat
}
metadata.DstIP = ip
}
pc, err = w.tunDevice.ListenPacket(ctx, M.ParseSocksaddr(metadata.Pure().RemoteAddress()))
port, _ := strconv.Atoi(metadata.DstPort)
pc, err = w.tunDevice.ListenPacket(ctx, M.SocksaddrFrom(metadata.DstIP, uint16(port)))
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 8fa6bd1

Please sign in to comment.