Skip to content

Commit

Permalink
Bump to Go 1.22. Add .rpm .deb and .akp to releases. Fix bad ve…
Browse files Browse the repository at this point in the history
…rsion comparison.
  • Loading branch information
jpillora committed Aug 5, 2024
1 parent 3de1774 commit 59e5362
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 33 deletions.
File renamed without changes.
13 changes: 10 additions & 3 deletions .github/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# test this goreleaser config with:
# - cd chisel
# - goreleaser --skip-publish --rm-dist --config .github/goreleaser.yml
# test this file with
# goreleaser release --config goreleaser.yml --clean --snapshot
version: 2
builds:
- env:
- CGO_ENABLED=0
Expand All @@ -12,6 +12,7 @@ builds:
- linux
- darwin
- windows
- openbsd
goarch:
- 386
- amd64
Expand All @@ -31,6 +32,12 @@ builds:
gomips:
- hardfloat
- softfloat
nfpms:
- maintainer: "https://github.com/{{ .Env.GITHUB_USER }}"
formats:
- deb
- rpm
- apk
archives:
- format: gz
files:
Expand Down
48 changes: 28 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
on: [push, pull_request]
name: CI
on:
pull_request: {}
push: {}
permissions: write-all
jobs:
# ================
# TEST JOB
# runs on every push and PR
# runs 2x3 times (see matrix)
# BUILD AND TEST JOB
# ================
test:
name: Test
name: Build & Test
strategy:
matrix:
go-version: [1.21.x]
# optionally test/build across multiple platforms/Go-versions
go-version: ['1.22'] # '1.16', '1.17', '1.18,
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
uses: actions/setup-go@v5
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v3
check-latest: true
- name: Build
run: go build -v -o /dev/null .
- name: Test
run: go test -v ./...
# ================
# RELEASE JOBS
# runs after a success test
# only runs on push "v*" tag
# RELEASE BINARIES (on push "v*" tag)
# ================
release_binaries:
name: Release Binaries
Expand All @@ -41,9 +44,13 @@ jobs:
if: success()
uses: docker://goreleaser/goreleaser:latest
env:
GITHUB_USER: ${{ github.repository_owner }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: release --config .github/goreleaser.yml
# ================
# RELEASE DOCKER IMAGES (on push "v*" tag)
# ================
release_docker:
name: Release Docker Images
needs: test
Expand All @@ -53,17 +60,16 @@ jobs:
- name: Check out code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: jpillora
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker meta
id: docker_meta
id: meta
uses: docker/metadata-action@v4
with:
images: jpillora/chisel
Expand All @@ -74,8 +80,10 @@ jobs:
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: .github/Dockerfile
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/386,linux/arm/v7,linux/arm/v6
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Jaime Pillora <dev@jpillora.com>
Copyright (c) 2024 Jaime Pillora <dev@jpillora.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,8 @@ Since WebSockets support is required:
- `1.6` - Added client stdio support (by @BoleynSu)
- `1.7` - Added UDP support
- `1.8` - Move to a `scratch`Docker image
- `1.9` - Switch from `--key` seed to P256 key strings with `--key{gen,file}` + bump to Go 1.21 (by @cmenginnz)
- `1.9` - Bump to Go 1.21. Switch from `--key` seed to P256 key strings with `--key{gen,file}` (by @cmenginnz)
- `1.10` - Bump to Go 1.22. Add `.rpm` `.deb` and `.akp` to releases. Fix bad version comparison.
## License
Expand Down
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,9 @@ func server(args []string) {
} else if config.KeySeed == "" {
config.KeySeed = settings.Env("KEY")
}
if config.Auth == "" {
config.Auth = os.Getenv("AUTH")
}
s, err := chserver.NewServer(config)
if err != nil {
log.Fatal(err)
Expand Down
16 changes: 8 additions & 8 deletions server/server_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func (s *Server) handleClientHandler(w http.ResponseWriter, r *http.Request) {
//websockets upgrade AND has chisel prefix
upgrade := strings.ToLower(r.Header.Get("Upgrade"))
protocol := r.Header.Get("Sec-WebSocket-Protocol")
if upgrade == "websocket" {
if upgrade == "websocket" {
if protocol == chshare.ProtocolVersion {
s.handleWebsocket(w, r)
return
Expand Down Expand Up @@ -101,13 +101,13 @@ func (s *Server) handleWebsocket(w http.ResponseWriter, req *http.Request) {
return
}
//print if client and server versions dont match
if c.Version != chshare.BuildVersion {
v := c.Version
if v == "" {
v = "<unknown>"
}
l.Infof("Client version (%s) differs from server version (%s)",
v, chshare.BuildVersion)
cv := strings.TrimPrefix(c.Version, "v")
if cv == "" {
cv = "<unknown>"
}
sv := strings.TrimPrefix(chshare.BuildVersion, "v")
if cv != sv {
l.Infof("Client version (%s) differs from server version (%s)", cv, sv)
}
//validate remotes
for _, r := range c.Remotes {
Expand Down

0 comments on commit 59e5362

Please sign in to comment.