feat: wireguard add remote-dns-resolve and dns settings

This commit is contained in:
wwqgtxx
2023-04-11 10:29:55 +08:00
parent ecdde647b1
commit ab3fce29ab
8 changed files with 121 additions and 56 deletions

View File

@ -8,14 +8,14 @@ import (
"net/netip"
"strings"
tlsC "github.com/Dreamacro/clash/component/tls"
"go.uber.org/atomic"
"github.com/Dreamacro/clash/component/dialer"
"github.com/Dreamacro/clash/component/resolver"
tlsC "github.com/Dreamacro/clash/component/tls"
C "github.com/Dreamacro/clash/constant"
D "github.com/miekg/dns"
"github.com/zhangyunhao116/fastrand"
"go.uber.org/atomic"
)
type client struct {
@ -24,7 +24,8 @@ type client struct {
port string
host string
iface *atomic.String
proxyAdapter string
proxyAdapter C.ProxyAdapter
proxyName string
addr string
}
@ -81,7 +82,7 @@ func (c *client) ExchangeContext(ctx context.Context, m *D.Msg) (*D.Msg, error)
options = append(options, dialer.WithInterface(c.iface.Load()))
}
conn, err := getDialHandler(c.r, c.proxyAdapter, options...)(ctx, network, net.JoinHostPort(ip.String(), c.port))
conn, err := getDialHandler(c.r, c.proxyAdapter, c.proxyName, options...)(ctx, network, net.JoinHostPort(ip.String(), c.port))
if err != nil {
return nil, err
}