diff options
Diffstat (limited to 'gateways.go')
-rw-r--r-- | gateways.go | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/gateways.go b/gateways.go index 05220c3..c4597a0 100644 --- a/gateways.go +++ b/gateways.go @@ -21,16 +21,10 @@ import ( "net/http" ) -const ( - // yes, I am cheating. The config file is also exposed on the top-level - // domain, which is served behind a letsencrypt certificate. this saves passing - // the certificate for the ca etc. - eipAPI = "https://black.riseup.net/1/config/eip-service.json" -) - type bonafide struct { client *http.Client eip *eipService + eipAPI string } type eipService struct { @@ -55,9 +49,10 @@ type coordinates struct { Longitude float64 } -func newBonafide() *bonafide { +func newBonafide(apiDomain string) *bonafide { client := &http.Client{} - return &bonafide{client, nil} + eipAPI := apiDomain + "/3/config/eip-service.json" + return &bonafide{client, nil, eipAPI} } func (b *bonafide) getGateways() ([]gateway, error) { @@ -71,7 +66,7 @@ func (b *bonafide) getGateways() ([]gateway, error) { } func (b *bonafide) fetchEipJSON() error { - resp, err := b.client.Post(eipAPI, "", nil) + resp, err := b.client.Post(b.eipAPI, "", nil) if err != nil { return err } |