summaryrefslogtreecommitdiff
path: root/internal/config/v1
diff options
context:
space:
mode:
Diffstat (limited to 'internal/config/v1')
-rw-r--r--internal/config/v1/v1.go61
1 files changed, 45 insertions, 16 deletions
diff --git a/internal/config/v1/v1.go b/internal/config/v1/v1.go
index 1e374b1..1d96d13 100644
--- a/internal/config/v1/v1.go
+++ b/internal/config/v1/v1.go
@@ -12,49 +12,78 @@ import (
"github.com/eduvpn/eduvpn-common/types/server"
)
+// Profiles is the list of profiles
type Profiles struct {
profiles.Info
Current string `json:"current_profile"`
}
+// Base is the base type of a server
type Base struct {
- BaseURL string `json:"base_url"`
- Profiles Profiles `json:"profiles"`
- StartTime time.Time `json:"start_time"`
+ // BaseURL is the base_url from discovery
+ BaseURL string `json:"base_url"`
+ // profiles is the last of profile
+ Profiles Profiles `json:"profiles"`
+ // StartTime is the time when we started the connection
+ StartTime time.Time `json:"start_time"`
+ // StartTimeOAuth is the time when we last started OAuth
StartTimeOAuth time.Time `json:"start_time_oauth"`
- ExpireTime time.Time `json:"expire_time"`
+ // ExpireTime is the time when the connection expires
+ ExpireTime time.Time `json:"expire_time"`
}
+// InstituteServer is the struct that represents an institute access server
type InstituteServer struct {
- Base Base `json:"base"`
+ // Base is the base of the server
+ Base Base `json:"base"`
+ // Profiles are the list of profiles
Profiles Profiles `json:"profiles"`
}
+// InstituteServers is a list of institute access servers
type InstituteServers struct {
- Map map[string]InstituteServer `json:"map"`
- CurrentURL string `json:"current_url"`
+ // Map is the map from base url to an institute access server
+ Map map[string]InstituteServer `json:"map"`
+ // CurrentURL is the URL of the currently configured server
+ CurrentURL string `json:"current_url"`
}
type (
- CustomServer = InstituteServer
+ // CustomServer is an alias to InstituteServer
+ CustomServer = InstituteServer
+ // CustomServers is an alias to InstituteServers
CustomServers = InstituteServers
)
+// SecureInternetHome represents a secure internet home server
type SecureInternetHome struct {
- BaseMap map[string]*Base `json:"base_map"`
- DisplayName map[string]string `json:"display_name"`
- HomeOrganizationID string `json:"home_organization_id"`
- CurrentLocation string `json:"current_location"`
+ // BaseMap is the map from country code to a server base
+ BaseMap map[string]*Base `json:"base_map"`
+ // DisplayName is the map from language code to UI name
+ DisplayName map[string]string `json:"display_name"`
+ // HomeOrganizationID is the identifier of the home organization
+ HomeOrganizationID string `json:"home_organization_id"`
+ // CurrentLocation is the country code of the currently configured server
+ CurrentLocation string `json:"current_location"`
}
+// Servers represents the list of servers
type Servers struct {
- Custom CustomServers `json:"custom_servers"`
- Institute InstituteServers `json:"institute_servers"`
+ // Custom are the "custom" servers; the servers that are added by the user
+ Custom CustomServers `json:"custom_servers"`
+ // Institute are the institute access servers configured from discovery
+ Institute InstituteServers `json:"institute_servers"`
+ // SecureInternetHome is the secure internet home server
+ // Also obtained through discovery
SecureInternetHome SecureInternetHome `json:"secure_internet_home"`
- IsType server.Type `json:"is_secure_internet"`
+ // IsType represents which server type was last configured
+ IsType server.Type `json:"is_secure_internet"`
}
+// V1 is the top-level struct for the first version of the state file
type V1 struct {
+ // Discovery is the list of discovery servers
Discovery discovery.Discovery `json:"discovery"`
- Servers Servers `json:"servers"`
+ // Servers is the list of servers in the app
+ Servers Servers `json:"servers"`
}