chore: cleanup error using of dialer.DefaultInterface

This commit is contained in:
wwqgtxx
2023-10-26 09:07:49 +08:00
parent 55f626424f
commit cf93f69f40
5 changed files with 12 additions and 10 deletions

View File

@@ -8,7 +8,6 @@ import (
"net/netip"
"strings"
"github.com/Dreamacro/clash/common/atomic"
"github.com/Dreamacro/clash/component/ca"
"github.com/Dreamacro/clash/component/dialer"
"github.com/Dreamacro/clash/component/resolver"
@@ -23,7 +22,7 @@ type client struct {
r *Resolver
port string
host string
iface atomic.TypedValue[string]
iface string
proxyAdapter C.ProxyAdapter
proxyName string
addr string
@@ -74,8 +73,8 @@ func (c *client) ExchangeContext(ctx context.Context, m *D.Msg) (*D.Msg, error)
}
var options []dialer.Option
if c.iface.Load() != "" {
options = append(options, dialer.WithInterface(c.iface.Load()))
if c.iface != "" {
options = append(options, dialer.WithInterface(c.iface))
}
conn, err := getDialHandler(c.r, c.proxyAdapter, c.proxyName, options...)(ctx, network, net.JoinHostPort(ip.String(), c.port))