mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 03:32:33 +08:00
fix: udp dial support ip4p
This commit is contained in:
parent
0e228765fc
commit
52e952b76e
|
@ -11,6 +11,7 @@ import (
|
|||
"strconv"
|
||||
"sync"
|
||||
|
||||
"github.com/metacubex/mihomo/component/dialer"
|
||||
"github.com/metacubex/mihomo/component/resolver"
|
||||
C "github.com/metacubex/mihomo/constant"
|
||||
"github.com/metacubex/mihomo/transport/socks5"
|
||||
|
@ -108,6 +109,10 @@ func resolveUDPAddrWithPrefer(ctx context.Context, network, address string, pref
|
|||
}
|
||||
}
|
||||
|
||||
if ip.Is6() && dialer.IP4PEnable {
|
||||
ip, port = dialer.LookupIP4P(ip, port)
|
||||
}
|
||||
|
||||
if !ip.IsValid() && fallback.IsValid() {
|
||||
ip = fallback
|
||||
}
|
||||
|
|
|
@ -408,3 +408,7 @@ func lookupIP4P(addr netip.Addr, port string) (netip.Addr, string) {
|
|||
}
|
||||
return addr, port
|
||||
}
|
||||
|
||||
func LookupIP4P(addr netip.Addr, port string) (netip.Addr, string) {
|
||||
return lookupIP4P(addr, port)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user