summaryrefslogtreecommitdiff
path: root/state.go
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-07-22 17:16:13 +0200
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-07-22 17:16:13 +0200
commit0c6233ab691973859b6d636e6d9fdddd2a6acd5e (patch)
treec11697eb3b00ff1d6a073a5f3c6de3337cf5e463 /state.go
parent80218da58eca9c95870770f88e477891e8fdb50a (diff)
State + Exports: Implement should show renew button boolean
Diffstat (limited to 'state.go')
-rw-r--r--state.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/state.go b/state.go
index d559c88..be32c15 100644
--- a/state.go
+++ b/state.go
@@ -388,6 +388,21 @@ func (state *VPNState) SetDisconnected() error {
return nil
}
+func (state *VPNState) ShouldRenewButton() bool {
+ if !state.FSM.InState(fsm.CONNECTED) {
+ return false
+ }
+
+ currentServer, currentServerErr := state.Servers.GetCurrentServer()
+
+ if currentServerErr != nil {
+ state.Logger.Log(log.LOG_INFO, fmt.Sprintf("No server found to renew with err: %s", GetErrorTraceback(currentServerErr)))
+ return false
+ }
+
+ return server.ShouldRenewButton(currentServer)
+}
+
func GetErrorCause(err error) error {
return types.GetErrorCause(err)
}