diff options
| author | Jeroen Wijenbergh <jeroenwijenbergh@protonmail.com> | 2022-04-19 15:02:45 +0200 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-04-19 15:02:45 +0200 |
| commit | 723ecacc8528be0e96db42392f1781ddf5894bea (patch) | |
| tree | 1debf1d6d0c50adb32939db3cc84e5130d1fb818 /src/state.go | |
| parent | 5f40a8d10a17182f744cb7ac11087d170dd49560 (diff) | |
Profiles: Implement basic functionality for sending a profile_id
Diffstat (limited to 'src/state.go')
| -rw-r--r-- | src/state.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/state.go b/src/state.go index 1eb8ebd..95bb75c 100644 --- a/src/state.go +++ b/src/state.go @@ -8,7 +8,8 @@ type VPNState struct { // Info passed by the client ConfigDirectory string `json:"-"` Name string `json:"-"` - StateCallback func(string, string, string) `json:"-"` + StateCallback func(string, string, string) string `json:"-"` + StateCallbackData string `json:"-"` // The chosen server Server *Server `json:"server"` @@ -26,7 +27,7 @@ type VPNState struct { Debug bool `json:"-"` } -func (state *VPNState) Register(name string, directory string, stateCallback func(string, string, string), debug bool) error { +func (state *VPNState) Register(name string, directory string, stateCallback func(string, string, string) string, debug bool) error { state.InitializeFSM() if !state.InState(DEREGISTERED) { return errors.New("app already registered") @@ -71,7 +72,7 @@ func (state *VPNState) Deregister() error { } func (state *VPNState) Connect(url string) (string, error) { - if state.Server == nil { + if state.Server == nil || state.Server.BaseURL != url { state.Server = &Server{} } initializeErr := state.Server.Initialize(url) |
