Compare commits
18 Commits
v0.0.1
...
zerobundle
Author | SHA1 | Date | |
---|---|---|---|
0395860c7c | |||
69b9f4a6e5 | |||
57caf7c8a5 | |||
8e3c3933cf | |||
d46e7e76a1 | |||
3f96e9240a | |||
d998e46dc7 | |||
51e976fc2b | |||
fc9ff2e443 | |||
9258a782f1 | |||
69a1415faa | |||
2fad4bb6a9 | |||
66313bb7f0 | |||
40e6aac44e | |||
3f4bea6c35 | |||
7eea40c5aa | |||
3bff02397e | |||
b46f04344d |
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
zerobundle/i2p-zero
|
||||
zerobundle/mac/assets.go
|
||||
zerobundle/windows/assets.go
|
||||
zerobundle/linux/assets.go
|
34
Makefile
34
Makefile
@ -2,7 +2,7 @@
|
||||
|
||||
GO111MODULE=on
|
||||
|
||||
VERSION=0.0.1
|
||||
VERSION=0.0.12
|
||||
USER_GH=eyedeekay
|
||||
|
||||
version:
|
||||
@ -28,3 +28,35 @@ clean:
|
||||
|
||||
fmt:
|
||||
find . -name '*.go' -exec gofmt -w -s {} \;
|
||||
|
||||
i2p-zero:
|
||||
cd zerobundle && git clone https://github.com/i2p-zero/i2p-zero.git; \
|
||||
cd i2p-zero && \
|
||||
git fetch --all --tags && \
|
||||
git checkout $(ZERO_VERSION)
|
||||
|
||||
zero-build: i2p-zero
|
||||
cd zerobundle/i2p-zero && \
|
||||
./bin/build-all-and-zip.sh
|
||||
|
||||
zero-zip:
|
||||
|
||||
zero-bundle: zero-zip
|
||||
cd zerobundle && \
|
||||
go run --tags generate ./gen/gen.go
|
||||
|
||||
ZERO_VERSION=z9.46.12
|
||||
|
||||
zero-assets:
|
||||
gothub release -p -u eyedeekay -r "checki2cp" -t $(ZERO_VERSION) -n "I2P Zero pre-encoded assets" -d "assets.go file containing a zipped bundle of I2P Zero"
|
||||
gothub upload -R -u eyedeekay -r "checki2cp" -t $(ZERO_VERSION) -n "assets_windows.go" -f "zerobundle/windows/assets.go"
|
||||
gothub upload -R -u eyedeekay -r "checki2cp" -t $(ZERO_VERSION) -n "assets_darwin.go" -f "zerobundle/mac/assets.go"
|
||||
gothub upload -R -u eyedeekay -r "checki2cp" -t $(ZERO_VERSION) -n "assets_linux.go" -f "zerobundle/linux/assets.go"
|
||||
|
||||
I2PD_VERSION=d9.46.12
|
||||
|
||||
i2pd-assets:
|
||||
#gothub release -p -u eyedeekay -r "checki2cp" -t $(I2PD_VERSION) -n "i2pd C++ pre-encoded assets" -d "assets.go file containing a zipped bundle of I2P Zero"
|
||||
#gothub upload -R -u eyedeekay -r "checki2cp" -t $(I2PD_VERSION) -n "assets_windows.go" -f "i2pdbundle/windows/assets.go"
|
||||
#gothub upload -R -u eyedeekay -r "checki2cp" -t $(I2PD_VERSION) -n "assets_darwin.go" -f "i2pdbundle/mac/assets.go"
|
||||
#gothub upload -R -u eyedeekay -r "checki2cp" -t $(I2PD_VERSION) -n "assets_linux.go" -f "i2pdbundle/linux/assets.go"
|
42
README.md
42
README.md
@ -1,17 +1,37 @@
|
||||
# checki2cp
|
||||
checki2cp
|
||||
=========
|
||||
|
||||
Library and terminal application which checks for the presence of a usable i2p
|
||||
router by attempting to connect to i2cp. Yet another tiny but essential function
|
||||
I don't want to be bothered with writing a billion times.
|
||||
|
||||
It contains just two functions, for helping Go applications confirm the presence
|
||||
of an I2P router on the system. The first is *CheckI2PIsRunning*, which attempts
|
||||
to connect to the I2CP Port, generate a destination, and quit. If this is
|
||||
successful, an i2p router is obviously installed. The second is
|
||||
*CheckI2PIsInstalledDefaultLocation* which checks the default locations for
|
||||
the I2P router on various platforms to confirm whether an i2p router is present.
|
||||
Both of these functions return a bool and an error. If a router is present, they
|
||||
return true amd nil, if not, they return false and an error.
|
||||
Well like most things, it grew in complexity. Now it does about 5 or 6 things,
|
||||
it determines presence, running state, path, router "Style"(Java I2P, i2pd,
|
||||
Zero) and it can start(but not stop) an I2P router. If you want to stop it,
|
||||
use i2pcontrol.
|
||||
|
||||
It does not launch the router or anything else to do with managing the router.
|
||||
It is solely for checking whether a router is present.
|
||||
Here's where things get a little wierder.
|
||||
-----------------------------------------
|
||||
|
||||
Have you ever wondered whether it's possible to compile a 200-ish Gigabyte .go
|
||||
file? Because before today, I hadn't. Turns out, it's looking... kinda possible.
|
||||
But it's a sonafagun to actually accomplish. Let me back up, today, I wanted to
|
||||
see if I could bundle I2P-Zero inside of a Go package wholesale. To do this, I
|
||||
went ahead and used lorca's embedding code to do so, because that's what I've
|
||||
been using for other things that this will be used in. Also it's easy to use.
|
||||
That means it takes the whole, compiled I2P-Zero package(zip file or whatever)
|
||||
encodes it as a string, and puts it in an object inside a Go file. Those, you
|
||||
can find on the releases page, under releases starting with z, followed by the
|
||||
corresponding Java I2P Major and Minor version, followed by the i2cpcheck
|
||||
version. So:
|
||||
|
||||
z9.46.12
|
||||
|
||||
for example.
|
||||
|
||||
Download all 3 of those to the zerobundle directory and compile them. You now
|
||||
have a virtual filesystem, containing the I2P Zero application as a zip file,
|
||||
which you can unpack to the disk at a desirable install location. Convenience
|
||||
functions to pack and unpack the data will be provided when I am done evaluating
|
||||
non-lorca options that might achieve smaller files, since I know I can achieve
|
||||
much smaller files with i2pd anyway.
|
16
checki2cp.go
16
checki2cp.go
@ -212,12 +212,22 @@ func ConditionallyLaunchI2P() (bool, error) {
|
||||
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)
|
||||
if strings.HasSuffix(path, "i2prouter") {
|
||||
cmd := exec.Command(path, "start")
|
||||
if err := cmd.Start(); err != nil {
|
||||
return false, fmt.Errorf("I2P router startup failure", err)
|
||||
}
|
||||
} else {
|
||||
cmd := exec.Command(path, "--daemon")
|
||||
if err := cmd.Start(); err != nil {
|
||||
return false, fmt.Errorf("I2P router startup failure", err)
|
||||
}
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
return true, nil
|
||||
} else {
|
||||
return false, err
|
||||
}
|
||||
} else {
|
||||
return false, fmt.Errorf("I2P is not a default location, please set $I2P environment variable")
|
||||
|
2
go.sum
Normal file
2
go.sum
Normal file
@ -0,0 +1,2 @@
|
||||
github.com/eyedeekay/go-i2cp v0.0.0-20190716135428-6d41bed718b0 h1:rnn9OlD/3+tATEZNuiMR1C84O5CX8bZL2qqgttprKrw=
|
||||
github.com/eyedeekay/go-i2cp v0.0.0-20190716135428-6d41bed718b0/go.mod h1:+P0fIhkqIYjo7exMJRTlSteRMbRyHbiBiKw+YlPWk+c=
|
BIN
i2cpcheck/i2cpcheck.exe
Executable file
BIN
i2cpcheck/i2cpcheck.exe
Executable file
Binary file not shown.
14
zerobundle/gen/gen.go
Normal file
14
zerobundle/gen/gen.go
Normal file
@ -0,0 +1,14 @@
|
||||
//+build generate
|
||||
|
||||
package main
|
||||
|
||||
import "github.com/zserge/lorca"
|
||||
|
||||
func main() {
|
||||
// You can also run "npm build" or webpack here, or compress assets, or
|
||||
// generate manifests, or do other preparations for your assets.
|
||||
lorca.Embed("zero", "linux/assets.go", "i2p-zero/dist-zip/i2p-zero-linux.v1.16.zip")
|
||||
lorca.Embed("zero", "mac/assets.go", "i2p-zero/dist-zip/i2p-zero-mac.v1.16.zip")
|
||||
lorca.Embed("zero", "windows/assets.go", "i2p-zero/dist-zip/i2p-zero-win.v1.16.zip")
|
||||
}
|
||||
|
0
zerobundle/linux/keep
Normal file
0
zerobundle/linux/keep
Normal file
0
zerobundle/mac/keep
Normal file
0
zerobundle/mac/keep
Normal file
1
zerobundle/run.go
Normal file
1
zerobundle/run.go
Normal file
@ -0,0 +1 @@
|
||||
package zero
|
1
zerobundle/unpack.go
Normal file
1
zerobundle/unpack.go
Normal file
@ -0,0 +1 @@
|
||||
package zero
|
0
zerobundle/windows/keep
Normal file
0
zerobundle/windows/keep
Normal file
Reference in New Issue
Block a user