start trying to call ricochet-go
This commit is contained in:
parent
d8d5db80b1
commit
4567e4199c
|
@ -8,6 +8,13 @@ import (
|
||||||
"time"
|
"time"
|
||||||
"github.com/yawning/bulb/utils/pkcs1"
|
"github.com/yawning/bulb/utils/pkcs1"
|
||||||
"crypto/rsa"
|
"crypto/rsa"
|
||||||
|
"github.com/ricochet-im/ricochet-go/core/config"
|
||||||
|
"os"
|
||||||
|
ricochet "github.com/ricochet-im/ricochet-go/core"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
CONFIG_PATH string = "identity.json"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,6 +37,33 @@ func GetOnionAddress(privateKey string) string {
|
||||||
return addr
|
return addr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*************** ricochet-go *****************/
|
||||||
|
|
||||||
|
// https://stackoverflow.com/questions/33815541/golang-gomobile-app-cannot-generate-files
|
||||||
|
// Writing and reading from files should apparently work if
|
||||||
|
// <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
// is in the manifest and gomobile build is using hte manifest
|
||||||
|
|
||||||
|
func StartBackend() error {
|
||||||
|
cfg, err := config.LoadConfigFile(CONFIG_PATH)
|
||||||
|
if err != nil && os.IsNotExist(err) {
|
||||||
|
cfg, err = config.NewConfigFile(CONFIG_PATH)
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
log.Println(cfg)
|
||||||
|
|
||||||
|
core := new(ricochet.Ricochet)
|
||||||
|
if err := core.Init(cfg); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Println("tor address: ", core.Config.Read().Identity)
|
||||||
|
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/******** Testing by standing up an echobot ******/
|
/******** Testing by standing up an echobot ******/
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
package goRicochetMobile
|
||||||
|
|
||||||
|
import "testing"
|
||||||
|
|
||||||
|
func TestStartBackend(t *testing.T) {
|
||||||
|
StartBackend()
|
||||||
|
}
|
Loading…
Reference in New Issue