diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-03-18 13:58:08 +0100 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-04-05 12:26:16 +0200 |
| commit | 2d5c7dad599b3f8b70ab07382973c51d1de2193d (patch) | |
| tree | 3ca48a1104f958f896813a4d70093cdc27429133 /src/state.go | |
| parent | 343836597df3efd6f31a68e29ff82b6ec4979f69 (diff) | |
Refactor: Structures changed and added Token refresh function
Diffstat (limited to 'src/state.go')
| -rw-r--r-- | src/state.go | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/src/state.go b/src/state.go index be85a45..272bbc6 100644 --- a/src/state.go +++ b/src/state.go @@ -1,38 +1,25 @@ package eduvpn -type EduVPNState struct { - // The endpoints - Endpoints *EduVPNEndpoints - +type VPNState struct { // Info passed by the client Name string - Server string - // OAuth - OAuthToken *EduVPNOAuthToken - OAuthSession *EduVPNOAuthSession + // The chosen server + Server *Server } -func Register(state *EduVPNState, name string, server string, stateCallback func(string, string)) error { +func Register(state *VPNState, name string, stateCallback func(string, string)) error { state.Name = name - state.Server = server - - endpoints, err := APIGetEndpoints(state) - - if err != nil { - return err - } - state.Endpoints = endpoints stateCallback("START", "REGISTER") return nil } -var VPNStateInstance *EduVPNState +var VPNStateInstance *VPNState -func GetVPNState() *EduVPNState { +func GetVPNState() *VPNState { if VPNStateInstance == nil { - VPNStateInstance = &EduVPNState{} + VPNStateInstance = &VPNState{} } return VPNStateInstance } |
