mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-06 16:40:32 +00:00
feat: bt improve
This commit is contained in:
1 parent
c6aa83194f
commit
0fc133e46d
28 files changed
+1537
-260
No files matched your search
@@ -0,0 +1,30 @@
|
||||
// go build -ldflags="-w -s" -buildmode=c-shared -o bin/libgopeed.dll github.com/monkeyWie/gopeed-core/bind/desktop
|
||||
// go build -ldflags="-w -s" -buildmode=c-shared -o bin/libgopeed.dylib github.com/monkeyWie/gopeed-core/bind/desktop
|
||||
package main
|
||||
|
||||
import "C"
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/monkeyWie/gopeed-core/pkg/rest"
|
||||
"github.com/monkeyWie/gopeed-core/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())
|
||||
}
|
||||
realPort, err := rest.Start(&config)
|
||||
if err != nil {
|
||||
return 0, C.CString(err.Error())
|
||||
}
|
||||
return realPort, nil
|
||||
}
|
||||
|
||||
//export Stop
|
||||
func Stop() {
|
||||
rest.Stop()
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// gomobile bind -ldflags="-w -s" -o libgopeed.aar -target=android -androidapi 19 -javapkg=com.gopeed github.com/monkeyWie/gopeed-core/bind/mobile
|
||||
package libgopeed
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/monkeyWie/gopeed-core/pkg/rest"
|
||||
"github.com/monkeyWie/gopeed-core/pkg/rest/model"
|
||||
)
|
||||
|
||||
func Start(cfg string) (int, error) {
|
||||
var config model.StartConfig
|
||||
if err := json.Unmarshal([]byte(cfg), &config); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return rest.Start(&config)
|
||||
}
|
||||
|
||||
func Stop() {
|
||||
rest.Stop()
|
||||
}
|
||||
Reference in new issue
Block a user