mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-07-03 02:08:45 +00:00
Bypass default interface for loopback
This commit is contained in:
@@ -80,6 +80,12 @@ func (t *Handler) Init(ctx context.Context, pm policy.Manager, dispatcher routin
|
||||
return nil
|
||||
}
|
||||
return c.Control(func(fd uintptr) {
|
||||
_, ipStr, _ := net.SplitHostPort(address)
|
||||
ip := net.ParseIP(ipStr)
|
||||
// skip loopback
|
||||
if ip != nil && ip.IsLoopback() {
|
||||
return
|
||||
}
|
||||
err := setinterface(network, address, fd, iface)
|
||||
if err != nil {
|
||||
errors.LogInfoInner(context.Background(), err, "[tun] falied to set interface")
|
||||
|
||||
Reference in New Issue
Block a user