mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-14 21:31:16 +08:00
fix: dns specified interface does not change
This commit is contained in:
parent
e2409f9639
commit
bbbe371ea9
@ -689,7 +689,7 @@ func parseNameServer(servers []string) ([]dns.NameServer, error) {
|
||||
Net: dnsNetType,
|
||||
Addr: addr,
|
||||
ProxyAdapter: u.Fragment,
|
||||
Interface: dialer.DefaultInterface.Load(),
|
||||
Interface: dialer.DefaultInterface,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"go.uber.org/atomic"
|
||||
"net"
|
||||
"net/netip"
|
||||
"strings"
|
||||
@ -19,7 +20,7 @@ type client struct {
|
||||
r *Resolver
|
||||
port string
|
||||
host string
|
||||
iface string
|
||||
iface *atomic.String
|
||||
proxyAdapter string
|
||||
}
|
||||
|
||||
@ -49,8 +50,8 @@ func (c *client) ExchangeContext(ctx context.Context, m *D.Msg) (*D.Msg, error)
|
||||
}
|
||||
|
||||
options := []dialer.Option{}
|
||||
if c.iface != "" {
|
||||
options = append(options, dialer.WithInterface(c.iface))
|
||||
if c.iface != nil && c.iface.Load() != "" {
|
||||
options = append(options, dialer.WithInterface(c.iface.Load()))
|
||||
}
|
||||
|
||||
var conn net.Conn
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"go.uber.org/atomic"
|
||||
"math/rand"
|
||||
"net/netip"
|
||||
"strings"
|
||||
@ -356,7 +357,7 @@ func (r *Resolver) HasProxyServer() bool {
|
||||
type NameServer struct {
|
||||
Net string
|
||||
Addr string
|
||||
Interface string
|
||||
Interface *atomic.String
|
||||
ProxyAdapter string
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user