Skip to content

Commit

Permalink
Add state "disabled" to TrafPol State D-Bus Property
Browse files Browse the repository at this point in the history
Signed-off-by: hwipl <33433250+hwipl@users.noreply.github.com>
  • Loading branch information
hwipl committed Aug 20, 2024
1 parent ee966af commit 5e4a980
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,11 @@ func (d *Daemon) stopTrafPol() {
d.serverIPAllowed = false

// update trafpol status
d.setStatusTrafPolState(vpnstatus.TrafPolStateInactive)
if d.disableTrafPol {
d.setStatusTrafPolState(vpnstatus.TrafPolStateDisabled)
} else {
d.setStatusTrafPolState(vpnstatus.TrafPolStateInactive)
}
d.setStatusAllowedHosts(nil)
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/vpnstatus/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ const (
TrafPolStateUnknown = iota
TrafPolStateInactive
TrafPolStateActive
TrafPolStateDisabled
)

// String resturns TrafPolState as string.
Expand All @@ -116,6 +117,8 @@ func (t TrafPolState) String() string {
return "inactive"
case TrafPolStateActive:
return "active"
case TrafPolStateDisabled:
return "disabled"
}
return ""
}
Expand Down
1 change: 1 addition & 0 deletions pkg/vpnstatus/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ func TestTrafPolStateString(t *testing.T) {
TrafPolStateUnknown: "unknown",
TrafPolStateInactive: "inactive",
TrafPolStateActive: "active",
TrafPolStateDisabled: "disabled",

// invalid
123456: "",
Expand Down

0 comments on commit 5e4a980

Please sign in to comment.