diff options
author | kali kaneko (leap communications) <kali@leap.se> | 2021-05-17 17:50:23 +0200 |
---|---|---|
committer | kali kaneko (leap communications) <kali@leap.se> | 2021-05-17 17:57:54 +0200 |
commit | c6c0209ad45fb7d2e45370ee3a39f2dd437603b0 (patch) | |
tree | b374a9536fcb4f3d4fb449db4eab042cef14577c /pkg/vpn/bonafide | |
parent | 86d30f2a2edc0d9b9c54b51258a6566e37476849 (diff) |
[feat] log dns lookup if first cert fetch fails
Diffstat (limited to 'pkg/vpn/bonafide')
-rw-r--r-- | pkg/vpn/bonafide/eip_service.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/pkg/vpn/bonafide/eip_service.go b/pkg/vpn/bonafide/eip_service.go index 5755b6c..c106135 100644 --- a/pkg/vpn/bonafide/eip_service.go +++ b/pkg/vpn/bonafide/eip_service.go @@ -79,17 +79,17 @@ func (b *Bonafide) fetchEipJSON() error { eip3API := config.APIURL + "3/config/eip-service.json" resp, err := b.client.Post(eip3API, "", nil) for err != nil { - log.Printf("Error fetching eip v3 json: %v", err) - // 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 + // TODO it might be that we get no 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) } + if err != nil { + log.Printf("Error fetching eip v3 json: %v", err) + time.Sleep(retryFetchJSONSeconds * time.Second) + } } defer resp.Body.Close() |