summaryrefslogtreecommitdiff
path: root/pkg/vpn/bonafide/eip_service.go
diff options
context:
space:
mode:
authorkali kaneko (leap communications) <kali@leap.se>2021-05-17 17:33:40 +0200
committerkali kaneko (leap communications) <kali@leap.se>2021-05-17 17:52:47 +0200
commit86d30f2a2edc0d9b9c54b51258a6566e37476849 (patch)
treef3f6d52eb6bd976e06a224480914c900338cba44 /pkg/vpn/bonafide/eip_service.go
parent083f4095319b734f33f3e28a9f3234ff9cf6a7d7 (diff)
[feat] retry if dns lookup fails
Diffstat (limited to 'pkg/vpn/bonafide/eip_service.go')
-rw-r--r--pkg/vpn/bonafide/eip_service.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/pkg/vpn/bonafide/eip_service.go b/pkg/vpn/bonafide/eip_service.go
index d5dd751..5755b6c 100644
--- a/pkg/vpn/bonafide/eip_service.go
+++ b/pkg/vpn/bonafide/eip_service.go
@@ -83,6 +83,13 @@ func (b *Bonafide) fetchEipJSON() error {
// TODO why exactly 1 retry? Make it configurable, for tests
time.Sleep(retryFetchJSONSeconds * time.Second)
resp, err = b.client.Post(eip3API, "", nil)
+ if err != nil {
+ // TODO it might be that it's not an error, but an empty file or whatever done
+ // by DNS poisoning. Should try to parse the file.
+ uri := b.getURLNoDNS("eip")
+ log.Println("Fetching ", uri)
+ resp, err = b.client.Post(uri, "", nil)
+ }
}
defer resp.Body.Close()