Skip to content

Commit 76e140c

Browse files
committed
Handle network change for DNS
1 parent 03a3f7d commit 76e140c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Diff for: main_dns.go

+12-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,18 @@ func StartDNS() *godnschange.DNSStruct {
145145
dnsChange.Success = false
146146
} else {
147147
detectNetworkChange(profile.STUNServer, func() {
148-
// Handle network change for DNS
148+
// Recover dns configuration
149+
dnsChange.RestoreDNS(LocalDNS)
150+
dnsChange := godnschange.NewDNSChange()
151+
myDNSInfo := dnsChange.GetDNS()
152+
conf := GenerateCoreDNSConfig(myDNSInfo, profile, APIClient)
153+
CoreDNSConfig = &conf
154+
err := dnsChange.Change(LocalDNS, profile.DomainsToResolve, profile.NamesToResolve, profile.InternalDomainToResolve, APIClient.Host)
155+
if err != nil {
156+
dnsChange.Success = false
157+
} else {
158+
dnsChange.Success = true
159+
}
149160
})
150161

151162
go listenMyEvents(profile, dnsNewPeerHandler(profile))

0 commit comments

Comments
 (0)