From f657ac97f6a3c4ecdd91d8d6ab7d97f896e4a142 Mon Sep 17 00:00:00 2001 From: wwqgtxx Date: Sun, 11 Dec 2022 15:48:37 +0800 Subject: [PATCH] fix: add an unmap before is6 --- adapter/outbound/hysteria.go | 2 +- adapter/outbound/tuic.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/adapter/outbound/hysteria.go b/adapter/outbound/hysteria.go index 9dc34b44..cd36db5a 100644 --- a/adapter/outbound/hysteria.go +++ b/adapter/outbound/hysteria.go @@ -334,7 +334,7 @@ type hyDialerWithContext struct { func (h *hyDialerWithContext) ListenPacket(rAddr net.Addr) (net.PacketConn, error) { network := "udp" if addrPort, err := netip.ParseAddrPort(rAddr.String()); err == nil { - if addrPort.Addr().Is6() { + if addrPort.Addr().Unmap().Is6() { network = "udp6" } } diff --git a/adapter/outbound/tuic.go b/adapter/outbound/tuic.go index 8df1539a..5119f8d2 100644 --- a/adapter/outbound/tuic.go +++ b/adapter/outbound/tuic.go @@ -80,7 +80,7 @@ func (t *Tuic) dial(ctx context.Context, opts ...dialer.Option) (pc net.PacketCo } addr = udpAddr network := "udp" - if udpAddr.AddrPort().Addr().Is6() { + if udpAddr.AddrPort().Addr().Unmap().Is6() { network = "udp6" } pc, err = dialer.ListenPacket(ctx, network, "", opts...)