diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-07-07 15:41:16 +0200 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-07-07 15:41:16 +0200 |
| commit | 7d67ce7f6a15970677b7d0b8f4912fe379862515 (patch) | |
| tree | 62df25f68432308c048ffd8029bbe896f5fa4845 /internal | |
| parent | 1865b016d0cca74cd3703db5a3b4217917988dec (diff) | |
Format: Run gofumpt
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/discovery/discovery.go | 6 | ||||
| -rw-r--r-- | internal/server/server.go | 25 | ||||
| -rw-r--r-- | internal/types/server.go | 29 | ||||
| -rw-r--r-- | internal/util/util.go | 3 |
4 files changed, 29 insertions, 34 deletions
diff --git a/internal/discovery/discovery.go b/internal/discovery/discovery.go index c61469d..2331491 100644 --- a/internal/discovery/discovery.go +++ b/internal/discovery/discovery.go @@ -70,7 +70,7 @@ func (discovery *Discovery) Init(fsm *fsm.FSM, logger *log.FileLogger) { // - [TODO] when the user tries to add new server AND the user did NOT yet choose an organization before; // - [TODO] when the authorization for the server associated with an already chosen organization is triggered, e.g. after expiry or revocation. func (discovery *Discovery) DetermineOrganizationsUpdate() bool { - return discovery.Organizations.Timestamp == 0 + return discovery.Organizations.Timestamp == 0 } func (discovery *Discovery) GetSecureLocationList() []string { @@ -189,7 +189,7 @@ func (e GetOrgByIDNotFoundError) Error() string { } type GetServerByURLNotFoundError struct { - URL string + URL string Type string } @@ -199,7 +199,7 @@ func (e GetServerByURLNotFoundError) Error() string { type GetServerByCountryCodeNotFoundError struct { CountryCode string - Type string + Type string } func (e GetServerByCountryCodeNotFoundError) Error() string { diff --git a/internal/server/server.go b/internal/server/server.go index 5bc2ea1..719d8c8 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -36,8 +36,8 @@ type InstituteAccessServer struct { // A secure internet server which has its own OAuth tokens // It specifies the current location url it is connected to type SecureInternetHomeServer struct { - DisplayName string `json:"display_name"` - OAuth oauth.OAuth `json:"oauth"` + DisplayName string `json:"display_name"` + OAuth oauth.OAuth `json:"oauth"` // The home server has a list of info for each configured server location BaseMap map[string]*ServerBase `json:"base_map"` @@ -45,7 +45,7 @@ type SecureInternetHomeServer struct { // We have the authorization URL template, the home organization ID and the current location AuthorizationTemplate string `json:"authorization_template"` HomeOrganizationID string `json:"home_organization_id"` - CurrentLocation string `json:"current_location"` + CurrentLocation string `json:"current_location"` } type InstituteServers struct { @@ -107,17 +107,16 @@ func (secure *SecureInternetHomeServer) GetOAuth() *oauth.OAuth { return &secure.OAuth } - -func (institute *InstituteAccessServer) GetTemplateAuth() (func(string) string) { - return func(authURL string) string { - return authURL - } +func (institute *InstituteAccessServer) GetTemplateAuth() func(string) string { + return func(authURL string) string { + return authURL + } } -func (secure *SecureInternetHomeServer) GetTemplateAuth() (func(string) string) { - return func(authURL string) string { - return util.ReplaceWAYF(secure.AuthorizationTemplate, authURL, secure.HomeOrganizationID) - } +func (secure *SecureInternetHomeServer) GetTemplateAuth() func(string) string { + return func(authURL string) string { + return util.ReplaceWAYF(secure.AuthorizationTemplate, authURL, secure.HomeOrganizationID) + } } func (institute *InstituteAccessServer) GetBase() (*ServerBase, error) { @@ -186,7 +185,6 @@ func (secure *SecureInternetHomeServer) addLocation(locationServer *types.Discov return base, nil } - // Initializes the home server and adds its own location func (secure *SecureInternetHomeServer) init(homeOrg *types.DiscoveryOrganization, homeLocation *types.DiscoveryServer, fsm *fsm.FSM, logger *log.FileLogger) error { errorMessage := "failed initializing secure internet home server" @@ -195,7 +193,6 @@ func (secure *SecureInternetHomeServer) init(homeOrg *types.DiscoveryOrganizatio // New home organisation, clear everything *secure = *&SecureInternetHomeServer{} } - base, baseErr := secure.addLocation(homeLocation, fsm, logger) diff --git a/internal/types/server.go b/internal/types/server.go index ba9b217..31a7bcc 100644 --- a/internal/types/server.go +++ b/internal/types/server.go @@ -5,10 +5,10 @@ package types // Structs that define the json format for // url: "https://disco.eduvpn.org/v2/organization_list.json" type DiscoveryOrganizations struct { - Version uint64 `json:"v"` - List []DiscoveryOrganization `json:"organization_list"` - Timestamp int64 `json:"-"` - RawString string `json:"-"` + Version uint64 `json:"v"` + List []DiscoveryOrganization `json:"organization_list"` + Timestamp int64 `json:"-"` + RawString string `json:"-"` } type DiscoveryOrganization struct { @@ -25,18 +25,17 @@ type DiscoveryOrganization struct { // Structs that define the json format for // url: "https://disco.eduvpn.org/v2/server_list.json" type DiscoveryServers struct { - Version uint64 `json:"v"` - List []DiscoveryServer `json:"server_list"` - Timestamp int64 `json:"-"` - RawString string `json:"-"` + Version uint64 `json:"v"` + List []DiscoveryServer `json:"server_list"` + Timestamp int64 `json:"-"` + RawString string `json:"-"` } type DiscoveryServer struct { - AuthenticationURLTemplate string `json:"authentication_url_template"` - BaseURL string `json:"base_url"` - CountryCode string `json:"country_code"` - PublicKeyList []string `json:"public_key_list"` - Type string `json:"server_type"` - SupportContact []string `json:"support_contact"` + AuthenticationURLTemplate string `json:"authentication_url_template"` + BaseURL string `json:"base_url"` + CountryCode string `json:"country_code"` + PublicKeyList []string `json:"public_key_list"` + Type string `json:"server_type"` + SupportContact []string `json:"support_contact"` } - diff --git a/internal/util/util.go b/internal/util/util.go index 30767c3..f77d34c 100644 --- a/internal/util/util.go +++ b/internal/util/util.go @@ -3,12 +3,11 @@ package util import ( "crypto/rand" "fmt" + "net/url" "os" "strings" "time" - "net/url" - "github.com/jwijenbergh/eduvpn-common/internal/types" ) |
