summaryrefslogtreecommitdiff
path: root/types
diff options
context:
space:
mode:
Diffstat (limited to 'types')
-rw-r--r--types/server/server.go (renamed from types/types.go)54
1 files changed, 24 insertions, 30 deletions
diff --git a/types/types.go b/types/server/server.go
index bb04fdd..db2dd8b 100644
--- a/types/types.go
+++ b/types/server/server.go
@@ -1,8 +1,14 @@
-// package types lists the various public types that are returned to clients
-package types
+package server
-import (
- "github.com/eduvpn/eduvpn-common/types/protocol"
+import "github.com/eduvpn/eduvpn-common/types/protocol"
+
+type Type int8
+
+const (
+ TypeUnknown Type = iota
+ TypeInstituteAccess
+ TypeSecureInternet
+ TypeCustom
)
type Expiry struct {
@@ -30,27 +36,27 @@ type Tokens struct {
Expires int64 `json:"expires_in"`
}
-type GenericServer struct {
+type Server struct {
DisplayName map[string]string `json:"display_name,omitempty"`
Identifier string `json:"identifier"`
Profiles Profiles `json:"profiles"`
}
-type InstituteServer struct {
- GenericServer
+type Institute struct {
+ Server
Delisted bool `json:"delisted"`
}
-type SecureInternetServer struct {
- GenericServer
+type SecureInternet struct {
+ Server
CountryCode string `json:"country_code"`
Delisted bool `json:"delisted"`
}
-type ServerList struct {
- Institutes []InstituteServer `json:"institute_access_servers,omitempty"`
- SecureInternet *SecureInternetServer `json:"secure_internet_server,omitempty"`
- Custom []GenericServer `json:"custom_servers,omitempty"`
+type List struct {
+ Institutes []Institute `json:"institute_access_servers,omitempty"`
+ SecureInternet *SecureInternet `json:"secure_internet_server,omitempty"`
+ Custom []Server `json:"custom_servers,omitempty"`
}
type Configuration struct {
@@ -60,21 +66,9 @@ type Configuration struct {
Tokens Tokens `json:"tokens"`
}
-type ServerType int8
-
-const (
- SERVER_UNKNOWN ServerType = iota
-
- SERVER_INSTITUTE_ACCESS
-
- SERVER_SECURE_INTERNET
-
- SERVER_CUSTOM
-)
-
-type CurrentServer struct {
- Institute *InstituteServer `json:"institute_access_server,omitempty"`
- SecureInternet *SecureInternetServer `json:"secure_internet_server,omitempty"`
- Custom *GenericServer `json:"custom_server,omitempty"`
- Type ServerType `json:"server_type"`
+type Current struct {
+ Institute *Institute `json:"institute_access_server,omitempty"`
+ SecureInternet *SecureInternet `json:"secure_internet_server,omitempty"`
+ Custom *Server `json:"custom_server,omitempty"`
+ Type Type `json:"server_type"`
}