From b4d744a80aa79d45f8a46119920abc1279ad4f20 Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Tue, 21 Jun 2022 16:52:55 +0200 Subject: State: Add functions for getting/setting a connection identifier e.g. the uuid of the connection in case of NetworkManager on Linux --- state.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'state.go') 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() -- cgit v1.2.3