summaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorkali kaneko (leap communications) <kali@leap.se>2020-06-11 19:50:29 +0200
committerkali kaneko (leap communications) <kali@leap.se>2020-06-12 20:02:59 +0200
commitec69182ccf6a16e9c7470b4a2a42d086367c09ec (patch)
tree52d682a39816238ae712bc698474d1d90e0dfdda /gui
parent7f53bdb6f43a218c0d16a271053ecaee6e09d362 (diff)
[refactor] out with actions
Signed-off-by: kali kaneko (leap communications) <kali@leap.se>
Diffstat (limited to 'gui')
-rw-r--r--gui/backend.go37
1 files changed, 3 insertions, 34 deletions
diff --git a/gui/backend.go b/gui/backend.go
index ecff8dc..43f7b67 100644
--- a/gui/backend.go
+++ b/gui/backend.go
@@ -123,45 +123,14 @@ func (s status) fromString(st string) status {
}
}
-// FIXME -----------------------------------------------------------------------
-// at some moment I thought this was a good idea, but probably is overkill -
-// and not used right now. Discuss with meskio in code review, and very likely
-// remove it - there are probably better ways of dealing with tracking of user
-// actions more towards the ui layer.
-
-// An action is originated in the UI. These represent requests coming from the
-// frontend via the C code. VPN code needs to watch them and fullfill their
-// requests as soon as possible.
-type actions int
-
-const (
- switchOn actions = iota
- switchOff
- unblock
-)
-
-func (a actions) String() string {
- return [...]string{"switchOn", "switchOff", "unblock"}[a]
-}
-
-func (a actions) MarshalJSON() ([]byte, error) {
- b := bytes.NewBufferString(`"`)
- b.WriteString(a.String())
- b.WriteString(`"`)
- return b.Bytes(), nil
-}
-
-// -----------------------------------------------------------------------------
-
// The connectionCtx keeps the global state that is passed around to C-land. It
// also serves as the primary way of passing requests from the frontend to the
// Go-core, by letting the UI write some of these variables and processing
// them.
type connectionCtx struct {
- AppName string `json:"appName"`
- Provider string `json:"provider"`
- Status status `json:"status"`
- Actions []actions `json:"actions,omitempty"`
+ AppName string `json:"appName"`
+ Provider string `json:"provider"`
+ Status status `json:"status"`
bm bitmask.Bitmask
}