summaryrefslogtreecommitdiff
path: root/state.go
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-06-21 16:52:55 +0200
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-06-21 16:52:55 +0200
commitb4d744a80aa79d45f8a46119920abc1279ad4f20 (patch)
treec308df90904cdaf1657bd1480f6104ecfbbc2063 /state.go
parentf6c074f4fb99fa29927d3b62dd10457bd659f3ed (diff)
State: Add functions for getting/setting a connection identifier
e.g. the uuid of the connection in case of NetworkManager on Linux
Diffstat (limited to 'state.go')
-rw-r--r--state.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/state.go b/state.go
index 9187b54..f71d583 100644
--- a/state.go
+++ b/state.go
@@ -27,6 +27,9 @@ type VPNState struct {
// Whether to enable debugging
Debug bool `json:"-"`
+
+ // Serialized connection identifier
+ Identifier string `json:"identifier"`
}
func (state *VPNState) Register(name string, directory string, stateCallback func(string, string, string), debug bool) error {
@@ -194,6 +197,14 @@ func (state *VPNState) SetProfileID(profileID string) error {
return nil
}
+func (state *VPNState) GetIdentifier() string {
+ return state.Identifier
+}
+
+func (state *VPNState) SetIdentifier(identifier string) {
+ state.Identifier = identifier
+}
+
func (state *VPNState) SetConnected() error {
if !state.FSM.HasTransition(fsm.CONNECTED) {
return fsm.WrongStateTransitionError{Got: state.FSM.Current, Want: fsm.CONNECTED}.CustomError()