fix: fix wireguard outbound not work with ipv6 server

This commit is contained in:
wwqgtxx 2022-12-13 08:23:17 +08:00
parent 8fa6bd1743
commit 1333f1fd47

View File

@ -91,8 +91,7 @@ func NewWireGuard(option WireGuardOption) (*WireGuard, error) {
reserved[1] = uint8(option.Reserved[1]) reserved[1] = uint8(option.Reserved[1])
reserved[2] = uint8(option.Reserved[2]) reserved[2] = uint8(option.Reserved[2])
} }
peerAddr := M.ParseSocksaddr(option.Server) peerAddr := M.ParseSocksaddrHostPort(option.Server, uint16(option.Port))
peerAddr.Port = uint16(option.Port)
outbound.bind = wireguard.NewClientBind(context.Background(), outbound.dialer, peerAddr, reserved) outbound.bind = wireguard.NewClientBind(context.Background(), outbound.dialer, peerAddr, reserved)
localPrefixes := make([]netip.Prefix, 0, 2) localPrefixes := make([]netip.Prefix, 0, 2)
if len(option.Ip) > 0 { if len(option.Ip) > 0 {