2024-12-16 15:19:01 +09:00
|
|
|
# make
|
|
|
|
# make GOARCH=386
|
|
|
|
# make GOARCH=amd64
|
|
|
|
# make GOOS=linux GOARCH=mips
|
|
|
|
#
|
|
|
|
# 'go tool dist list' for available os and architextures
|
|
|
|
|
2024-12-07 21:24:06 +09:00
|
|
|
NAME=hodu
|
|
|
|
VERSION=1.0.0
|
|
|
|
|
2024-11-23 12:41:49 +09:00
|
|
|
SRCS=\
|
|
|
|
client.go \
|
2024-11-25 19:46:18 +09:00
|
|
|
client-ctl.go \
|
2025-01-28 00:44:02 +09:00
|
|
|
client-metrics.go \
|
2024-11-25 19:46:18 +09:00
|
|
|
client-peer.go \
|
2024-11-23 12:41:49 +09:00
|
|
|
hodu.go \
|
|
|
|
hodu.pb.go \
|
|
|
|
hodu_grpc.pb.go \
|
2025-01-28 00:44:02 +09:00
|
|
|
jwt.go \
|
2024-11-23 12:41:49 +09:00
|
|
|
packet.go \
|
|
|
|
server.go \
|
2024-12-01 21:47:11 +09:00
|
|
|
server-ctl.go \
|
2025-01-28 00:44:02 +09:00
|
|
|
server-metrics.go \
|
2024-11-25 19:46:18 +09:00
|
|
|
server-peer.go \
|
2024-12-12 21:09:16 +09:00
|
|
|
server-proxy.go \
|
2024-12-27 14:43:44 +09:00
|
|
|
system.go \
|
|
|
|
transform.go \
|
2024-12-07 00:54:19 +09:00
|
|
|
|
2024-12-13 02:25:27 +09:00
|
|
|
DATA = \
|
|
|
|
xterm.css \
|
|
|
|
xterm.js \
|
|
|
|
xterm-addon-fit.js \
|
|
|
|
xterm.html
|
|
|
|
|
2024-12-07 12:45:35 +09:00
|
|
|
CMD_DATA=\
|
2025-01-31 04:06:03 +09:00
|
|
|
cmd/rsa.key \
|
2024-12-07 12:45:35 +09:00
|
|
|
cmd/tls.crt \
|
|
|
|
cmd/tls.key
|
|
|
|
|
2024-12-07 00:54:19 +09:00
|
|
|
CMD_SRCS=\
|
|
|
|
cmd/config.go \
|
2024-12-15 15:07:35 +09:00
|
|
|
cmd/logger.go \
|
2024-12-27 16:52:27 +09:00
|
|
|
cmd/main.go
|
2024-11-23 12:34:23 +09:00
|
|
|
|
2024-12-07 21:24:06 +09:00
|
|
|
all: $(NAME)
|
2024-11-23 12:41:49 +09:00
|
|
|
|
2024-12-13 02:25:27 +09:00
|
|
|
$(NAME): $(DATA) $(SRCS) $(CMD_DATA) $(CMD_SRCS)
|
2024-12-27 14:43:44 +09:00
|
|
|
##CGO_ENABLED=0 go build -x -ldflags "-X 'main.HODU_NAME=$(NAME)' -X 'main.HODU_VERSION=$(VERSION)'" -o $@ $(CMD_SRCS)
|
|
|
|
CGO_ENABLED=1 go build -x -ldflags "-X 'main.HODU_NAME=$(NAME)' -X 'main.HODU_VERSION=$(VERSION)'" -o $@ $(CMD_SRCS)
|
|
|
|
##CGO_ENABLED=1 go build -x -ldflags "-X 'main.HODU_NAME=$(NAME)' -X 'main.HODU_VERSION=$(VERSION)' -linkmode external -extldflags=-static" -o $@ $(CMD_SRCS)
|
2024-11-23 12:41:49 +09:00
|
|
|
|
|
|
|
clean:
|
|
|
|
go clean -x -i
|
2024-12-07 21:24:06 +09:00
|
|
|
rm -f $(NAME)
|
2024-11-23 12:34:23 +09:00
|
|
|
|
2025-01-28 00:44:02 +09:00
|
|
|
test:
|
|
|
|
go test -x
|
|
|
|
|
2024-11-23 12:34:23 +09:00
|
|
|
hodu.pb.go: hodu.proto
|
|
|
|
protoc --go_out=. --go_opt=paths=source_relative \
|
|
|
|
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
|
|
|
|
hodu.proto
|
|
|
|
|
|
|
|
hodu_grpc.pb.go: hodu.proto
|
2024-11-12 22:59:37 +09:00
|
|
|
protoc --go_out=. --go_opt=paths=source_relative \
|
|
|
|
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
|
|
|
|
hodu.proto
|
2024-11-23 12:41:49 +09:00
|
|
|
|
2024-12-13 02:25:27 +09:00
|
|
|
xterm.js:
|
|
|
|
curl -L -o "$@" https://cdn.jsdelivr.net/npm/@xterm/xterm/lib/xterm.min.js
|
|
|
|
|
|
|
|
xterm-addon-fit.js:
|
|
|
|
curl -L -o "$@" https://cdn.jsdelivr.net/npm/xterm-addon-fit/lib/xterm-addon-fit.min.js
|
|
|
|
|
|
|
|
xterm.css:
|
|
|
|
curl -L -o "$@" https://cdn.jsdelivr.net/npm/@xterm/xterm/css/xterm.min.css
|
2024-12-13 21:49:11 +09:00
|
|
|
sed -r -i 's|^/\*# sourceMappingURL=/.+ \*/$$||g' "$@"
|
2024-12-13 02:25:27 +09:00
|
|
|
|
2024-12-07 12:45:35 +09:00
|
|
|
cmd/tls.crt:
|
2024-12-07 21:24:06 +09:00
|
|
|
openssl req -x509 -newkey rsa:4096 -keyout cmd/tls.key -out cmd/tls.crt -sha256 -days 36500 -nodes -subj "/CN=$(NAME)" --addext "subjectAltName=DNS:$(NAME),IP:10.0.0.1,IP:::1"
|
2024-12-07 12:45:35 +09:00
|
|
|
|
|
|
|
cmd/tls.key:
|
2024-12-07 21:24:06 +09:00
|
|
|
openssl req -x509 -newkey rsa:4096 -keyout cmd/tls.key -out cmd/tls.crt -sha256 -days 36500 -nodes -subj "/CN=$(NAME)" --addext "subjectAltName=DNS:$(NAME),IP:10.0.0.1,IP:::1"
|
2024-12-07 12:45:35 +09:00
|
|
|
|
2025-01-31 04:06:03 +09:00
|
|
|
cmd/rsa.key:
|
|
|
|
openssl genrsa -traditional -out cmd/rsa.key 2048
|
|
|
|
|
2025-01-28 00:44:02 +09:00
|
|
|
.PHONY: clean test
|