From 2d5c7dad599b3f8b70ab07382973c51d1de2193d Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Fri, 18 Mar 2022 13:58:08 +0100 Subject: Refactor: Structures changed and added Token refresh function --- src/state.go | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) (limited to 'src/state.go') 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 } -- cgit v1.2.3