speed it up by only unpacking if router is not present
This commit is contained in:
2
.i2cp.conf
Normal file
2
.i2cp.conf
Normal file
@ -0,0 +1,2 @@
|
||||
i2cp.tcp.host=127.0.0.1
|
||||
i2cp.tcp.port=7654
|
4
Makefile
4
Makefile
@ -16,8 +16,8 @@ gen: write test
|
||||
write:
|
||||
go run --tags=generate gen.go
|
||||
|
||||
test:
|
||||
cd import/ && go test
|
||||
itest:
|
||||
cd import/ && go test -v
|
||||
|
||||
fmt:
|
||||
gofmt -w -s *.go import/*.go go-zero/*.go parts/*/unpacker.go
|
||||
|
2
go-zero/.i2cp.conf
Normal file
2
go-zero/.i2cp.conf
Normal file
@ -0,0 +1,2 @@
|
||||
i2cp.tcp4.host=127.0.0.1
|
||||
i2cp.tcp4.port=7654
|
@ -1,5 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "exec 3<>/dev/tcp/localhost/8051; echo "$1 $2 $3 $4 $5 $6" >&3; cat <&3"
|
||||
|
||||
exec 3<>/dev/tcp/localhost/8052; echo "$1 $2 $3 $4 $5 $6" >&3; cat <&3
|
||||
exec 3<>/dev/tcp/localhost/8051; echo "$1 $2 $3 $4 $5 $6" >&3; cat <&3
|
@ -22,6 +22,8 @@ import (
|
||||
"github.com/eyedeekay/zerobundle/parts/al"
|
||||
)
|
||||
|
||||
var ZERO_VERSION = "v1.17"
|
||||
|
||||
func TBZBytes() ([]byte, error) {
|
||||
var bytes []byte
|
||||
ba, err := izaa.WriteBrowser(izaa.FS)
|
||||
@ -106,28 +108,36 @@ func Write() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func FileNotFound(p string) bool {
|
||||
if _, err := os.Stat(p); os.IsNotExist(err) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func Unpack(destinationDirectory string) error {
|
||||
var platform = "linux"
|
||||
var platform2 = "linux"
|
||||
if runtime.GOOS == "windows" {
|
||||
platform = "win"
|
||||
platform = "win-gui"
|
||||
platform2 = "win"
|
||||
}
|
||||
if runtime.GOOS == "darwin" {
|
||||
platform = "mac"
|
||||
platform2 = "mac"
|
||||
}
|
||||
if destinationDirectory == "" {
|
||||
destinationDirectory = "."
|
||||
}
|
||||
err := os.RemoveAll(filepath.Join(destinationDirectory, "i2p-zero"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = Write()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = archiver.Unarchive("i2p-zero-"+platform+".v1.17.zip", destinationDirectory)
|
||||
if err != nil {
|
||||
return err
|
||||
if FileNotFound(filepath.Join(destinationDirectory, "i2p-zero-"+platform+"."+ZERO_VERSION)) {
|
||||
err := Write()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = archiver.Unarchive("i2p-zero-"+platform2+"."+ZERO_VERSION+".zip", destinationDirectory)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
10
launch_test.go
Normal file
10
launch_test.go
Normal file
@ -0,0 +1,10 @@
|
||||
package zerobundle
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestWriteTBZ(t *testing.T) {
|
||||
str := loopbackInterface()
|
||||
t.Log(str)
|
||||
}
|
Reference in New Issue
Block a user