mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2025-02-23 12:42:27 +08:00
Revert "fix hysteria faketcp lookback in TUN mode (#601)"
This reverts commit fdaa6a22a4
.
This commit is contained in:
parent
e1a5b93cce
commit
2e94531c72
@ -14,6 +14,7 @@ func LookupLocalAddrFromIfaceName(ifaceName string, network string, destination
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
destination = destination.Unmap()
|
||||||
|
|
||||||
var addr netip.Prefix
|
var addr netip.Prefix
|
||||||
switch network {
|
switch network {
|
||||||
@ -23,7 +24,7 @@ func LookupLocalAddrFromIfaceName(ifaceName string, network string, destination
|
|||||||
addr, err = ifaceObj.PickIPv6Addr(destination)
|
addr, err = ifaceObj.PickIPv6Addr(destination)
|
||||||
default:
|
default:
|
||||||
if destination.IsValid() {
|
if destination.IsValid() {
|
||||||
if destination.Is4() || destination.Is4In6() {
|
if destination.Is4() {
|
||||||
addr, err = ifaceObj.PickIPv4Addr(destination)
|
addr, err = ifaceObj.PickIPv4Addr(destination)
|
||||||
} else {
|
} else {
|
||||||
addr, err = ifaceObj.PickIPv6Addr(destination)
|
addr, err = ifaceObj.PickIPv6Addr(destination)
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"net"
|
"net"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/metacubex/mihomo/common/singledo"
|
"github.com/metacubex/mihomo/common/singledo"
|
||||||
@ -38,21 +37,12 @@ func ResolveInterface(name string) (*Interface, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
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))
|
ipNets := make([]netip.Prefix, 0, len(addrs))
|
||||||
for _, addr := range addrs {
|
for _, addr := range addrs {
|
||||||
ipNet := addr.(*net.IPNet)
|
ipNet := addr.(*net.IPNet)
|
||||||
ip, _ := netip.AddrFromSlice(ipNet.IP)
|
ip, _ := netip.AddrFromSlice(ipNet.IP)
|
||||||
|
|
||||||
//unavailable IPv6 Address
|
|
||||||
if ip.Is6() && strings.HasPrefix(ip.String(), "fe80") {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
ones, bits := ipNet.Mask.Size()
|
ones, bits := ipNet.Mask.Size()
|
||||||
if bits == 32 {
|
if bits == 32 {
|
||||||
ip = ip.Unmap()
|
ip = ip.Unmap()
|
||||||
|
Loading…
Reference in New Issue
Block a user