mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-07-05 19:28:45 +00:00
use netip
This commit is contained in:
@@ -2,6 +2,7 @@ package tun
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"net/netip"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/xtls/xray-core/common"
|
"github.com/xtls/xray-core/common"
|
||||||
@@ -80,10 +81,9 @@ func (t *Handler) Init(ctx context.Context, pm policy.Manager, dispatcher routin
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return c.Control(func(fd uintptr) {
|
return c.Control(func(fd uintptr) {
|
||||||
ipStr, _, _ := net.SplitHostPort(address)
|
addrPort, _ := netip.ParseAddrPort(address)
|
||||||
ip := net.ParseIP(ipStr)
|
|
||||||
// skip loopback
|
// skip loopback
|
||||||
if ip != nil && ip.IsLoopback() {
|
if addrPort.Addr().IsLoopback() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err := setinterface(network, address, fd, iface)
|
err := setinterface(network, address, fd, iface)
|
||||||
|
|||||||
Reference in New Issue
Block a user