Skip to content

Auto detect network name server changes#66

Merged
MichaConrad merged 6 commits intodevfrom
michaco/detect-network-changes
Mar 17, 2020
Merged

Auto detect network name server changes#66
MichaConrad merged 6 commits intodevfrom
michaco/detect-network-changes

Conversation

@MichaConrad
Copy link
Copy Markdown
Collaborator

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).

@MichaConrad MichaConrad added this to the 1.3.0 milestone Mar 17, 2020
@MichaConrad MichaConrad self-assigned this Mar 17, 2020
@MichaConrad MichaConrad merged commit db2d7cf into dev Mar 17, 2020
@MichaConrad MichaConrad deleted the michaco/detect-network-changes branch March 17, 2020 22:42
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.

1 participant