From 2e94531c72eca564ddbec268bf7760cfbca44428 Mon Sep 17 00:00:00 2001 From: wwqgtxx Date: Wed, 20 Mar 2024 18:07:13 +0800 Subject: [PATCH] Revert "fix hysteria faketcp lookback in TUN mode (#601)" This reverts commit fdaa6a22a4d14ccb08a5173128e1c47585678627. --- component/dialer/bind.go | 3 ++- component/iface/iface.go | 10 ---------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/component/dialer/bind.go b/component/dialer/bind.go index 72df8c721..9b6471a32 100644 --- a/component/dialer/bind.go +++ b/component/dialer/bind.go @@ -14,6 +14,7 @@ func LookupLocalAddrFromIfaceName(ifaceName string, network string, destination if err != nil { return nil, err } + destination = destination.Unmap() var addr netip.Prefix switch network { @@ -23,7 +24,7 @@ func LookupLocalAddrFromIfaceName(ifaceName string, network string, destination addr, err = ifaceObj.PickIPv6Addr(destination) default: if destination.IsValid() { - if destination.Is4() || destination.Is4In6() { + if destination.Is4() { addr, err = ifaceObj.PickIPv4Addr(destination) } else { addr, err = ifaceObj.PickIPv6Addr(destination) diff --git a/component/iface/iface.go b/component/iface/iface.go index bf186165f..dd932b462 100644 --- a/component/iface/iface.go +++ b/component/iface/iface.go @@ -4,7 +4,6 @@ import ( "errors" "net" "net/netip" - "strings" "time" "github.com/metacubex/mihomo/common/singledo" @@ -38,21 +37,12 @@ func ResolveInterface(name string) (*Interface, error) { if err != nil { continue } - // if not available device like Meta, dummy0, docker0, etc. - if (iface.Flags&net.FlagMulticast == 0) || (iface.Flags&net.FlagPointToPoint != 0) || (iface.Flags&net.FlagRunning == 0) { - continue - } ipNets := make([]netip.Prefix, 0, len(addrs)) for _, addr := range addrs { ipNet := addr.(*net.IPNet) ip, _ := netip.AddrFromSlice(ipNet.IP) - //unavailable IPv6 Address - if ip.Is6() && strings.HasPrefix(ip.String(), "fe80") { - continue - } - ones, bits := ipNet.Mask.Size() if bits == 32 { ip = ip.Unmap()