Files
sam-forwarder/Makefile

224 lines
6.3 KiB
Makefile
Raw Normal View History

2018-07-21 07:11:54 -04:00
2018-09-19 10:37:59 -04:00
GOPATH = $(PWD)/.go
2018-07-30 22:01:05 -04:00
appname = ephsite
2018-08-08 16:53:24 -04:00
eephttpd = eephttpd
2018-09-12 19:44:05 -04:00
samcatd = samcatd
network = si
samhost = sam-host
samport = 7656
args = -r
2018-08-08 16:53:24 -04:00
WEB_INTERFACE = -tags webface
echo:
@echo "$(GOPATH)"
2018-07-28 03:41:33 -04:00
find . -name "*.go" -exec gofmt -w {} \;
2018-07-30 22:01:05 -04:00
find . -name "*.i2pkeys" -exec rm {} \;
2018-07-27 12:37:11 -04:00
2018-09-19 11:20:32 -04:00
test: test-ntcp test-ssu test-config test-manager
test-ntcp:
2018-07-28 04:33:43 -04:00
go test
2018-09-19 11:20:32 -04:00
test-ssu:
cd udp && go test
2018-09-19 11:20:32 -04:00
test-config:
2018-08-11 01:16:50 -04:00
cd config && go test
2018-09-19 11:20:32 -04:00
test-manager:
2018-09-12 19:44:05 -04:00
cd manager && go test
2018-09-19 14:50:22 -04:00
try-web:
cd bin && \
./samcatd-web -w -f ../etc/samcatd/tunnels.ini
deps:
go get -u github.com/gtank/cryptopasta
go get -u github.com/zieckey/goini
2018-07-26 18:05:56 -04:00
go get -u github.com/eyedeekay/sam-forwarder
2018-07-30 19:26:31 -04:00
go get -u github.com/eyedeekay/sam-forwarder/udp
2018-07-29 00:56:05 -04:00
go get -u github.com/eyedeekay/sam-forwarder/config
2018-09-12 20:46:24 -04:00
go get -u github.com/eyedeekay/sam-forwarder/manager
go get -u github.com/kpetku/sam3
2018-09-09 03:12:04 -04:00
go get -u github.com/eyedeekay/sam3
go get -u github.com/eyedeekay/samcatd-web
2018-08-24 00:52:36 -04:00
2018-09-19 14:50:22 -04:00
mine:
go get -u github.com/kpetku/sam3
webdep:
go get -u github.com/eyedeekay/samcatd-web
2018-08-08 16:13:09 -04:00
build: clean bin/$(appname)
bin/$(appname):
mkdir -p bin
2018-07-30 22:01:05 -04:00
cd main && go build -a -tags netgo -ldflags '-w -extldflags "-static"' -o ../bin/$(appname)
2018-08-08 16:51:18 -04:00
server: clean-server bin/$(eephttpd)
2018-08-08 16:13:09 -04:00
2018-08-08 16:51:18 -04:00
bin/$(eephttpd):
2018-08-08 16:13:09 -04:00
mkdir -p bin
2018-08-08 16:51:18 -04:00
go build -a -tags netgo -ldflags '-w -extldflags "-static"' -o ./bin/$(eephttpd) ./example/serve.go
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) \
./daemon/*.go
2018-09-12 19:44:05 -04:00
daemon-web: clean-daemon-web bin/$(samcatd)-web
bin/$(samcatd)-web:
mkdir -p bin
go build -a -tags netgo $(WEB_INTERFACE) \
-ldflags '-w -extldflags "-static"' \
-o ./bin/$(samcatd)-web \
./daemon/*.go
2018-09-12 20:28:35 -04:00
all: daemon build server
2018-08-08 16:13:09 -04:00
2018-08-16 17:28:14 -04:00
clean-all: clean clean-server
clean:
2018-07-30 22:01:05 -04:00
rm -f bin/$(appname)
2018-08-08 16:13:09 -04:00
clean-server:
2018-08-08 16:51:18 -04:00
rm -f bin/$(eephttpd)
2018-08-08 16:13:09 -04:00
2018-09-12 19:44:05 -04:00
clean-daemon:
rm -f bin/$(samcatd)
clean-daemon-web:
rm -f bin/$(samcatd)-web
noopts: clean
mkdir -p bin
2018-07-30 22:01:05 -04:00
cd main && go build -o ../bin/$(appname)
2018-07-28 03:41:33 -04:00
2018-08-22 21:53:48 -04:00
install:
2018-08-22 22:52:47 -04:00
install -m755 bin/ephsite /usr/local/bin/ephsite
install-server:
install -m755 bin/eephttpd /usr/local/bin/eephttpd
install-all: install install-server
2018-08-22 21:53:48 -04:00
remove:
2018-09-10 22:00:49 -04:00
rm -rf /usr/local/bin/ephsite /usr/local/bin/eephttpd
2018-08-22 21:53:48 -04:00
2018-09-12 23:58:25 -04:00
gendoc:
2018-07-30 22:01:05 -04:00
@echo "$(appname) - Easy forwarding of local services to i2p" > USAGE.md
2018-07-28 03:41:33 -04:00
@echo "==================================================" >> USAGE.md
@echo "" >> USAGE.md
2018-07-30 22:01:05 -04:00
@echo "$(appname) is a forwarding proxy designed to configure a tunnel for use" >> USAGE.md
2018-07-28 03:51:05 -04:00
@echo "with i2p. It can be used to easily forward a local service to the" >> USAGE.md
@echo "i2p network using i2p's SAM API instead of the tunnel interface." >> USAGE.md
2018-07-28 03:41:33 -04:00
@echo "" >> USAGE.md
@echo "usage:" >> USAGE.md
@echo "------" >> USAGE.md
@echo "" >> USAGE.md
2018-07-28 03:51:05 -04:00
@echo '```' >> USAGE.md
2018-09-13 18:14:22 -04:00
./bin/$(appname) -help 2>> USAGE.md; true
2018-07-28 03:51:05 -04:00
@echo '```' >> USAGE.md
2018-08-08 16:37:41 -04:00
@echo "" >> USAGE.md
2018-09-12 23:58:25 -04:00
@echo "$(samcatd) - Router-independent tunnel management for i2p" >> USAGE.md
@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-09-18 00:56:44 -04:00
cp USAGE.md docs/USAGE.md
2018-09-12 23:58:25 -04:00
2018-08-08 16:37:41 -04:00
docker-build:
docker build --no-cache \
2018-09-10 01:31:27 -04:00
--build-arg user=$(eephttpd) \
--build-arg path=example/www \
-f Dockerfile \
-t eyedeekay/$(eephttpd) .
2018-08-08 16:37:41 -04:00
2018-08-16 17:51:08 -04:00
docker-volume:
docker run -i -t -d \
--name $(eephttpd)-volume \
--volume $(eephttpd):/home/$(eephttpd)/ \
eyedeekay/$(eephttpd); true
2018-08-16 18:42:18 -04:00
docker stop $(eephttpd)-volume; true
2018-08-16 17:51:08 -04:00
docker-run: docker-volume
2018-08-08 18:17:34 -04:00
docker rm -f eephttpd; true
2018-08-16 18:42:18 -04:00
docker run -i -t -d \
--network $(network) \
--env samhost=$(samhost) \
--env samport=$(samport) \
--env args=$(args) \
2018-08-08 16:51:18 -04:00
--network-alias $(eephttpd) \
--hostname $(eephttpd) \
--name $(eephttpd) \
2018-08-08 16:37:41 -04:00
--restart always \
2018-08-16 17:51:08 -04:00
--volumes-from $(eephttpd)-volume \
2018-08-08 16:51:18 -04:00
eyedeekay/$(eephttpd)
2018-09-10 16:10:47 -04:00
make follow
follow:
2018-08-16 18:42:18 -04:00
docker logs -f $(eephttpd)
2018-08-16 17:51:08 -04:00
docker: docker-build docker-volume docker-run
index:
2018-09-18 00:56:44 -04:00
pandoc USAGE.md -o example/www/index.html && cp example/www/index.html docs/index.html
cp config/CHECKLIST.md docs/config
visit:
2018-09-10 18:52:31 -04:00
http_proxy=http://127.0.0.1:4444 surf http://566niximlxdzpanmn4qouucvua3k7neniwss47li5r6ugoertzuq.b32.i2p
forward:
./bin/ephsite -client -dest i2p-projekt.i2p