mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-02-03 22:18:39 +00:00
all: rework bootstrap IP discovering
At startup, ctrld gathers bootstrap IP information and use this bootstrap IP for connecting to upstream. However, in case the network stack changed, for example, dues to VPN connection, ctrld will still use this old (maybe invalid) bootstrap IP for the current network stack. This commit rework the discovering process, and re-initializing the bootstrap IP if connecting to upstream failed.
This commit is contained in:
committed by
Cuong Manh Le
parent
930a5ad439
commit
8b08cc8a6e
@@ -93,5 +93,8 @@ func (r *legacyResolver) Resolve(ctx context.Context, msg *dns.Msg) (*dns.Msg, e
|
||||
Dialer: dialer,
|
||||
}
|
||||
answer, _, err := dnsClient.ExchangeContext(ctx, msg, r.endpoint)
|
||||
if _, ok := err.(*net.OpError); ok {
|
||||
return answer, ErrUpstreamFailed
|
||||
}
|
||||
return answer, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user