diff options
Diffstat (limited to 'internal/discovery/discovery.go')
| -rw-r--r-- | internal/discovery/discovery.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/internal/discovery/discovery.go b/internal/discovery/discovery.go index 512756b..cde846c 100644 --- a/internal/discovery/discovery.go +++ b/internal/discovery/discovery.go @@ -11,7 +11,7 @@ import ( "sync" "time" - httpw "codeberg.org/eduVPN/eduvpn-common/internal/http" + "codeberg.org/eduVPN/eduvpn-common/internal/httpwrap" "codeberg.org/eduVPN/eduvpn-common/internal/levenshtein" "codeberg.org/eduVPN/eduvpn-common/internal/verify" discotypes "codeberg.org/eduVPN/eduvpn-common/types/discovery" @@ -87,7 +87,7 @@ type Discovery struct { // mu is the read write mutex that protects the struct from concurrent access mu sync.RWMutex // The httpClient for sending HTTP requests - httpClient *httpw.Client + httpClient *httpwrap.Client // Organizations represents the organizations that are returned by the discovery server OrganizationList Organizations `json:"organizations"` @@ -105,21 +105,21 @@ func (discovery *Discovery) file(ctx context.Context, jsonFile string, previousV var newUpdate time.Time // No HTTP client present, create one if discovery.httpClient == nil { - discovery.httpClient = httpw.NewClient(nil) + discovery.httpClient = httpwrap.NewClient(nil) } // Get json data - jsonURL, err := httpw.JoinURLPath(DiscoURL, jsonFile) + jsonURL, err := httpwrap.JoinURLPath(DiscoURL, jsonFile) if err != nil { return newUpdate, err } - var opts *httpw.OptionalParams + var opts *httpwrap.OptionalParams if !last.IsZero() { header := http.Header{ "If-Modified-Since": []string{last.Format(http.TimeFormat)}, } - opts = &httpw.OptionalParams{ + opts = &httpwrap.OptionalParams{ Headers: header, } } @@ -143,7 +143,7 @@ func (discovery *Discovery) file(ctx context.Context, jsonFile string, previousV // Get signature sigFile := jsonFile + ".minisig" - sigURL, err := httpw.JoinURLPath(DiscoURL, sigFile) + sigURL, err := httpwrap.JoinURLPath(DiscoURL, sigFile) if err != nil { return newUpdate, err } @@ -334,7 +334,7 @@ func (discovery *Discovery) Organizations(ctx context.Context, cache bool) (*Org var jsonDecode Organizations update, err := discovery.file(ctx, file, discovery.OrganizationList.Version, discovery.OrganizationList.UpdateHeader, &jsonDecode) if err != nil { - statErr := &httpw.StatusError{} + statErr := &httpwrap.StatusError{} if errors.As(err, &statErr) { if statErr.Status != 304 { slog.Warn("failed to get fresh organization", "error", err) @@ -383,7 +383,7 @@ func (discovery *Discovery) Servers(ctx context.Context, cache bool) (*Servers, var jsonDecode Servers update, err := discovery.file(ctx, file, discovery.ServerList.Version, discovery.ServerList.UpdateHeader, &jsonDecode) if err != nil { - statErr := &httpw.StatusError{} + statErr := &httpwrap.StatusError{} if errors.As(err, &statErr) { if statErr.Status != 304 { slog.Warn("failed to get fresh servers", "error", err) |
