From b23eda9c06c8ac9eb94874c94d8f9cb192be717e Mon Sep 17 00:00:00 2001 From: Owen Date: Sat, 15 Feb 2025 17:59:59 -0500 Subject: [PATCH 1/6] Add arm32 go binary as well --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 3dbb196..09e1cfa 100644 --- a/Makefile +++ b/Makefile @@ -23,6 +23,7 @@ local: go-build-release: CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o bin/newt_linux_arm64 + CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -o bin/newt_linux_arm32 CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bin/newt_linux_amd64 CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o bin/newt_darwin_arm64 CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o bin/newt_darwin_amd64 From e8141a177b77dad1a8b9c869161988b1d2603d80 Mon Sep 17 00:00:00 2001 From: Owen Date: Sat, 22 Feb 2025 11:46:40 -0500 Subject: [PATCH 2/6] Fix typo 51820 Fixes #13 --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 786ecbd..0226413 100644 --- a/main.go +++ b/main.go @@ -124,7 +124,7 @@ func startPingCheck(tnet *netstack.Net, serverIP string, stopChan chan struct{}) err := ping(tnet, serverIP) if err != nil { logger.Warn("Periodic ping failed: %v", err) - logger.Warn("HINT: Do you have UDP port 51280 (or the port in config.yml) open on your Pangolin server?") + logger.Warn("HINT: Do you have UDP port 51820 (or the port in config.yml) open on your Pangolin server?") } case <-stopChan: logger.Info("Stopping ping check") From ed8a2ccd2302d9fd8d95350a1d705620d1f6223a Mon Sep 17 00:00:00 2001 From: Owen Date: Wed, 26 Feb 2025 18:46:35 -0500 Subject: [PATCH 3/6] Build riscv64 newt binary and use alpine in docker Resolves #14 --- Dockerfile | 10 ++-------- Makefile | 1 + 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index d573c7b..504cd8c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,19 +15,13 @@ COPY . . # Build the application RUN CGO_ENABLED=0 GOOS=linux go build -o /newt -# Start a new stage from scratch -FROM ubuntu:22.04 AS runner +FROM alpine:3.19 AS runner -RUN apt-get update && apt-get install ca-certificates -y && rm -rf /var/lib/apt/lists/* +RUN apk --no-cache add ca-certificates -# Copy the pre-built binary file from the previous stage and the entrypoint script COPY --from=builder /newt /usr/local/bin/ COPY entrypoint.sh / RUN chmod +x /entrypoint.sh - -# Copy the entrypoint script ENTRYPOINT ["/entrypoint.sh"] - -# Command to run the executable CMD ["newt"] \ No newline at end of file diff --git a/Makefile b/Makefile index 09e1cfa..512e0da 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,7 @@ go-build-release: CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o bin/newt_linux_arm64 CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -o bin/newt_linux_arm32 CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bin/newt_linux_amd64 + CGO_ENABLED=0 GOOS=linux GOARCH=riscv64 go build -o bin/newt_linux_riscv64 CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o bin/newt_darwin_arm64 CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o bin/newt_darwin_amd64 CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o bin/newt_windows_amd64.exe From a69618310b66fb5d9531dd3d05c13f0ecd68ed90 Mon Sep 17 00:00:00 2001 From: Owen Date: Fri, 28 Feb 2025 12:54:21 -0500 Subject: [PATCH 4/6] Also build armv6 --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 512e0da..b4c3ad0 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,7 @@ local: go-build-release: CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o bin/newt_linux_arm64 CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -o bin/newt_linux_arm32 + CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -o bin/newt_linux_arm32v6 CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bin/newt_linux_amd64 CGO_ENABLED=0 GOOS=linux GOARCH=riscv64 go build -o bin/newt_linux_riscv64 CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o bin/newt_darwin_arm64 From 3d15ecb7327e97a49c9b7e26b5b421a2b5bb7d6f Mon Sep 17 00:00:00 2001 From: Owen Date: Sun, 2 Mar 2025 14:10:18 -0500 Subject: [PATCH 5/6] Log the token response to make it more clear Helps resolve #16 --- websocket/client.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/websocket/client.go b/websocket/client.go index 8a7d3f9..022a489 100644 --- a/websocket/client.go +++ b/websocket/client.go @@ -228,6 +228,10 @@ func (c *Client) getToken() (string, error) { var tokenResp TokenResponse if err := json.NewDecoder(resp.Body).Decode(&tokenResp); err != nil { + // print out the token response for debugging + buf := new(bytes.Buffer) + buf.ReadFrom(resp.Body) + logger.Info("Token response: %s", buf.String()) return "", fmt.Errorf("failed to decode token response: %w", err) } From bc72c96b5e96238202aabf656642e95bee8c4b4d Mon Sep 17 00:00:00 2001 From: miloschwartz Date: Mon, 3 Mar 2025 21:29:11 -0500 Subject: [PATCH 6/6] add arm/v7 to cicd --- .go-version | 1 + Makefile | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 .go-version diff --git a/.go-version b/.go-version new file mode 100644 index 0000000..14bee92 --- /dev/null +++ b/.go-version @@ -0,0 +1 @@ +1.23.2 diff --git a/Makefile b/Makefile index b4c3ad0..5fe9cde 100644 --- a/Makefile +++ b/Makefile @@ -6,8 +6,8 @@ docker-build-release: echo "Error: tag is required. Usage: make build-all tag="; \ exit 1; \ fi - docker buildx build --platform linux/arm64,linux/amd64 -t fosrl/newt:latest -f Dockerfile --push . - docker buildx build --platform linux/arm64,linux/amd64 -t fosrl/newt:$(tag) -f Dockerfile --push . + docker buildx build --platform linux/arm64,linux/amd64,linux/arm/v7 -t fosrl/newt:latest -f Dockerfile --push . + docker buildx build --platform linux/arm64,linux/amd64,linux/arm/v7 -t fosrl/newt:$(tag) -f Dockerfile --push . build: docker build -t fosrl/newt:latest .