Skip to content

Commit 393d066

Browse files
committed
Update workflow
1 parent d261f22 commit 393d066

File tree

7 files changed

+185
-17
lines changed

7 files changed

+185
-17
lines changed

.github/renovate.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"commitMessagePrefix": "[dependencies]",
4+
"extends": [
5+
"config:base",
6+
":disableRateLimiting"
7+
],
8+
"golang": {
9+
"enabled": false
10+
},
11+
"packageRules": [
12+
{
13+
"matchManagers": [
14+
"github-actions"
15+
],
16+
"groupName": "github-actions"
17+
}
18+
]
19+
}

.github/update_dependencies.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/usr/bin/env bash
22

33
PROJECTS=$(dirname "$0")/../..
4-
5-
go get -x github.com/sagernet/sing@$(git -C $PROJECTS/sing rev-parse HEAD)
4+
go get -x github.com/sagernet/$1@$(git -C $PROJECTS/$1 rev-parse HEAD)
65
go mod tidy

.github/workflows/lint.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
paths-ignore:
8+
- '**.md'
9+
- '.github/**'
10+
- '!.github/workflows/lint.yml'
11+
pull_request:
12+
branches:
13+
- dev
14+
15+
jobs:
16+
build:
17+
name: Build
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
- name: Setup Go
25+
uses: actions/setup-go@v4
26+
with:
27+
go-version: ^1.23
28+
- name: Cache go module
29+
uses: actions/cache@v3
30+
with:
31+
path: |
32+
~/go/pkg/mod
33+
key: go-${{ hashFiles('**/go.sum') }}
34+
- name: golangci-lint
35+
uses: golangci/golangci-lint-action@v3
36+
with:
37+
version: latest

.github/workflows/test.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- dev
8+
paths-ignore:
9+
- '**.md'
10+
- '.github/**'
11+
- '!.github/workflows/debug.yml'
12+
pull_request:
13+
branches:
14+
- main
15+
- dev
16+
17+
jobs:
18+
build:
19+
name: Linux
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
- name: Setup Go
27+
uses: actions/setup-go@v5
28+
with:
29+
go-version: ^1.23
30+
- name: Build
31+
run: |
32+
make test
33+
build_go120:
34+
name: Linux (Go 1.20)
35+
runs-on: ubuntu-latest
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v4
39+
with:
40+
fetch-depth: 0
41+
- name: Setup Go
42+
uses: actions/setup-go@v5
43+
with:
44+
go-version: ~1.20
45+
continue-on-error: true
46+
- name: Build
47+
run: |
48+
make test
49+
build_go121:
50+
name: Linux (Go 1.21)
51+
runs-on: ubuntu-latest
52+
steps:
53+
- name: Checkout
54+
uses: actions/checkout@v4
55+
with:
56+
fetch-depth: 0
57+
- name: Setup Go
58+
uses: actions/setup-go@v5
59+
with:
60+
go-version: ~1.21
61+
continue-on-error: true
62+
- name: Build
63+
run: |
64+
make test
65+
build_go122:
66+
name: Linux (Go 1.22)
67+
runs-on: ubuntu-latest
68+
steps:
69+
- name: Checkout
70+
uses: actions/checkout@v4
71+
with:
72+
fetch-depth: 0
73+
- name: Setup Go
74+
uses: actions/setup-go@v5
75+
with:
76+
go-version: ~1.22
77+
continue-on-error: true
78+
- name: Build
79+
run: |
80+
make test
81+
build_windows:
82+
name: Windows
83+
runs-on: windows-latest
84+
steps:
85+
- name: Checkout
86+
uses: actions/checkout@v4
87+
with:
88+
fetch-depth: 0
89+
- name: Setup Go
90+
uses: actions/setup-go@v5
91+
with:
92+
go-version: ^1.23
93+
continue-on-error: true
94+
- name: Build
95+
run: |
96+
make test
97+
build_darwin:
98+
name: macOS
99+
runs-on: macos-latest
100+
steps:
101+
- name: Checkout
102+
uses: actions/checkout@v4
103+
with:
104+
fetch-depth: 0
105+
- name: Setup Go
106+
uses: actions/setup-go@v5
107+
with:
108+
go-version: ^1.23
109+
continue-on-error: true
110+
- name: Build
111+
run: |
112+
make test

.golangci.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@ linters:
55
- govet
66
- gci
77
- staticcheck
8-
9-
run:
10-
skip-dirs:
11-
- tls
12-
- tls_compact
8+
- paralleltest
9+
- ineffassign
1310

1411
linters-settings:
1512
gci:
@@ -18,5 +15,10 @@ linters-settings:
1815
- standard
1916
- prefix(github.com/sagernet/)
2017
- default
21-
staticcheck:
22-
go: '1.20'
18+
19+
run:
20+
go: "1.23"
21+
22+
issues:
23+
exclude-dirs:
24+
- internal

Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ fmt_install:
88
go install -v github.com/daixiang0/gci@latest
99

1010
lint:
11-
GOOS=linux golangci-lint run .
12-
GOOS=android golangci-lint run .
13-
GOOS=windows golangci-lint run .
14-
GOOS=darwin golangci-lint run .
15-
GOOS=freebsd golangci-lint run .
11+
GOOS=linux golangci-lint run ./...
12+
GOOS=android golangci-lint run ./...
13+
GOOS=windows golangci-lint run ./...
14+
GOOS=darwin golangci-lint run ./...
15+
GOOS=freebsd golangci-lint run ./...
1616

1717
lint_install:
1818
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
1919

2020
test:
21-
go test -v .
21+
go test -v ./...

v3_server.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
"github.com/sagernet/sing/common/buf"
1616
"github.com/sagernet/sing/common/bufio"
1717
E "github.com/sagernet/sing/common/exceptions"
18-
"github.com/sagernet/sing/common/rw"
1918
)
2019

2120
func extractFrame(conn net.Conn) (*buf.Buffer, error) {
@@ -63,7 +62,7 @@ func verifyClientHello(frame []byte, users []User) (*User, error) {
6362
for _, user := range users {
6463
hmacSHA1Hash := hmac.New(sha1.New, []byte(user.Password))
6564
hmacSHA1Hash.Write(frame[tlsHeaderSize:hmacIndex])
66-
hmacSHA1Hash.Write(rw.ZeroBytes[:4])
65+
hmacSHA1Hash.Write([]byte{0, 0, 0, 0})
6766
hmacSHA1Hash.Write(frame[hmacIndex+hmacSize:])
6867
if hmac.Equal(frame[hmacIndex:hmacIndex+hmacSize], hmacSHA1Hash.Sum(nil)[:hmacSize]) {
6968
return &user, nil

0 commit comments

Comments
 (0)