summaryrefslogtreecommitdiff
path: root/pkg/standalone/bonafide/bonafide.go
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2019-07-22 17:47:08 +0200
committerRuben Pollan <meskio@sindominio.net>2019-08-16 22:58:46 +0200
commit1de7bb124a5e502945712ef34f924ca4d1d0ca45 (patch)
tree346cc319f8dc3013fc9b9e0654d19e0720d388e7 /pkg/standalone/bonafide/bonafide.go
parent35aaba1e0da53aed44a5741ca9a3a1e2de21baf5 (diff)
[feat] be able to use obfs4
Diffstat (limited to 'pkg/standalone/bonafide/bonafide.go')
-rw-r--r--pkg/standalone/bonafide/bonafide.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/pkg/standalone/bonafide/bonafide.go b/pkg/standalone/bonafide/bonafide.go
index bdf6fff..fd32f2a 100644
--- a/pkg/standalone/bonafide/bonafide.go
+++ b/pkg/standalone/bonafide/bonafide.go
@@ -31,6 +31,7 @@ import (
const (
certAPI = config.APIURL + "1/cert"
+ certAPI3 = config.APIURL + "3/cert"
secondsPerHour = 60 * 60
retryFetchJSONSeconds = 15
)
@@ -91,6 +92,13 @@ func (b *Bonafide) GetCertPem() ([]byte, error) {
return nil, err
}
defer resp.Body.Close()
+ if resp.StatusCode == 404 {
+ resp, err = b.client.Post(certAPI3, "", nil)
+ if err != nil {
+ return nil, err
+ }
+ defer resp.Body.Close()
+ }
if resp.StatusCode != 200 {
return nil, fmt.Errorf("get vpn cert has failed with status: %s", resp.Status)
}