Files
sam-forwarder/Makefile

218 lines
6.2 KiB
Makefile
Raw Normal View History

2018-07-21 07:11:54 -04:00
#GOPATH=$(HOME)/go
packagename = sam-forwarder
2018-09-12 19:44:05 -04:00
samcatd = samcatd
2019-05-11 15:37:32 -04:00
network = host
samhost = sam-host
samport = 7656
args = -r
2018-08-08 16:53:24 -04:00
PREFIX := /
VAR := var/
RUN := run/
LIB := lib/
LOG := log/
ETC := etc/
USR := usr/
LOCAL := local/
VERSION := 0.1
GO111MODULE=on
echo:
@echo "$(GOPATH)"
2018-09-19 18:42:09 -04:00
find . -path ./.go -prune -o -name "*.go" -exec gofmt -w {} \;
find . -path ./.go -prune -o -name "*.i2pkeys" -exec rm {} \;
find . -path ./.go -prune -o -name "*.go" -exec cat {} \; | nl
2019-04-20 19:56:27 -04:00
recopy:
2019-08-14 16:15:50 -04:00
#find ./tcp/ -name '*.go' -exec cp -rv {} . \;
#sed -i '1s|^|//AUTO-GENERATED FOR BACKWARD COMPATIBILITY, USE ./tcp in the future\n|' *.go
## TODO: Remove this, replace with something right
fix-debian:
find ./debian -type f -exec sed -i 's|lair repo key|eyedeekay|g' {} \;
find ./debian -type f -exec sed -i 's|eyedeekay@safe-mail.net|hankhill19580@gmail.com|g' {} \;
2018-07-27 12:37:11 -04:00
2019-05-11 15:37:32 -04:00
try:
cd etc/samcatd/ && ../../bin/samcatd -f tunnels.ini
test: test-keys test-ntcp test-ssu test-config test-manager
long-test: test-serve test
full-test: test test-serve
test-serve:
cd serve_test && go test -v -tags netgo \
-ldflags '-w -extldflags "-static"'
2018-09-19 11:20:32 -04:00
test-ntcp:
cd tcp && go test -v -tags netgo \
-ldflags '-w -extldflags "-static"'
2018-09-19 11:20:32 -04:00
test-ssu:
cd udp && go test -v -tags netgo \
-ldflags '-w -extldflags "-static"'
2018-09-19 11:20:32 -04:00
test-config:
cd config && go test -v -tags netgo \
-ldflags '-w -extldflags "-static"'
2018-09-19 11:20:32 -04:00
test-manager:
cd manager && go test -v -tags netgo \
-ldflags '-w -extldflags "-static"'
test-keys:
cd i2pkeys && go test -v -tags netgo \
-ldflags '-w -extldflags "-static"'
2018-09-19 18:42:09 -04:00
refresh:
deps:
2019-05-11 02:47:08 -04:00
go get -u -d github.com/eyedeekay/sam-forwarder/samcatd
2018-09-19 14:50:22 -04:00
install:
install -m755 ./bin/$(samcatd) $(PREFIX)$(USR)$(LOCAL)/bin/
install -m644 ./etc/init.d/samcatd $(PREFIX)$(ETC)/init.d
mkdir -p $(PREFIX)$(ETC)/samcatd/ $(PREFIX)$(ETC)/sam-forwarder/ $(PREFIX)$(ETC)/i2pvpn/
install -m644 ./etc/samcatd/tunnels.ini $(PREFIX)$(ETC)/samcatd/
install -m644 ./etc/sam-forwarder/tunnels.ini $(PREFIX)$(ETC)/sam-forwarder/
2018-08-08 16:13:09 -04:00
2018-09-12 19:44:05 -04:00
daemon: clean-daemon bin/$(samcatd)
bin/$(samcatd):
mkdir -p bin
go build -a -tags netgo \
-ldflags '-w -extldflags "-static"' \
-o ./bin/$(samcatd) \
./samcatd/*.go
2018-09-12 19:44:05 -04:00
all: daemon
clean: clean-all
clean-all: clean-daemon
2018-08-08 16:13:09 -04:00
2018-09-12 19:44:05 -04:00
clean-daemon:
rm -f bin/$(samcatd)
install-forwarder:
2019-04-25 22:58:49 -04:00
install -m755 bin/$(samcatd) /usr/local/bin/$(samcatd)
2018-08-22 22:52:47 -04:00
2019-04-25 22:58:49 -04:00
install-all: install
2018-08-22 21:53:48 -04:00
2018-09-12 23:58:25 -04:00
gendoc:
2019-04-25 22:58:49 -04:00
@echo "$(samcatd) - Router-independent tunnel management for i2p" > USAGE.md
2018-09-12 23:58:25 -04:00
@echo "=========================================================" >> USAGE.md
@echo "" >> USAGE.md
@echo "$(samcatd) is a daemon which runs a group of forwarding proxies to" >> USAGE.md
@echo "provide services over i2p independent of the router. It also serves" >> USAGE.md
@echo "as a generalized i2p networking utility for power-users. It's" >> USAGE.md
@echo "intended to be a Swiss-army knife for the SAM API." >> USAGE.md
2018-08-08 16:37:41 -04:00
@echo "" >> USAGE.md
2018-08-08 16:52:47 -04:00
@echo "usage:" >> USAGE.md
@echo "------" >> USAGE.md
@echo "" >> USAGE.md
2018-08-08 16:37:41 -04:00
@echo '```' >> USAGE.md
2018-09-12 23:58:25 -04:00
./bin/$(samcatd) -h 2>> USAGE.md; true
2018-08-08 16:37:41 -04:00
@echo '```' >> USAGE.md
@echo "" >> USAGE.md
2018-09-18 01:27:11 -04:00
make key-management
2018-09-12 23:58:25 -04:00
make example-config
2018-09-18 01:27:11 -04:00
key-management:
@echo "managing $(samcatd) save-encryption keys" >> USAGE.md
@echo "=====================================" >> USAGE.md
@echo "" >> USAGE.md
@echo "In order to keep from saving the .i2pkeys files in plaintext format, samcatd" >> USAGE.md
@echo "can optionally generate a key and encrypt the .i2pkeys files securely. Of" >> USAGE.md
@echo "course, to fully benefit from this arrangement, you need to move those keys" >> USAGE.md
@echo "away from the machine where the tunnel keys(the .i2pkeys file) are located," >> USAGE.md
@echo "or protect them in some other way(sandboxing, etc). If you want to use" >> USAGE.md
@echo "encrypted .i2pkeys files, you can specify a key file to use with the -cr" >> USAGE.md
@echo "option on the terminal or with keyfile option in the .ini file." >> USAGE.md
@echo "" >> USAGE.md
2018-09-12 23:58:25 -04:00
example-config:
@echo "example config - valid for both ephsite and samcat" >> USAGE.md
@echo "==================================================" >> USAGE.md
@echo "Options are still being added, pretty much as fast as I can put them" >> USAGE.md
@echo "in. For up-to-the-minute options, see [the checklist](config/CHECKLIST.md)" >> USAGE.md
@echo "" >> USAGE.md
2018-09-14 01:08:45 -04:00
@echo "(**ephsite** will only use top-level options, but they can be labeled or" >> USAGE.md
@echo "unlabeled)" >> USAGE.md
@echo "" >> USAGE.md
2018-09-14 01:08:45 -04:00
@echo "(**samcatd** treats the first set of options it sees as the default, and" >> USAGE.md
@echo "does not start tunnels based on unlabeled options unless passed the" >> USAGE.md
@echo "-s flag.)" >> USAGE.md
2018-08-08 18:15:35 -04:00
@echo "" >> USAGE.md
2018-09-18 01:27:11 -04:00
@echo '``` ini' >> USAGE.md
cat etc/samcatd/tunnels.ini >> USAGE.md
2018-09-12 23:58:25 -04:00
@echo '```' >> USAGE.md
2018-08-08 18:15:35 -04:00
@echo "" >> USAGE.md
2018-12-04 10:30:14 -05:00
mv USAGE.md docs/USAGE.md
2018-09-12 23:58:25 -04:00
2018-08-08 16:37:41 -04:00
docker-build:
2019-05-17 19:02:08 -04:00
docker build --no-cache \
--build-arg user=$(samcatd) \
2018-09-10 01:31:27 -04:00
-f Dockerfile \
-t eyedeekay/$(samcatd) .
2018-08-08 16:37:41 -04:00
2019-05-11 15:37:32 -04:00
docker-run:
2019-05-11 00:43:46 -04:00
docker rm -f $(samcatd); true
2018-08-16 18:42:18 -04:00
docker run -i -t -d \
--cap-add "net_bind_service" \
--network $(network) \
--env samhost=$(samhost) \
--env samport=$(samport) \
--env args=$(args) \
--hostname $(samcatd) \
--name $(samcatd) \
2018-08-08 16:37:41 -04:00
--restart always \
2019-05-11 15:37:32 -04:00
-p 127.0.0.1:7957:7957 \
eyedeekay/$(samcatd)
2018-09-10 16:10:47 -04:00
make follow
2018-12-01 20:07:52 -05:00
c:
go build ./i2pkeys
2018-09-10 16:10:47 -04:00
follow:
docker logs -f $(samcatd)
2019-05-17 19:02:08 -04:00
docker: docker-build docker-run
2018-08-16 17:51:08 -04:00
index:
2019-04-25 22:58:49 -04:00
pandoc README.md -o docs/index.html
pandoc docs/USAGE.md -o example/www/index.html && cp example/www/index.html docs/usage.html
pandoc docs/EMBEDDING.md -o docs/embedding.html
pandoc docs/PACKAGECONF.md -o docs/packageconf.html
pandoc interface/README.md -o docs/interface.html
2018-09-18 00:56:44 -04:00
cp config/CHECKLIST.md docs/config
2019-04-25 22:58:49 -04:00
pandoc docs/config/CHECKLIST.md -o docs/checklist.html
visit:
2018-09-10 18:52:31 -04:00
http_proxy=http://127.0.0.1:4444 surf http://566niximlxdzpanmn4qouucvua3k7neniwss47li5r6ugoertzuq.b32.i2p
gojs:
go get -u github.com/gopherjs/gopherjs
GOPHERJS=$(GOPATH)/bin/gopherjs
js:
mkdir -p bin
$(GOPHERJS) build -v --tags netgo \
-o ./javascript/$(samcatd).js \
./samcatd/*.go
cleantar:
rm -f ../$(packagename)_$(VERSION).orig.tar.xz
tar:
tar --exclude .git \
--exclude .go \
--exclude bin \
-cJvf ../$(packagename)_$(VERSION).orig.tar.xz .