Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: set custom DNS server only once #821

Merged
merged 2 commits into from
Aug 17, 2023

Conversation

WaterLemons2k
Copy link
Contributor

What does this PR do?

Set custom DNS server only once.

Motivation

Poorly written code in #682.

Additional Notes

Every time an HTTP client is created, an attempt is made to modify the dialer.Resolver.

So now it only attempts to change the dialer.Resolver once when necessary (e.g. by passing the -dns parameter or running the WaitForNetworkConnected function).

Also, rename dns.go and dns_test.go to net_resolver.go and net_resolver_test.go


Move wait_net.go to the internal package to prevent it from being mistaken as a DNS provider.

Ignore false positive.

Every time an HTTP client is created, an attempt is made to modify the `dialer.Resolver`.

So now it only attempts to change the `dialer.Resolver` once when necessary (e.g. by passing the `-dns` parameter or running the `WaitForNetworkConnected` function).

Also, rename `dns.go` and `dns_test.go` to `net_resolver.go` and `net_resolver_test.go`

---

Move `wait_net.go` to the `internal` package to prevent it from being mistaken as a DNS provider.

Ignore false positive.
@jeessy2 jeessy2 merged commit 98756f2 into jeessy2:master Aug 17, 2023
2 checks passed
@WaterLemons2k WaterLemons2k deleted the net.Resolver branch August 17, 2023 07:30
@jeessy2
Copy link
Owner

jeessy2 commented Aug 17, 2023

SkipVerfiry也可以参考这个思路修改下吧?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants