Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
acc8d4e0f5 | |||
750ce7e6d8 | |||
643d7991fd |
2
Makefile
2
Makefile
@ -2,7 +2,7 @@
|
||||
|
||||
GO111MODULE=on
|
||||
|
||||
VERSION=0.0.07
|
||||
VERSION=0.0.09
|
||||
USER_GH=eyedeekay
|
||||
|
||||
version:
|
||||
|
21
checki2cp.go
21
checki2cp.go
@ -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.
Reference in New Issue
Block a user