Skip to content
New issue

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

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

Already on GitHub? # to your account

Auto detect network name server changes #66

Merged
merged 6 commits into from
Mar 17, 2020
Merged

Conversation

MichaCo
Copy link
Owner

@MichaCo MichaCo commented Mar 17, 2020

This PR adds two things

  • Using NetworkChange event to react on changing network adapters
  • Periodically re-run NameServer.ResolveNameServers to check if the configuration changed

The 2nd part gets triggered every ~60 seconds on the next Query call.
The 2nd part is needed because NetworkChange events seem to not work on non-windows systems and changing just the DNS server entries in your network adapter also doesn't trigger any event.
The event only triggers if the network adapter got en-/dis-abled or a new one was added for example.

All this is disabled if LookupClientOptions.AutoResolveNameServers is not used/false.

Also slightly changed the legacy property setters to use the new variable _originalOptions instead of the (anyways bad) copy logic I had before.
Plus unit tests for the backward compatibility check of those properties where I actually found a bug (one method wasn't set correctly).

@MichaCo MichaCo added this to the 1.3.0 milestone Mar 17, 2020
@MichaCo MichaCo self-assigned this Mar 17, 2020
@MichaCo MichaCo merged commit db2d7cf into dev Mar 17, 2020
@MichaCo MichaCo deleted the michaco/detect-network-changes branch March 17, 2020 22:42
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant