Compare commits
No commits in common. "special" and "master" have entirely different histories.
|
@ -1,18 +1,13 @@
|
||||||
package goRicochetMobile
|
package goRicochetMobile
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/s-rah/go-ricochet/application"
|
||||||
"github.com/s-rah/go-ricochet/utils"
|
"github.com/s-rah/go-ricochet/utils"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"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"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,33 +30,6 @@ 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 ******/
|
||||||
|
@ -74,8 +42,6 @@ func TestNet() (ok bool, ex error) {
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: update EchoBot test
|
|
||||||
/*
|
|
||||||
func EchoBot(privateKeyData string) {
|
func EchoBot(privateKeyData string) {
|
||||||
privateKey, err := utils.ParsePrivateKey([]byte(privateKeyData))
|
privateKey, err := utils.ParsePrivateKey([]byte(privateKeyData))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -97,4 +63,4 @@ func EchoBot(privateKeyData string) {
|
||||||
})
|
})
|
||||||
log.Printf("echobot started on %s", l.Addr().String())
|
log.Printf("echobot started on %s", l.Addr().String())
|
||||||
echobot.Run(l)
|
echobot.Run(l)
|
||||||
}*/
|
}
|
|
@ -1,7 +0,0 @@
|
||||||
package goRicochetMobile
|
|
||||||
|
|
||||||
import "testing"
|
|
||||||
|
|
||||||
func TestStartBackend(t *testing.T) {
|
|
||||||
StartBackend()
|
|
||||||
}
|
|
Loading…
Reference in New Issue