blob: 58e0a42655a8c8252d6d404daa985c82b6ba1c26 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
/* All the exported functions should be added here */
package backend
import (
"C"
"fmt"
"log"
"unsafe"
"0xacab.org/leap/bitmask-vpn/pkg/bitmask"
"0xacab.org/leap/bitmask-vpn/pkg/pickle"
)
func SwitchOn() {
go setStatus(starting)
go startVPN()
}
func SwitchOff() {
go setStatus(stopping)
go stopVPN()
}
func Unblock() {
//TODO -
fmt.Println("unblock... [not implemented]")
}
func Quit() {
if ctx.Status != off {
go setStatus(stopping)
ctx.cfg.SetUserStoppedVPN(false)
} else {
ctx.cfg.SetUserStoppedVPN(true)
}
closeVPN()
}
func DonateAccepted() {
donateAccepted()
}
func SubscribeToEvent(event string, f unsafe.Pointer) {
subscribe(event, f)
}
func InitializeBitmaskContext() {
p := bitmask.GetConfiguredProvider()
initOnce.Do(func() { initializeContext(p.Provider, p.AppName) })
runDonationReminder()
go ctx.updateStatus()
}
func RefreshContext() *C.char {
c, _ := ctx.toJson()
return C.CString(string(c))
}
func InstallHelpers() {
pickle.InstallHelpers()
}
func MockUIInteraction() {
log.Println("mocking ui interaction on port 8080. \nTry 'curl localhost:8080/{on|off|failed}' to toggle status.")
go mockUI()
}
|