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/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 a3199f2..ab2db3d 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,10 @@ 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 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 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") 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) }