Skip to content

Commit ff17e8b

Browse files
rootqwencoder
andcommitted
Merge upstream changes from klzgrad's repository
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2 parents 97c50f4 + d62c80d commit ff17e8b

19 files changed

Lines changed: 1645 additions & 258 deletions

.github/dependabot.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "gomod"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
- package-ecosystem: "github-actions"
8+
directory: "/"
9+
schedule:
10+
interval: "daily"
11+
- package-ecosystem: "docker"
12+
directory: "/"
13+
schedule:
14+
interval: "daily"

.github/workflows/build.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Build
2+
on:
3+
push:
4+
branches: [naive]
5+
paths-ignore: [README.md]
6+
release:
7+
types: [published]
8+
defaults:
9+
run:
10+
shell: bash
11+
jobs:
12+
build_caddy_with_naive:
13+
runs-on: ubuntu-22.04
14+
env:
15+
BUNDLE: caddy-forwardproxy-naive
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-go@v5
19+
with:
20+
go-version: ^1.21.9
21+
- run: go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
22+
- run: ~/go/bin/xcaddy build --with github.com/caddyserver/forwardproxy@master=$PWD
23+
- name: Pack naiveproxy assets
24+
run: |
25+
mkdir ${{ env.BUNDLE }}
26+
cp caddy LICENSE README.md ${{ env.BUNDLE }}
27+
tar cJf ${{ env.BUNDLE }}.tar.xz ${{ env.BUNDLE }}
28+
openssl sha256 ./caddy >sha256sum.txt
29+
echo "SHA256SUM=$(cut -d' ' -f2 sha256sum.txt)" >>$GITHUB_ENV
30+
- uses: actions/upload-artifact@v4
31+
with:
32+
name: ${{ env.BUNDLE }}.tar.xz caddy executable sha256 ${{ env.SHA256SUM }}
33+
path: sha256sum.txt
34+
- name: Upload caddy assets
35+
if: ${{ github.event_name == 'release' }}
36+
run: gh release upload "${GITHUB_REF##*/}" ${{ env.BUNDLE }}.tar.xz --clobber
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/lint.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- main
8+
paths-ignore:
9+
- "**.md"
10+
pull_request:
11+
branches:
12+
- master
13+
- main
14+
paths-ignore:
15+
- "**.md"
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
# From https://github.com/golangci/golangci-lint-action
22+
golangci:
23+
permissions:
24+
contents: read # for actions/checkout to fetch code
25+
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
26+
name: lint
27+
strategy:
28+
matrix:
29+
os:
30+
- linux
31+
- windows
32+
33+
include:
34+
- os: linux
35+
OS_LABEL: ubuntu-latest
36+
37+
- os: windows
38+
OS_LABEL: windows-latest
39+
runs-on: ${{ matrix.OS_LABEL }}
40+
steps:
41+
- uses: actions/checkout@v4
42+
- uses: actions/setup-go@v5
43+
with:
44+
go-version: '~1.22.0'
45+
check-latest: true
46+
cache: false
47+
48+
- name: golangci-lint
49+
uses: golangci/golangci-lint-action@v6
50+
with:
51+
version: v1.55.2
52+
args: --timeout 10m
53+
54+
# govulncheck:
55+
# runs-on: ubuntu-latest
56+
# steps:
57+
# - name: govulncheck
58+
# uses: golang/govulncheck-action@v1
59+
# with:
60+
# go-version-input: '~1.22.0'
61+
# check-latest: true

.github/workflows/tests.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: "Tests"
2+
3+
on:
4+
push:
5+
branches:
6+
- "master"
7+
- "main"
8+
paths-ignore:
9+
- "**.md"
10+
pull_request:
11+
branches:
12+
- "*"
13+
paths-ignore:
14+
- "**.md"
15+
16+
jobs:
17+
Tests:
18+
strategy:
19+
matrix:
20+
go-version:
21+
- 1.21.x
22+
- 1.22.x
23+
platform:
24+
- ubuntu-latest
25+
- windows-latest
26+
runs-on: ${{ matrix.platform }}
27+
steps:
28+
- name: Fetch Repository
29+
uses: actions/checkout@v4
30+
- name: Install Go
31+
uses: actions/setup-go@v5
32+
with:
33+
go-version: '${{ matrix.go-version }}'
34+
- name: Run test
35+
run: go test -v -race ./...

.golanci-lint.yml

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
linters-settings:
2+
errcheck:
3+
ignore: fmt:.*,go.uber.org/zap/zapcore:^Add.*
4+
ignoretests: true
5+
gci:
6+
sections:
7+
- standard # Standard section: captures all standard packages.
8+
- default # Default section: contains all imports that could not be matched to another section type.
9+
- prefix(github.com/caddyserver/caddy/v2/cmd) # ensure that this is always at the top and always has a line break.
10+
- prefix(github.com/caddyserver/caddy) # Custom section: groups all imports with the specified Prefix.
11+
# Skip generated files.
12+
# Default: true
13+
skip-generated: true
14+
# Enable custom order of sections.
15+
# If `true`, make the section order the same as the order of `sections`.
16+
# Default: false
17+
custom-order: true
18+
exhaustive:
19+
ignore-enum-types: reflect.Kind|svc.Cmd
20+
21+
linters:
22+
disable-all: true
23+
enable:
24+
- asasalint
25+
- asciicheck
26+
- bidichk
27+
- bodyclose
28+
- decorder
29+
- dogsled
30+
- dupl
31+
- dupword
32+
- durationcheck
33+
- errcheck
34+
- errname
35+
- exhaustive
36+
- exportloopref
37+
- gci
38+
- gofmt
39+
- goimports
40+
- gofumpt
41+
- gosec
42+
- gosimple
43+
- govet
44+
- ineffassign
45+
- importas
46+
- misspell
47+
- prealloc
48+
- promlinter
49+
- sloglint
50+
- sqlclosecheck
51+
- staticcheck
52+
- tenv
53+
- testableexamples
54+
- testifylint
55+
- tparallel
56+
- typecheck
57+
- unconvert
58+
- unused
59+
- wastedassign
60+
- whitespace
61+
- zerologlint
62+
# these are implicitly disabled:
63+
# - containedctx
64+
# - contextcheck
65+
# - cyclop
66+
# - depguard
67+
# - errchkjson
68+
# - errorlint
69+
# - exhaustruct
70+
# - execinquery
71+
# - exhaustruct
72+
# - forbidigo
73+
# - forcetypeassert
74+
# - funlen
75+
# - ginkgolinter
76+
# - gocheckcompilerdirectives
77+
# - gochecknoglobals
78+
# - gochecknoinits
79+
# - gochecksumtype
80+
# - gocognit
81+
# - goconst
82+
# - gocritic
83+
# - gocyclo
84+
# - godot
85+
# - godox
86+
# - goerr113
87+
# - goheader
88+
# - gomnd
89+
# - gomoddirectives
90+
# - gomodguard
91+
# - goprintffuncname
92+
# - gosmopolitan
93+
# - grouper
94+
# - inamedparam
95+
# - interfacebloat
96+
# - ireturn
97+
# - lll
98+
# - loggercheck
99+
# - maintidx
100+
# - makezero
101+
# - mirror
102+
# - musttag
103+
# - nakedret
104+
# - nestif
105+
# - nilerr
106+
# - nilnil
107+
# - nlreturn
108+
# - noctx
109+
# - nolintlint
110+
# - nonamedreturns
111+
# - nosprintfhostport
112+
# - paralleltest
113+
# - perfsprint
114+
# - predeclared
115+
# - protogetter
116+
# - reassign
117+
# - revive
118+
# - rowserrcheck
119+
# - stylecheck
120+
# - tagalign
121+
# - tagliatelle
122+
# - testpackage
123+
# - thelper
124+
# - unparam
125+
# - usestdlibvars
126+
# - varnamelen
127+
# - wrapcheck
128+
# - wsl
129+
130+
run:
131+
# default concurrency is a available CPU number.
132+
# concurrency: 4 # explicitly omit this value to fully utilize available resources.
133+
deadline: 5m
134+
issues-exit-code: 1
135+
tests: false
136+
137+
# output configuration options
138+
output:
139+
format: 'colored-line-number'
140+
print-issued-lines: true
141+
print-linter-name: true
142+
143+
issues:
144+
exclude-rules:
145+
# we aren't calling unknown URL
146+
- text: 'G107' # G107: Url provided to HTTP request as taint input
147+
linters:
148+
- gosec
149+
# as a web server that's expected to handle any template, this is totally in the hands of the user.
150+
- text: 'G203' # G203: Use of unescaped data in HTML templates
151+
linters:
152+
- gosec
153+
# we're shelling out to known commands, not relying on user-defined input.
154+
- text: 'G204' # G204: Audit use of command execution
155+
linters:
156+
- gosec
157+
# the choice of weakrand is deliberate, hence the named import "weakrand"
158+
- path: modules/caddyhttp/reverseproxy/selectionpolicies.go
159+
text: 'G404' # G404: Insecure random number source (rand)
160+
linters:
161+
- gosec
162+
- path: modules/caddyhttp/reverseproxy/streaming.go
163+
text: 'G404' # G404: Insecure random number source (rand)
164+
linters:
165+
- gosec
166+
- path: modules/logging/filters.go
167+
linters:
168+
- dupl

.golangci.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

.travis.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)