mirror of
https://github.com/SagerNet/sing-shadowtls.git
synced 2025-04-02 19:57:35 +03:00
Update workflow
This commit is contained in:
parent
b28a0ef94f
commit
320ffbe9f0
7 changed files with 185 additions and 17 deletions
19
.github/renovate.json
vendored
Normal file
19
.github/renovate.json
vendored
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
|
"commitMessagePrefix": "[dependencies]",
|
||||||
|
"extends": [
|
||||||
|
"config:base",
|
||||||
|
":disableRateLimiting"
|
||||||
|
],
|
||||||
|
"golang": {
|
||||||
|
"enabled": false
|
||||||
|
},
|
||||||
|
"packageRules": [
|
||||||
|
{
|
||||||
|
"matchManagers": [
|
||||||
|
"github-actions"
|
||||||
|
],
|
||||||
|
"groupName": "github-actions"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
3
.github/update_dependencies.sh
vendored
3
.github/update_dependencies.sh
vendored
|
@ -1,6 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
PROJECTS=$(dirname "$0")/../..
|
PROJECTS=$(dirname "$0")/../..
|
||||||
|
go get -x github.com/sagernet/$1@$(git -C $PROJECTS/$1 rev-parse HEAD)
|
||||||
go get -x github.com/sagernet/sing@$(git -C $PROJECTS/sing rev-parse HEAD)
|
|
||||||
go mod tidy
|
go mod tidy
|
||||||
|
|
37
.github/workflows/lint.yml
vendored
Normal file
37
.github/workflows/lint.yml
vendored
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
name: Lint
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- dev
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
- '.github/**'
|
||||||
|
- '!.github/workflows/lint.yml'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- dev
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v4
|
||||||
|
with:
|
||||||
|
go-version: ^1.23
|
||||||
|
- name: Cache go module
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/go/pkg/mod
|
||||||
|
key: go-${{ hashFiles('**/go.sum') }}
|
||||||
|
- name: golangci-lint
|
||||||
|
uses: golangci/golangci-lint-action@v3
|
||||||
|
with:
|
||||||
|
version: latest
|
112
.github/workflows/test.yml
vendored
Normal file
112
.github/workflows/test.yml
vendored
Normal file
|
@ -0,0 +1,112 @@
|
||||||
|
name: test
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- dev
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
- '.github/**'
|
||||||
|
- '!.github/workflows/debug.yml'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- dev
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Linux
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: ^1.23
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
make test
|
||||||
|
build_go120:
|
||||||
|
name: Linux (Go 1.20)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: ~1.20
|
||||||
|
continue-on-error: true
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
make test
|
||||||
|
build_go121:
|
||||||
|
name: Linux (Go 1.21)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: ~1.21
|
||||||
|
continue-on-error: true
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
make test
|
||||||
|
build_go122:
|
||||||
|
name: Linux (Go 1.22)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: ~1.22
|
||||||
|
continue-on-error: true
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
make test
|
||||||
|
build_windows:
|
||||||
|
name: Windows
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: ^1.23
|
||||||
|
continue-on-error: true
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
make test
|
||||||
|
build_darwin:
|
||||||
|
name: macOS
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: ^1.23
|
||||||
|
continue-on-error: true
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
make test
|
|
@ -5,11 +5,8 @@ linters:
|
||||||
- govet
|
- govet
|
||||||
- gci
|
- gci
|
||||||
- staticcheck
|
- staticcheck
|
||||||
|
- paralleltest
|
||||||
run:
|
- ineffassign
|
||||||
skip-dirs:
|
|
||||||
- tls
|
|
||||||
- tls_compact
|
|
||||||
|
|
||||||
linters-settings:
|
linters-settings:
|
||||||
gci:
|
gci:
|
||||||
|
@ -18,5 +15,10 @@ linters-settings:
|
||||||
- standard
|
- standard
|
||||||
- prefix(github.com/sagernet/)
|
- prefix(github.com/sagernet/)
|
||||||
- default
|
- default
|
||||||
staticcheck:
|
|
||||||
go: '1.20'
|
run:
|
||||||
|
go: "1.23"
|
||||||
|
|
||||||
|
issues:
|
||||||
|
exclude-dirs:
|
||||||
|
- internal
|
||||||
|
|
12
Makefile
12
Makefile
|
@ -8,14 +8,14 @@ fmt_install:
|
||||||
go install -v github.com/daixiang0/gci@latest
|
go install -v github.com/daixiang0/gci@latest
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
GOOS=linux golangci-lint run .
|
GOOS=linux golangci-lint run ./...
|
||||||
GOOS=android golangci-lint run .
|
GOOS=android golangci-lint run ./...
|
||||||
GOOS=windows golangci-lint run .
|
GOOS=windows golangci-lint run ./...
|
||||||
GOOS=darwin golangci-lint run .
|
GOOS=darwin golangci-lint run ./...
|
||||||
GOOS=freebsd golangci-lint run .
|
GOOS=freebsd golangci-lint run ./...
|
||||||
|
|
||||||
lint_install:
|
lint_install:
|
||||||
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
||||||
|
|
||||||
test:
|
test:
|
||||||
go test -v .
|
go test -v ./...
|
|
@ -15,7 +15,6 @@ import (
|
||||||
"github.com/sagernet/sing/common/buf"
|
"github.com/sagernet/sing/common/buf"
|
||||||
"github.com/sagernet/sing/common/bufio"
|
"github.com/sagernet/sing/common/bufio"
|
||||||
E "github.com/sagernet/sing/common/exceptions"
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
"github.com/sagernet/sing/common/rw"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func extractFrame(conn net.Conn) (*buf.Buffer, error) {
|
func extractFrame(conn net.Conn) (*buf.Buffer, error) {
|
||||||
|
@ -63,7 +62,7 @@ func verifyClientHello(frame []byte, users []User) (*User, error) {
|
||||||
for _, user := range users {
|
for _, user := range users {
|
||||||
hmacSHA1Hash := hmac.New(sha1.New, []byte(user.Password))
|
hmacSHA1Hash := hmac.New(sha1.New, []byte(user.Password))
|
||||||
hmacSHA1Hash.Write(frame[tlsHeaderSize:hmacIndex])
|
hmacSHA1Hash.Write(frame[tlsHeaderSize:hmacIndex])
|
||||||
hmacSHA1Hash.Write(rw.ZeroBytes[:4])
|
hmacSHA1Hash.Write([]byte{0, 0, 0, 0})
|
||||||
hmacSHA1Hash.Write(frame[hmacIndex+hmacSize:])
|
hmacSHA1Hash.Write(frame[hmacIndex+hmacSize:])
|
||||||
if hmac.Equal(frame[hmacIndex:hmacIndex+hmacSize], hmacSHA1Hash.Sum(nil)[:hmacSize]) {
|
if hmac.Equal(frame[hmacIndex:hmacIndex+hmacSize], hmacSHA1Hash.Sum(nil)[:hmacSize]) {
|
||||||
return &user, nil
|
return &user, nil
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue