Skip to content

Commit 59e5362

Browse files
committed
Bump to Go 1.22. Add .rpm .deb and .akp to releases. Fix bad version comparison.
1 parent 3de1774 commit 59e5362

File tree

7 files changed

+52
-33
lines changed

7 files changed

+52
-33
lines changed
File renamed without changes.

.github/goreleaser.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# test this goreleaser config with:
2-
# - cd chisel
3-
# - goreleaser --skip-publish --rm-dist --config .github/goreleaser.yml
1+
# test this file with
2+
# goreleaser release --config goreleaser.yml --clean --snapshot
3+
version: 2
44
builds:
55
- env:
66
- CGO_ENABLED=0
@@ -12,6 +12,7 @@ builds:
1212
- linux
1313
- darwin
1414
- windows
15+
- openbsd
1516
goarch:
1617
- 386
1718
- amd64
@@ -31,6 +32,12 @@ builds:
3132
gomips:
3233
- hardfloat
3334
- softfloat
35+
nfpms:
36+
- maintainer: "https://github.com/{{ .Env.GITHUB_USER }}"
37+
formats:
38+
- deb
39+
- rpm
40+
- apk
3441
archives:
3542
- format: gz
3643
files:

.github/workflows/ci.yml

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,36 @@
1-
on: [push, pull_request]
21
name: CI
2+
on:
3+
pull_request: {}
4+
push: {}
5+
permissions: write-all
36
jobs:
47
# ================
5-
# TEST JOB
6-
# runs on every push and PR
7-
# runs 2x3 times (see matrix)
8+
# BUILD AND TEST JOB
89
# ================
910
test:
10-
name: Test
11+
name: Build & Test
1112
strategy:
1213
matrix:
13-
go-version: [1.21.x]
14+
# optionally test/build across multiple platforms/Go-versions
15+
go-version: ['1.22'] # '1.16', '1.17', '1.18,
1416
platform: [ubuntu-latest, macos-latest, windows-latest]
1517
runs-on: ${{ matrix.platform }}
1618
steps:
17-
- name: Install Go
18-
uses: actions/setup-go@v5
19+
- name: Checkout
20+
uses: actions/checkout@v3
21+
with:
22+
fetch-depth: 0
23+
- name: Set up Go
24+
uses: actions/setup-go@v3
1925
with:
2026
go-version: ${{ matrix.go-version }}
21-
- name: Checkout code
22-
uses: actions/checkout@v3
27+
check-latest: true
2328
- name: Build
2429
run: go build -v -o /dev/null .
2530
- name: Test
2631
run: go test -v ./...
2732
# ================
28-
# RELEASE JOBS
29-
# runs after a success test
30-
# only runs on push "v*" tag
33+
# RELEASE BINARIES (on push "v*" tag)
3134
# ================
3235
release_binaries:
3336
name: Release Binaries
@@ -41,9 +44,13 @@ jobs:
4144
if: success()
4245
uses: docker://goreleaser/goreleaser:latest
4346
env:
47+
GITHUB_USER: ${{ github.repository_owner }}
4448
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4549
with:
4650
args: release --config .github/goreleaser.yml
51+
# ================
52+
# RELEASE DOCKER IMAGES (on push "v*" tag)
53+
# ================
4754
release_docker:
4855
name: Release Docker Images
4956
needs: test
@@ -53,17 +60,16 @@ jobs:
5360
- name: Check out code
5461
uses: actions/checkout@v3
5562
- name: Set up QEMU
56-
uses: docker/setup-qemu-action@v1
63+
uses: docker/setup-qemu-action@v2
5764
- name: Set up Docker Buildx
58-
id: buildx
59-
uses: docker/setup-buildx-action@v1
65+
uses: docker/setup-buildx-action@v2
6066
- name: Login to DockerHub
6167
uses: docker/login-action@v2
6268
with:
6369
username: jpillora
6470
password: ${{ secrets.DOCKERHUB_TOKEN }}
6571
- name: Docker meta
66-
id: docker_meta
72+
id: meta
6773
uses: docker/metadata-action@v4
6874
with:
6975
images: jpillora/chisel
@@ -74,8 +80,10 @@ jobs:
7480
- name: Build and push
7581
uses: docker/build-push-action@v3
7682
with:
77-
context: .
83+
file: .github/Dockerfile
7884
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/386,linux/arm/v7,linux/arm/v6
7985
push: true
80-
tags: ${{ steps.docker_meta.outputs.tags }}
81-
labels: ${{ steps.docker_meta.outputs.labels }}
86+
tags: ${{ steps.meta.outputs.tags }}
87+
labels: ${{ steps.meta.outputs.labels }}
88+
cache-from: type=gha
89+
cache-to: type=gha,mode=max

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 Jaime Pillora <[email protected]>
3+
Copyright (c) 2024 Jaime Pillora <[email protected]>
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,8 @@ Since WebSockets support is required:
422422
- `1.6` - Added client stdio support (by @BoleynSu)
423423
- `1.7` - Added UDP support
424424
- `1.8` - Move to a `scratch`Docker image
425-
- `1.9` - Switch from `--key` seed to P256 key strings with `--key{gen,file}` + bump to Go 1.21 (by @cmenginnz)
425+
- `1.9` - Bump to Go 1.21. Switch from `--key` seed to P256 key strings with `--key{gen,file}` (by @cmenginnz)
426+
- `1.10` - Bump to Go 1.22. Add `.rpm` `.deb` and `.akp` to releases. Fix bad version comparison.
426427
427428
## License
428429

main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,9 @@ func server(args []string) {
240240
} else if config.KeySeed == "" {
241241
config.KeySeed = settings.Env("KEY")
242242
}
243+
if config.Auth == "" {
244+
config.Auth = os.Getenv("AUTH")
245+
}
243246
s, err := chserver.NewServer(config)
244247
if err != nil {
245248
log.Fatal(err)

server/server_handler.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func (s *Server) handleClientHandler(w http.ResponseWriter, r *http.Request) {
1919
//websockets upgrade AND has chisel prefix
2020
upgrade := strings.ToLower(r.Header.Get("Upgrade"))
2121
protocol := r.Header.Get("Sec-WebSocket-Protocol")
22-
if upgrade == "websocket" {
22+
if upgrade == "websocket" {
2323
if protocol == chshare.ProtocolVersion {
2424
s.handleWebsocket(w, r)
2525
return
@@ -101,13 +101,13 @@ func (s *Server) handleWebsocket(w http.ResponseWriter, req *http.Request) {
101101
return
102102
}
103103
//print if client and server versions dont match
104-
if c.Version != chshare.BuildVersion {
105-
v := c.Version
106-
if v == "" {
107-
v = "<unknown>"
108-
}
109-
l.Infof("Client version (%s) differs from server version (%s)",
110-
v, chshare.BuildVersion)
104+
cv := strings.TrimPrefix(c.Version, "v")
105+
if cv == "" {
106+
cv = "<unknown>"
107+
}
108+
sv := strings.TrimPrefix(chshare.BuildVersion, "v")
109+
if cv != sv {
110+
l.Infof("Client version (%s) differs from server version (%s)", cv, sv)
111111
}
112112
//validate remotes
113113
for _, r := range c.Remotes {

0 commit comments

Comments
 (0)