diff --git a/i2pd.go b/i2pd.go new file mode 100644 index 0000000..27919b8 --- /dev/null +++ b/i2pd.go @@ -0,0 +1,20 @@ +//go:build i2pd +// +build i2pd + +package main + +import ( + i2pd "github.com/eyedeekay/go-i2pd/goi2pd" +) + +func InitI2PSAM() func() { + return i2pd.InitI2PSAM() +} + +func StartI2P() { + i2pd.StartI2P() +} + +func StopI2P() { + defer i2pd.StopI2P() +} diff --git a/main.go b/main.go index 868fdd5..82daa86 100644 --- a/main.go +++ b/main.go @@ -16,8 +16,6 @@ import ( "github.com/itchio/headway/state" tbget "i2pgit.org/idk/i2p.plugins.tor-manager/get" tbserve "i2pgit.org/idk/i2p.plugins.tor-manager/serve" - - i2pd "github.com/eyedeekay/go-i2pd/goi2pd" ) /* @@ -166,11 +164,11 @@ func main() { } } else { log.Fatal("Failed to run I2P", err) - closer := i2pd.InitI2PSAM() + closer := InitI2PSAM() defer closer() - go i2pd.StartI2P() + go StartI2P() //time.Sleep(time.Hour) - defer i2pd.StopI2P() + defer StopI2P() //TODO: Link libi2pd and start our own router if we cant find one anywhere. //TODO: loop again until TestHTTPDefaultProxy is up } diff --git a/no-i2pd.go b/no-i2pd.go new file mode 100644 index 0000000..7f77b72 --- /dev/null +++ b/no-i2pd.go @@ -0,0 +1,19 @@ +//go:build !i2pd +// +build !i2pd + +package main + +func InitI2PSAM() func() { + return nullFunc +} + +func nullFunc() { + +} +func StartI2P() { + +} + +func StopI2P() { + +}