Compare commits

..
Author SHA1 Message Date
Fangliding 212d1b108b handle localhost 2026-06-05 21:08:34 +08:00
Fangliding 2101c1a99f use netip 2026-06-05 18:36:53 +08:00
Fangliding e1fe8be7a5 typo 2026-06-05 18:30:38 +08:00
Fangliding bbc8103a7d Bypass default interface for loopback 2026-06-05 17:16:53 +08:00
2 changed files with 7 additions and 3 deletions
+7
View File
@@ -2,6 +2,8 @@ package tun
import (
"context"
"net/netip"
"strings"
"syscall"
"github.com/xtls/xray-core/common"
@@ -80,6 +82,11 @@ func (t *Handler) Init(ctx context.Context, pm policy.Manager, dispatcher routin
return nil
}
return c.Control(func(fd uintptr) {
addrPort, _ := netip.ParseAddrPort(address)
// skip loopback
if addrPort.Addr().IsLoopback() || strings.HasPrefix(strings.ToLower(address), "localhost:") {
return
}
err := setinterface(network, address, fd, iface)
if err != nil {
errors.LogInfoInner(context.Background(), err, "[tun] falied to set interface")
-3
View File
@@ -234,9 +234,6 @@ func dnsQuery(server string, domain string, sockopt *internet.SocketConfig) ([]b
if err != nil {
return nil, 0, err
}
// h2c: in config is just for claim
// change scheme to https and expect outbound to handle TLS (freedom + tlsSetting)
req.URL.Scheme = "https"
req.Header.Set("Accept", "application/dns-message")
req.Header.Set("Content-Type", "application/dns-message")
utils.TryDefaultHeadersWith(req.Header, "fetch")