diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-03-29 15:55:45 +0200 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-03-29 15:55:45 +0200 |
| commit | f588641f09d5e3b774a3597ebbe80b92879dd655 (patch) | |
| tree | 05b8bda7d64761e178a85d5dd0cb27b0e86f7311 /src | |
| parent | 85862b19ea13090d763f31054c3d8244c220704d (diff) | |
State: Add a deregister method for cleanup
Diffstat (limited to 'src')
| -rw-r--r-- | src/state.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/state.go b/src/state.go index c146e61..a48d13d 100644 --- a/src/state.go +++ b/src/state.go @@ -36,6 +36,14 @@ func (state *VPNState) Register(name string, directory string, stateCallback fun return nil } +func (state *VPNState) Deregister() { + // Close the log file + state.CloseLog() + + // Re-initialize everything + state = &VPNState{} +} + func (state *VPNState) Connect(url string) (string, error) { if state.Server == nil { state.Server = &Server{} |
