summaryrefslogtreecommitdiff
path: root/types/server/server.go
blob: cdc1610176d0dba29e5937e5620875bc26d84465 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package server

import "github.com/eduvpn/eduvpn-common/types/protocol"

type Type int8

const (
	TypeUnknown Type = iota
	TypeInstituteAccess
	TypeSecureInternet
	TypeCustom
)

type Expiry struct {
	StartTime         int64   `json:"start_time"`
	EndTime           int64   `json:"end_time"`
	ButtonTime        int64   `json:"button_time"`
	CountdownTime     int64   `json:"countdown_time"`
	NotificationTimes []int64 `json:"notification_times"`
}

type Profile struct {
	DisplayName map[string]string   `json:"display_name,omitempty"`
	Protocols   []protocol.Protocol `json:"supported_protocols"`
}

type Profiles struct {
	Map     map[string]Profile `json:"map,omitempty"`
	Current string             `json:"current"`
}

type Tokens struct {
	Access  string `json:"access_token"`
	Refresh string `json:"refresh_token"`
	Expires int64  `json:"expires_in"`
}

type Server struct {
	DisplayName map[string]string `json:"display_name,omitempty"`
	Identifier  string            `json:"identifier"`
	Profiles    Profiles          `json:"profiles"`
}

type Institute struct {
	Server
	Delisted bool `json:"delisted"`
}

type SecureInternet struct {
	Server
	CountryCode string `json:"country_code"`
	Delisted    bool   `json:"delisted"`
}

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 {
	VPNConfig      string            `json:"config"`
	Protocol       protocol.Protocol `json:"protocol"`
	DefaultGateway bool              `json:"default_gateway"`
	Tokens         Tokens            `json:"tokens"`
}

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"`
}