mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-04 15:49:49 +00:00
31 lines
576 B
Go
31 lines
576 B
Go
package main
|
|
|
|
import "C"
|
|
import (
|
|
"encoding/json"
|
|
"github.com/GopeedLab/gopeed/pkg/rest"
|
|
"github.com/GopeedLab/gopeed/pkg/rest/model"
|
|
)
|
|
|
|
func main() {}
|
|
|
|
//export Start
|
|
func Start(cfg *C.char) (int, *C.char) {
|
|
var config model.StartConfig
|
|
if err := json.Unmarshal([]byte(C.GoString(cfg)), &config); err != nil {
|
|
return 0, C.CString(err.Error())
|
|
}
|
|
config.ProductionMode = true
|
|
applyWebViewProvider(&config)
|
|
realPort, err := rest.Start(&config)
|
|
if err != nil {
|
|
return 0, C.CString(err.Error())
|
|
}
|
|
return realPort, nil
|
|
}
|
|
|
|
//export Stop
|
|
func Stop() {
|
|
rest.Stop()
|
|
}
|