Skip to content
Snippets Groups Projects
Unverified Commit ec69182c authored by Kali Kaneko's avatar Kali Kaneko
Browse files

[refactor] out with actions

parent 7f53bdb6
No related branches found
No related tags found
No related merge requests found
......@@ -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
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment