diff options
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/commonver/commonver.go (renamed from internal/version/version.go) | 4 | ||||
| -rw-r--r-- | internal/discovery/discovery.go | 18 | ||||
| -rw-r--r-- | internal/eduvpnapi/cache.go (renamed from internal/api/cache.go) | 4 | ||||
| -rw-r--r-- | internal/eduvpnapi/eduvpnapi.go (renamed from internal/api/api.go) | 32 | ||||
| -rw-r--r-- | internal/eduvpnapi/eduvpnapi_test.go (renamed from internal/api/api_test.go) | 8 | ||||
| -rw-r--r-- | internal/eduvpnapi/endpoints/endpoints.go (renamed from internal/api/endpoints/endpoints.go) | 0 | ||||
| -rw-r--r-- | internal/eduvpnapi/profiles/profiles.go (renamed from internal/api/profiles/profiles.go) | 0 | ||||
| -rw-r--r-- | internal/eduvpnapi/redirect.go (renamed from internal/api/redirect.go) | 2 | ||||
| -rw-r--r-- | internal/httpwrap/httpwrap.go (renamed from internal/http/http.go) | 8 | ||||
| -rw-r--r-- | internal/httpwrap/httpwrap_test.go (renamed from internal/http/http_test.go) | 2 | ||||
| -rw-r--r-- | internal/loglevel/loglevel.go (renamed from internal/log/log.go) | 4 | ||||
| -rw-r--r-- | internal/loglevel/rotate.go (renamed from internal/log/rotate.go) | 2 | ||||
| -rw-r--r-- | internal/loglevel/rotate_test.go (renamed from internal/log/rotate_test.go) | 2 | ||||
| -rw-r--r-- | internal/server/custom.go | 10 | ||||
| -rw-r--r-- | internal/server/institute.go | 10 | ||||
| -rw-r--r-- | internal/server/secureinternet.go | 10 | ||||
| -rw-r--r-- | internal/server/server.go | 10 | ||||
| -rw-r--r-- | internal/server/servers.go | 4 | ||||
| -rw-r--r-- | internal/test/server.go | 6 |
19 files changed, 68 insertions, 68 deletions
diff --git a/internal/version/version.go b/internal/commonver/commonver.go index 015a57b..71ac16e 100644 --- a/internal/version/version.go +++ b/internal/commonver/commonver.go @@ -1,8 +1,8 @@ -// Package version defines a version string that is used for: +// Package commonver defines a version string for eduvpn-common that is used for: // - building // - the user agent // - tagging -package version +package commonver // Version is the latest version // Update this when releasing 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) diff --git a/internal/api/cache.go b/internal/eduvpnapi/cache.go index 5c682f4..d3e2b77 100644 --- a/internal/api/cache.go +++ b/internal/eduvpnapi/cache.go @@ -1,4 +1,4 @@ -package api +package eduvpnapi import ( "context" @@ -6,7 +6,7 @@ import ( "sync" "time" - "codeberg.org/eduVPN/eduvpn-common/internal/api/endpoints" + "codeberg.org/eduVPN/eduvpn-common/internal/eduvpnapi/endpoints" ) // EndpointCache is a struct that caches well-known API endpoints diff --git a/internal/api/api.go b/internal/eduvpnapi/eduvpnapi.go index 0d8e03c..62fe0d1 100644 --- a/internal/api/api.go +++ b/internal/eduvpnapi/eduvpnapi.go @@ -1,5 +1,5 @@ -// Package api implements version 3 of the eduVPN api: https://docs.eduvpn.org/server/v3/api.html -package api +// Package eduvpnapi implements version 3 of the eduVPN api: https://docs.eduvpn.org/server/v3/api.html +package eduvpnapi import ( "context" @@ -14,9 +14,9 @@ import ( "codeberg.org/jwijenbergh/eduoauth-go/v2" "golang.zx2c4.com/wireguard/wgctrl/wgtypes" - "codeberg.org/eduVPN/eduvpn-common/internal/api/endpoints" - "codeberg.org/eduVPN/eduvpn-common/internal/api/profiles" - httpw "codeberg.org/eduVPN/eduvpn-common/internal/http" + "codeberg.org/eduVPN/eduvpn-common/internal/eduvpnapi/endpoints" + "codeberg.org/eduVPN/eduvpn-common/internal/eduvpnapi/profiles" + "codeberg.org/eduVPN/eduvpn-common/internal/httpwrap" "codeberg.org/eduVPN/eduvpn-common/internal/wireguard" "codeberg.org/eduVPN/eduvpn-common/types/protocol" "codeberg.org/eduVPN/eduvpn-common/types/server" @@ -52,10 +52,10 @@ type ServerData struct { } // Transport returns the transport to be used for the server -// By default it uses the transport from internal/http DefaultTransport +// By default it uses the transport from internal/httpwrap DefaultTransport func (s *ServerData) Transport() http.RoundTripper { if s.transport == nil { - return httpw.DefaultTransport + return httpwrap.DefaultTransport } return s.transport } @@ -99,7 +99,7 @@ func NewAPI(ctx context.Context, clientID string, sd ServerData, cb Callbacks, t cb.TokensUpdated(sd.ID, sd.Type, tok) }, Transport: transp, - UserAgent: httpw.UserAgent, + UserAgent: httpwrap.UserAgent, } if tokens != nil { @@ -170,7 +170,7 @@ func (a *API) authorize(ctx context.Context) (err error) { return nil } -func (a *API) authorized(ctx context.Context, method string, endpoint string, opts *httpw.OptionalParams) (http.Header, []byte, error) { +func (a *API) authorized(ctx context.Context, method string, endpoint string, opts *httpwrap.OptionalParams) (http.Header, []byte, error) { ep, err := GetEndpointCache().Get(ctx, a.Data.BaseWK, a.Data.Transport()) if err != nil { return nil, nil, err @@ -178,17 +178,17 @@ func (a *API) authorized(ctx context.Context, method string, endpoint string, op u := ep.API.V3.API + endpoint // TODO: Cache HTTP client? - httpC := httpw.NewClient(a.oauth.NewHTTPClient()) + httpC := httpwrap.NewClient(a.oauth.NewHTTPClient()) return httpC.Do(ctx, method, u, opts) } -func (a *API) authorizedRetry(ctx context.Context, method string, endpoint string, opts *httpw.OptionalParams) (http.Header, []byte, error) { +func (a *API) authorizedRetry(ctx context.Context, method string, endpoint string, opts *httpwrap.OptionalParams) (http.Header, []byte, error) { h, body, err := a.authorized(ctx, method, endpoint, opts) if err == nil { return h, body, nil } - statErr := &httpw.StatusError{} + statErr := &httpwrap.StatusError{} // Only retry authorized if we get an HTTP 401 // TODO: Can the OAuth client handle this instead? if errors.As(err, &statErr) && statErr.Status == 401 { @@ -214,7 +214,7 @@ func (a *API) authorizedRetry(ctx context.Context, method string, endpoint strin // Disconnect disconnects a client from the server by sending a /disconnect API call // This cleans up resources such as WireGuard IP allocation func (a *API) Disconnect(ctx context.Context) error { - _, _, err := a.authorized(ctx, http.MethodPost, "/disconnect", &httpw.OptionalParams{Timeout: 5 * time.Second}) + _, _, err := a.authorized(ctx, http.MethodPost, "/disconnect", &httpwrap.OptionalParams{Timeout: 5 * time.Second}) return err } @@ -308,7 +308,7 @@ func (a *API) Connect(ctx context.Context, prof profiles.Profile, protos []proto uv.Set("prefer_tcp", boolToYesNo(pTCP)) // Construct the parameters - params := &httpw.OptionalParams{Headers: hdrs, Body: uv} + params := &httpwrap.OptionalParams{Headers: hdrs, Body: uv} h, body, err := a.authorizedRetry(ctx, http.MethodPost, "/connect", params) if err != nil { return nil, fmt.Errorf("failed API /connect call: %w", err) @@ -354,11 +354,11 @@ func (a *API) Connect(ctx context.Context, prof profiles.Profile, protos []proto } func getEndpoints(ctx context.Context, url string, tp http.RoundTripper) (*endpoints.Endpoints, error) { - uStr, err := httpw.JoinURLPath(url, "/.well-known/vpn-user-portal") + uStr, err := httpwrap.JoinURLPath(url, "/.well-known/vpn-user-portal") if err != nil { return nil, err } - httpC := httpw.NewClient(nil) + httpC := httpwrap.NewClient(nil) httpC.Client.Transport = tp _, body, err := httpC.Get(ctx, uStr) if err != nil { diff --git a/internal/api/api_test.go b/internal/eduvpnapi/eduvpnapi_test.go index e88e816..23f895b 100644 --- a/internal/api/api_test.go +++ b/internal/eduvpnapi/eduvpnapi_test.go @@ -1,4 +1,4 @@ -package api +package eduvpnapi import ( "context" @@ -15,8 +15,8 @@ import ( "testing" "time" - "codeberg.org/eduVPN/eduvpn-common/internal/api/profiles" - httpw "codeberg.org/eduVPN/eduvpn-common/internal/http" + "codeberg.org/eduVPN/eduvpn-common/internal/eduvpnapi/profiles" + "codeberg.org/eduVPN/eduvpn-common/internal/httpwrap" "codeberg.org/eduVPN/eduvpn-common/internal/test" "codeberg.org/eduVPN/eduvpn-common/types/protocol" "codeberg.org/eduVPN/eduvpn-common/types/server" @@ -254,7 +254,7 @@ func TestAPIInfo(t *testing.T) { Refresh: "validrefresh", ExpiredTimestamp: time.Now().Add(1 * time.Hour), } - statErr := &httpw.StatusError{} + statErr := &httpwrap.StatusError{} cases := []struct { hp test.HandlerPath info *profiles.Info diff --git a/internal/api/endpoints/endpoints.go b/internal/eduvpnapi/endpoints/endpoints.go index c98d2c7..c98d2c7 100644 --- a/internal/api/endpoints/endpoints.go +++ b/internal/eduvpnapi/endpoints/endpoints.go diff --git a/internal/api/profiles/profiles.go b/internal/eduvpnapi/profiles/profiles.go index 77109f1..77109f1 100644 --- a/internal/api/profiles/profiles.go +++ b/internal/eduvpnapi/profiles/profiles.go diff --git a/internal/api/redirect.go b/internal/eduvpnapi/redirect.go index 417edf5..7af31fb 100644 --- a/internal/api/redirect.go +++ b/internal/eduvpnapi/redirect.go @@ -1,4 +1,4 @@ -package api +package eduvpnapi // customRedirects supplies redirect values that should be handled by the app itself // here we hardcode the redirect values that we should use in the OAuth requests diff --git a/internal/http/http.go b/internal/httpwrap/httpwrap.go index 7b9b70d..5fd42c8 100644 --- a/internal/http/http.go +++ b/internal/httpwrap/httpwrap.go @@ -1,5 +1,5 @@ -// Package http defines higher level helpers for the net/http package -package http +// Package httpwrap defines higher level helpers for the net/http package +package httpwrap import ( "context" @@ -14,7 +14,7 @@ import ( "strings" "time" - "codeberg.org/eduVPN/eduvpn-common/internal/version" + "codeberg.org/eduVPN/eduvpn-common/internal/commonver" ) // UserAgent is the user agent that is used for requests @@ -284,5 +284,5 @@ func (e *StatusError) Error() string { // RegisterAgent registers the user agent for client and version func RegisterAgent(client string, verApp string) { - UserAgent = fmt.Sprintf("%s/%s eduvpn-common/%s", client, verApp, version.Version) + UserAgent = fmt.Sprintf("%s/%s eduvpn-common/%s", client, verApp, commonver.Version) } diff --git a/internal/http/http_test.go b/internal/httpwrap/httpwrap_test.go index 8c2ae0f..422ee3f 100644 --- a/internal/http/http_test.go +++ b/internal/httpwrap/httpwrap_test.go @@ -1,4 +1,4 @@ -package http +package httpwrap import ( "testing" diff --git a/internal/log/log.go b/internal/loglevel/loglevel.go index 91eaed8..74dd49f 100644 --- a/internal/log/log.go +++ b/internal/loglevel/loglevel.go @@ -1,5 +1,5 @@ -// Package log implements a basic level based logger -package log +// Package loglevel implements a basic level based logger +package loglevel import ( "fmt" diff --git a/internal/log/rotate.go b/internal/loglevel/rotate.go index 2971f70..bfd8351 100644 --- a/internal/log/rotate.go +++ b/internal/loglevel/rotate.go @@ -1,4 +1,4 @@ -package log +package loglevel import ( "io" diff --git a/internal/log/rotate_test.go b/internal/loglevel/rotate_test.go index 4fa77fd..d836330 100644 --- a/internal/log/rotate_test.go +++ b/internal/loglevel/rotate_test.go @@ -1,4 +1,4 @@ -package log +package loglevel import ( "io" diff --git a/internal/server/custom.go b/internal/server/custom.go index a9a26b9..0837c86 100644 --- a/internal/server/custom.go +++ b/internal/server/custom.go @@ -5,8 +5,8 @@ import ( "log/slog" "time" - "codeberg.org/eduVPN/eduvpn-common/internal/api" "codeberg.org/eduVPN/eduvpn-common/internal/config/v2" + "codeberg.org/eduVPN/eduvpn-common/internal/eduvpnapi" "codeberg.org/eduVPN/eduvpn-common/types/server" "codeberg.org/jwijenbergh/eduoauth-go/v2" ) @@ -16,7 +16,7 @@ import ( // `id` is the identifier of the server, the base URL // `ot` specifies specifies the start time OAuth was already triggered func (s *Servers) AddCustom(ctx context.Context, id string, ot *int64) error { - sd := api.ServerData{ + sd := eduvpnapi.ServerData{ ID: id, Type: server.TypeCustom, BaseWK: id, @@ -40,7 +40,7 @@ func (s *Servers) AddCustom(ctx context.Context, id string, ot *int64) error { } // Authorize by creating the API object - _, err = api.NewAPI(ctx, s.clientID, sd, s.cb, nil) + _, err = eduvpnapi.NewAPI(ctx, s.clientID, sd, s.cb, nil) if err != nil { // authorization has failed, remove the server again rerr := s.config.RemoveServer(id, server.TypeCustom) @@ -58,7 +58,7 @@ func (s *Servers) AddCustom(ctx context.Context, id string, ot *int64) error { // `tok` are the tokens such that we can initialize the API // `disableAuth` is set to True when authorization should not be triggered func (s *Servers) GetCustom(ctx context.Context, id string, tok *eduoauth.Token, disableAuth bool) (*Server, error) { - sd := api.ServerData{ + sd := eduvpnapi.ServerData{ ID: id, Type: server.TypeCustom, BaseWK: id, @@ -71,7 +71,7 @@ func (s *Servers) GetCustom(ctx context.Context, id string, tok *eduoauth.Token, if err != nil { return nil, err } - a, err := api.NewAPI(ctx, s.clientID, sd, s.cb, tok) + a, err := eduvpnapi.NewAPI(ctx, s.clientID, sd, s.cb, tok) if err != nil { return nil, err } diff --git a/internal/server/institute.go b/internal/server/institute.go index c357a4d..9280d1e 100644 --- a/internal/server/institute.go +++ b/internal/server/institute.go @@ -5,9 +5,9 @@ import ( "log/slog" "time" - "codeberg.org/eduVPN/eduvpn-common/internal/api" "codeberg.org/eduVPN/eduvpn-common/internal/config/v2" "codeberg.org/eduVPN/eduvpn-common/internal/discovery" + "codeberg.org/eduVPN/eduvpn-common/internal/eduvpnapi" "codeberg.org/eduVPN/eduvpn-common/types/server" "codeberg.org/jwijenbergh/eduoauth-go/v2" ) @@ -24,7 +24,7 @@ func (s *Servers) AddInstitute(ctx context.Context, disco *discovery.Discovery, return err } - sd := api.ServerData{ + sd := eduvpnapi.ServerData{ ID: dsrv.BaseURL, Type: server.TypeInstituteAccess, BaseWK: dsrv.BaseURL, @@ -49,7 +49,7 @@ func (s *Servers) AddInstitute(ctx context.Context, disco *discovery.Discovery, } // Authorize by creating the API object - _, err = api.NewAPI(ctx, s.clientID, sd, s.cb, nil) + _, err = eduvpnapi.NewAPI(ctx, s.clientID, sd, s.cb, nil) if err != nil { // authorization has failed, remove the server again rerr := s.config.RemoveServer(dsrv.BaseURL, server.TypeInstituteAccess) @@ -79,7 +79,7 @@ func (s *Servers) GetInstitute(ctx context.Context, id string, disco *discovery. if err != nil { return nil, err } - sd := api.ServerData{ + sd := eduvpnapi.ServerData{ ID: dsrv.BaseURL, Type: server.TypeInstituteAccess, BaseWK: dsrv.BaseURL, @@ -87,7 +87,7 @@ func (s *Servers) GetInstitute(ctx context.Context, id string, disco *discovery. DisableAuthorize: disableAuth, } // Authorize by creating the API object - a, err := api.NewAPI(ctx, s.clientID, sd, s.cb, tok) + a, err := eduvpnapi.NewAPI(ctx, s.clientID, sd, s.cb, tok) if err != nil { return nil, err } diff --git a/internal/server/secureinternet.go b/internal/server/secureinternet.go index d25750f..e97efbd 100644 --- a/internal/server/secureinternet.go +++ b/internal/server/secureinternet.go @@ -8,9 +8,9 @@ import ( "strings" "time" - "codeberg.org/eduVPN/eduvpn-common/internal/api" "codeberg.org/eduVPN/eduvpn-common/internal/config/v2" "codeberg.org/eduVPN/eduvpn-common/internal/discovery" + "codeberg.org/eduVPN/eduvpn-common/internal/eduvpnapi" "codeberg.org/eduVPN/eduvpn-common/types/server" "codeberg.org/jwijenbergh/eduoauth-go/v2" ) @@ -54,7 +54,7 @@ func (s *Servers) AddSecure(ctx context.Context, disco *discovery.Discovery, org return err } - sd := api.ServerData{ + sd := eduvpnapi.ServerData{ ID: dorg.OrgID, Type: server.TypeSecureInternet, BaseWK: dsrv.BaseURL, @@ -92,7 +92,7 @@ func (s *Servers) AddSecure(ctx context.Context, disco *discovery.Discovery, org } // Authorize by creating the API object - _, err = api.NewAPI(ctx, s.clientID, sd, s.cb, nil) + _, err = eduvpnapi.NewAPI(ctx, s.clientID, sd, s.cb, nil) if err != nil { // authorization has failed, remove the server again rerr := s.config.RemoveServer(orgID, server.TypeSecureInternet) @@ -126,7 +126,7 @@ func (s *Servers) GetSecure(ctx context.Context, orgID string, disco *discovery. return nil, err } - sd := api.ServerData{ + sd := eduvpnapi.ServerData{ ID: dorg.OrgID, Type: server.TypeSecureInternet, BaseWK: dloc.BaseURL, @@ -148,7 +148,7 @@ func (s *Servers) GetSecure(ctx context.Context, orgID string, disco *discovery. DisableAuthorize: disableAuth, } - a, err := api.NewAPI(ctx, s.clientID, sd, s.cb, tok) + a, err := eduvpnapi.NewAPI(ctx, s.clientID, sd, s.cb, tok) if err != nil { return nil, err } diff --git a/internal/server/server.go b/internal/server/server.go index 2372494..4623224 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -7,9 +7,9 @@ import ( "os" "time" - "codeberg.org/eduVPN/eduvpn-common/internal/api" - "codeberg.org/eduVPN/eduvpn-common/internal/api/profiles" v2 "codeberg.org/eduVPN/eduvpn-common/internal/config/v2" + "codeberg.org/eduVPN/eduvpn-common/internal/eduvpnapi" + "codeberg.org/eduVPN/eduvpn-common/internal/eduvpnapi/profiles" "codeberg.org/eduVPN/eduvpn-common/types/protocol" srvtypes "codeberg.org/eduVPN/eduvpn-common/types/server" ) @@ -18,7 +18,7 @@ import ( type Server struct { identifier string t srvtypes.Type - apiw *api.API + apiw *eduvpnapi.API storage *v2.V2 } @@ -26,7 +26,7 @@ type Server struct { var ErrInvalidProfile = errors.New("invalid profile") // NewServer creates a new server -func (s *Servers) NewServer(identifier string, t srvtypes.Type, api *api.API) Server { +func (s *Servers) NewServer(identifier string, t srvtypes.Type, api *eduvpnapi.API) Server { return Server{ identifier: identifier, t: t, @@ -65,7 +65,7 @@ func (s *Server) FreshProfiles(ctx context.Context) (*profiles.Info, error) { return prfs, nil } -func (s *Server) api() (*api.API, error) { +func (s *Server) api() (*eduvpnapi.API, error) { if s.apiw == nil { return nil, errors.New("no API object found") } diff --git a/internal/server/servers.go b/internal/server/servers.go index bd22ffd..43716a4 100644 --- a/internal/server/servers.go +++ b/internal/server/servers.go @@ -5,9 +5,9 @@ import ( "errors" "fmt" - "codeberg.org/eduVPN/eduvpn-common/internal/api" "codeberg.org/eduVPN/eduvpn-common/internal/config/v2" "codeberg.org/eduVPN/eduvpn-common/internal/discovery" + "codeberg.org/eduVPN/eduvpn-common/internal/eduvpnapi" srvtypes "codeberg.org/eduVPN/eduvpn-common/types/server" "codeberg.org/jwijenbergh/eduoauth-go/v2" ) @@ -15,7 +15,7 @@ import ( // Callbacks defines the interface for doing certain callback operations type Callbacks interface { // api.Callbacks is the API callback interface - api.Callbacks + eduvpnapi.Callbacks // GettingConfig is called when the config is obtained GettingConfig() error // InvalidProfile is called when an invalid profile is found diff --git a/internal/test/server.go b/internal/test/server.go index 2596f29..82dd2f7 100644 --- a/internal/test/server.go +++ b/internal/test/server.go @@ -8,7 +8,7 @@ import ( "net/http" "net/http/httptest" - httpw "codeberg.org/eduVPN/eduvpn-common/internal/http" + "codeberg.org/eduVPN/eduvpn-common/internal/httpwrap" ) // Server wraps a HTTP test server @@ -71,7 +71,7 @@ func NewServerWithHandles(hps []HandlerPath, listener net.Listener) *Server { } // Client returns a test client that trusts the HTTPS certificates -func (srv *Server) Client() (*httpw.Client, error) { +func (srv *Server) Client() (*httpwrap.Client, error) { // Get the certs from the test server certs := x509.NewCertPool() for _, c := range srv.TLS.Certificates { @@ -91,6 +91,6 @@ func (srv *Server) Client() (*httpw.Client, error) { }, } // Override the client such that it only trusts the test server cert - httpC := httpw.NewClient(client) + httpC := httpwrap.NewClient(client) return httpC, nil } |
