mirror of
https://github.com/ehang-io/nps.git
synced 2025-07-02 04:00:42 +00:00
add sdk file
This commit is contained in:
parent
fe11bf9398
commit
5a85e47646
33
cmd/npc/sdk.go
Normal file
33
cmd/npc/sdk.go
Normal file
@ -0,0 +1,33 @@
|
||||
package main
|
||||
|
||||
import "C"
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/cnlh/nps/client"
|
||||
"time"
|
||||
)
|
||||
|
||||
//export PrintBye
|
||||
func PrintBye() {
|
||||
fmt.Println("From DLL: Bye!")
|
||||
}
|
||||
|
||||
var status bool
|
||||
|
||||
//export Sum
|
||||
func StartClientByVerifyKey(a int, b int) bool {
|
||||
c := client.NewRPClient(*serverAddr, *verifyKey, *connType, *proxyUrl, nil)
|
||||
go func() {
|
||||
for {
|
||||
status = true
|
||||
c.Start()
|
||||
status = false
|
||||
time.Sleep(time.Second * 5)
|
||||
}
|
||||
}()
|
||||
return true
|
||||
}
|
||||
|
||||
func main() {
|
||||
// Need a main function to make CGO compile package as C shared library
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user