Add android separates the core process
Support core status check and force restart Optimize proxies page and access page Update flutter and pub dependencies Update go version Optimize more details
This commit is contained in:
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
type Action struct {
|
||||
@@ -11,11 +12,11 @@ type Action struct {
|
||||
}
|
||||
|
||||
type ActionResult struct {
|
||||
Id string `json:"id"`
|
||||
Method Method `json:"method"`
|
||||
Data interface{} `json:"data"`
|
||||
Code int `json:"code"`
|
||||
Port int64
|
||||
Id string `json:"id"`
|
||||
Method Method `json:"method"`
|
||||
Data interface{} `json:"data"`
|
||||
Code int `json:"code"`
|
||||
callback unsafe.Pointer
|
||||
}
|
||||
|
||||
func (result ActionResult) Json() ([]byte, error) {
|
||||
@@ -45,7 +46,7 @@ func handleAction(action *Action, result ActionResult) {
|
||||
result.success(handleGetIsInit())
|
||||
return
|
||||
case forceGcMethod:
|
||||
handleForceGc()
|
||||
handleForceGC()
|
||||
result.success(true)
|
||||
return
|
||||
case shutdownMethod:
|
||||
@@ -73,10 +74,12 @@ func handleAction(action *Action, result ActionResult) {
|
||||
})
|
||||
return
|
||||
case getTrafficMethod:
|
||||
result.success(handleGetTraffic())
|
||||
data := action.Data.(bool)
|
||||
result.success(handleGetTraffic(data))
|
||||
return
|
||||
case getTotalTrafficMethod:
|
||||
result.success(handleGetTotalTraffic())
|
||||
data := action.Data.(bool)
|
||||
result.success(handleGetTotalTraffic(data))
|
||||
return
|
||||
case resetTrafficMethod:
|
||||
handleResetTraffic()
|
||||
@@ -175,13 +178,13 @@ func handleAction(action *Action, result ActionResult) {
|
||||
result.success(value)
|
||||
})
|
||||
return
|
||||
case setStateMethod:
|
||||
data := action.Data.(string)
|
||||
handleSetState(data)
|
||||
result.success(true)
|
||||
case crashMethod:
|
||||
result.success(true)
|
||||
handleCrash()
|
||||
case deleteFile:
|
||||
path := action.Data.(string)
|
||||
handleDelFile(path, result)
|
||||
return
|
||||
default:
|
||||
nextHandle(action, result)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user