This commit is contained in:
ginuerzh 2022-11-16 14:30:42 +08:00
parent b0bb26fc95
commit aa8312a902
3 changed files with 11 additions and 5 deletions

View File

@ -154,9 +154,9 @@ func (c *Chain) dialWithOptions(ctx context.Context, network, address string, op
ipAddr := address
if address != "" {
ipAddr = c.resolve(address, options.Resolver, options.Hosts)
}
if ipAddr == "" {
return nil, fmt.Errorf("resolver: domain %s does not exists", address)
if ipAddr == "" {
return nil, fmt.Errorf("resolver: domain %s does not exists", address)
}
}
timeout := options.Timeout

View File

@ -131,6 +131,7 @@ func (h *tcpDirectForwardHandler) Handle(conn net.Conn) {
cc, err = h.options.Chain.Dial(node.Addr,
RetryChainOption(h.options.Retries),
TimeoutChainOption(h.options.Timeout),
ResolverChainOption(h.options.Resolver),
)
if err != nil {
log.Logf("[tcp] %s -> %s : %s", conn.RemoteAddr(), conn.LocalAddr(), err)
@ -197,7 +198,12 @@ func (h *udpDirectForwardHandler) Handle(conn net.Conn) {
}
}
cc, err := h.options.Chain.DialContext(context.Background(), "udp", node.Addr)
cc, err := h.options.Chain.DialContext(
context.Background(),
"udp",
node.Addr,
ResolverChainOption(h.options.Resolver),
)
if err != nil {
node.MarkDead()
log.Logf("[udp] %s - %s : %s", conn.RemoteAddr(), conn.LocalAddr(), err)

View File

@ -20,7 +20,7 @@ import (
)
// Version is the gost version.
const Version = "2.11.4"
const Version = "2.11.5"
// Debug is a flag that enables the debug log.
var Debug bool