Skip to content

Commit 25da470

Browse files
committed
opt
1 parent e0ba441 commit 25da470

File tree

3 files changed

+25
-18
lines changed

3 files changed

+25
-18
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ jobs:
2323
with:
2424
submodules: 'recursive'
2525
- name: Set up Go
26-
uses: actions/setup-go@v4
26+
uses: actions/setup-go@v5
2727
with:
28-
go-version: 1.22.0
28+
go-version: 'stable'
2929
- name: Install dependencies
3030
run: go get .
3131
- name: Build

.github/workflows/release.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,46 +15,50 @@ jobs:
1515
runs-on: ${{ matrix.os }}
1616
strategy:
1717
matrix:
18-
build: [linux, linux-arm64, linux-armv7, linux-mipsle, windows, windows-arm64, macos, macos-arm64]
18+
build: [linux, linux-riscv64, linux-arm64, linux-armv7, linux-mipsle, windows, windows-arm64, macos, macos-arm64]
1919
include:
2020
- build: linux
2121
os: ubuntu-20.04
22-
go: 1.22.1
22+
go: 'stable'
2323
archive-name: sslcon-linux-amd64.tar.gz
24+
- build: linux-riscv64
25+
os: ubuntu-20.04
26+
go: 'stable'
27+
archive-name: sslcon-linux-riscv64.tar.gz
2428
- build: linux-arm64
2529
os: ubuntu-20.04
26-
go: 1.22.1
30+
go: 'stable'
2731
archive-name: sslcon-linux-arm64.tar.gz
2832
- build: linux-armv7
2933
os: ubuntu-20.04
30-
go: 1.22.1
34+
go: 'stable'
3135
archive-name: sslcon-linux-armv7.tar.gz
3236
- build: linux-mipsle
3337
os: ubuntu-20.04
34-
go: 1.22.1
38+
go: 'stable'
3539
archive-name: sslcon-linux-mipsle.tar.gz
3640
- build: windows
3741
os: windows-2019
38-
go: 1.22.1
42+
go: 'stable'
3943
archive-name: sslcon-windows10-amd64.7z
4044
- build: windows-arm64
4145
os: windows-2019
42-
go: 1.22.1
46+
go: 'stable'
4347
archive-name: sslcon-windows10-arm64.7z
4448
- build: macos
4549
os: macos-12
46-
go: 1.22.1
50+
go: 'stable'
4751
archive-name: sslcon-macOS-amd64.tar.gz
4852
- build: macos-arm64
4953
os: macos-14
50-
go: 1.22.1
54+
go: 'stable'
5155
archive-name: sslcon-macOS-arm64.tar.gz
5256
steps:
5357
- uses: actions/checkout@v4
5458
with:
5559
submodules: 'recursive'
5660
- name: Set up Go
57-
uses: actions/setup-go@v4
61+
uses: actions/setup-go@v5
5862
with:
5963
go-version: ${{ matrix.go }}
6064
- name: Install dependencies
@@ -65,6 +69,9 @@ jobs:
6569
if [ "${{ matrix.build }}" = "linux" ]; then
6670
go build -trimpath -ldflags "-s -w" -o vpnagent vpnagent.go
6771
go build -trimpath -ldflags "-s -w" -o sslcon sslcon.go
72+
elif [ "${{ matrix.build }}" = "linux-riscv64" ]; then
73+
GOOS=linux GOARCH=riscv64 go build -trimpath -ldflags "-s -w" -o vpnagent vpnagent.go
74+
GOOS=linux GOARCH=riscv64 go build -trimpath -ldflags "-s -w" -o sslcon sslcon.go
6875
elif [ "${{ matrix.build }}" = "linux-arm64" ]; then
6976
GOOS=linux GOARCH=arm64 go build -trimpath -ldflags "-s -w" -o vpnagent vpnagent.go
7077
GOOS=linux GOARCH=arm64 go build -trimpath -ldflags "-s -w" -o sslcon sslcon.go

session/session.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ func (cSess *ConnSession) DPDTimer() {
165165
if dpdTime < 10 {
166166
dpdTime = 10
167167
}
168-
tick := time.NewTicker(time.Duration(dpdTime) * time.Second)
168+
ticker := time.NewTicker(time.Duration(dpdTime) * time.Second)
169169

170170
tlsDpd := proto.Payload{
171171
Type: 0x03,
@@ -178,7 +178,7 @@ func (cSess *ConnSession) DPDTimer() {
178178

179179
for {
180180
select {
181-
case <-tick.C:
181+
case <-ticker.C:
182182
// base.Debug("dead peer detection")
183183
select {
184184
case cSess.PayloadOutTLS <- &tlsDpd:
@@ -191,7 +191,7 @@ func (cSess *ConnSession) DPDTimer() {
191191
}
192192
}
193193
case <-cSess.CloseChan:
194-
tick.Stop()
194+
ticker.Stop()
195195
return
196196
}
197197
}
@@ -205,11 +205,11 @@ func (cSess *ConnSession) ReadDeadTimer() {
205205
}()
206206
// 避免每次 for 循环都重置读超时的时间
207207
// 这里是绝对时间,至于链接本身,服务器没有数据时 conn.Read 会阻塞,有数据时会不断判断
208-
tick := time.NewTicker(4 * time.Second)
209-
for range tick.C {
208+
ticker := time.NewTicker(4 * time.Second)
209+
for range ticker.C {
210210
select {
211211
case <-cSess.CloseChan:
212-
tick.Stop()
212+
ticker.Stop()
213213
return
214214
default:
215215
cSess.ResetTLSReadDead.Store(true)

0 commit comments

Comments
 (0)