3 Commits

Author SHA1 Message Date
idk
acc8d4e0f5 Fix that module 2020-04-03 19:43:24 -04:00
idk
750ce7e6d8 Add i2prouter start function 2020-04-03 17:33:08 -04:00
idk
643d7991fd Add i2prouter start function 2020-04-03 17:30:48 -04:00
3 changed files with 22 additions and 1 deletions

View File

@ -2,7 +2,7 @@
GO111MODULE=on
VERSION=0.0.07
VERSION=0.0.09
USER_GH=eyedeekay
version:

View File

@ -6,6 +6,7 @@ import (
"io/ioutil"
"log"
"os"
"os/exec"
"os/user"
"runtime"
"strings"
@ -198,3 +199,23 @@ func FindI2PIsInstalledDefaultLocation() (string, error) {
}
return "", fmt.Errorf("i2p router not found.")
}
func ConditionallyLaunchI2P() (bool, error) {
ok, err := CheckI2PIsInstalledDefaultLocation()
if err != nil {
return false, err
}
if ok {
path, err := FindI2PIsInstalledDefaultLocation()
if err != nil {
return false, err
}
cmd := exec.Command(path, "start")
if err := cmd.Start(); err != nil {
return false, fmt.Errorf("I2P router startup failure", err)
}
return true, nil
} else {
return false, fmt.Errorf("I2P is not a default location, please set $I2P environment variable")
}
}

Binary file not shown.