add ned test

This commit is contained in:
Dan Ballard 2017-08-20 13:42:55 -07:00
parent 6f1f8ca7f7
commit 180c3d189d
1 changed files with 12 additions and 1 deletions

View File

@ -4,6 +4,8 @@ import (
"github.com/s-rah/go-ricochet/application" "github.com/s-rah/go-ricochet/application"
"github.com/s-rah/go-ricochet/utils" "github.com/s-rah/go-ricochet/utils"
"log" "log"
// "time"
"net/http"
"time" "time"
) )
@ -15,6 +17,14 @@ func GeneratePrivateKey() (string, error) {
return utils.PrivateKeyToString(privateKey), nil return utils.PrivateKeyToString(privateKey), nil
} }
func TestNet() (ok bool, ex error) {
_, err := http.Get("http://golang.org/")
if err != nil {
return false, err
}
return true, nil
}
func EchoBot(privateKeyData string) { func EchoBot(privateKeyData string) {
privateKey, err := utils.ParsePrivateKey([]byte(privateKeyData)) privateKey, err := utils.ParsePrivateKey([]byte(privateKeyData))
@ -24,6 +34,7 @@ func EchoBot(privateKeyData string) {
echobot := new(application.RicochetApplication) echobot := new(application.RicochetApplication)
log.Println("SetupOnion()...")
l, err := application.SetupOnion("127.0.0.1:9051", "tcp4","", privateKey, 9878) l, err := application.SetupOnion("127.0.0.1:9051", "tcp4","", privateKey, 9878)
//l, err := application.SetupOnion("/data/data/org.torproject.android/app_bin/control.txt", "unix","", privateKey, 9878) //l, err := application.SetupOnion("/data/data/org.torproject.android/app_bin/control.txt", "unix","", privateKey, 9878)