@marcel91200 / caddy Mirror · read-only / commits / f45a6de2
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 13, 00:30 UTC

go.mod: Update quic-go to v0.37.0, bump to Go 1.20 minimum (#5644)

* update quic-go to v0.37.0 * Bump to Go 1.20 * Bump golangci-lint version, yml syntax consistency * Use skip-pkg-cache workaround * Workaround needed for both? * Seeding weakrand is no longer necessary --------- Co-authored-by: Matt Holt <mholt@users.noreply.github.com> Co-authored-by: Francis Lavoie <lavofr@gmail.com>

Marten Seemann committed Jul 21, 2023 at 21:00 UTC f45a6de20dd19e82e58c85b37e03957b2203b544
13 files changed +70 -65
.github/workflows/ci.yml
+11 -6
@@ -18,17 +18,22 @@ jobs:
18 # Default is true, cancels jobs for other platforms in the matrix if one fails
19 fail-fast: false
20 matrix:
21 - os: [ ubuntu-latest, macos-latest, windows-latest ]
22 - go: [ '1.19', '1.20' ]
21 + os:
22 + - ubuntu-latest
23 + - macos-latest
24 + - windows-latest
25 + go:
26 + - '1.20'
27 + # - '1.21'
28
29 include:
30 # Set the minimum Go patch version for the given Go minor
31 # Usable via ${{ matrix.GO_SEMVER }}
27 - - go: '1.19'
28 - GO_SEMVER: '~1.19.6'
29 -
32 - go: '1.20'
31 - GO_SEMVER: '~1.20.1'
33 + GO_SEMVER: '~1.20.6'
34 +
35 + # - go: '1.21'
36 + # GO_SEMVER: '~1.21.0'
37
38 # Set some variables per OS, usable via ${{ matrix.VAR }}
39 # CADDY_BIN_PATH: the path to the compiled Caddy binary, for artifact publishing
.github/workflows/cross-build.yml
+15 -3
@@ -15,14 +15,26 @@ jobs:
15 strategy:
16 fail-fast: false
17 matrix:
18 - goos: ['android', 'linux', 'solaris', 'illumos', 'dragonfly', 'freebsd', 'openbsd', 'plan9', 'windows', 'darwin', 'netbsd']
19 - go: [ '1.20' ]
18 + goos:
19 + - 'android'
20 + - 'linux'
21 + - 'solaris'
22 + - 'illumos'
23 + - 'dragonfly'
24 + - 'freebsd'
25 + - 'openbsd'
26 + - 'plan9'
27 + - 'windows'
28 + - 'darwin'
29 + - 'netbsd'
30 + go:
31 + - '1.20'
32
33 include:
34 # Set the minimum Go patch version for the given Go minor
35 # Usable via ${{ matrix.GO_SEMVER }}
36 - go: '1.20'
25 - GO_SEMVER: '~1.20.1'
37 + GO_SEMVER: '~1.20.6'
38
39 runs-on: ubuntu-latest
40 continue-on-error: true
.github/workflows/lint.yml
+14 -3
@@ -22,20 +22,31 @@ jobs:
22 name: lint
23 strategy:
24 matrix:
25 - os: [ubuntu-latest, macos-latest, windows-latest]
25 + os:
26 + - ubuntu-latest
27 + - macos-latest
28 + - windows-latest
29 runs-on: ${{ matrix.os }}
30 steps:
31 - uses: actions/checkout@v3
32 - uses: actions/setup-go@v4
33 with:
31 - go-version: '~1.19.6'
34 + go-version: '~1.20.6'
35 check-latest: true
36
37 + # Workaround for https://github.com/golangci/golangci-lint-action/issues/135
38 + skip-pkg-cache: true
39 +
40 - name: golangci-lint
41 uses: golangci/golangci-lint-action@v3
42 with:
37 - version: v1.50
43 + version: v1.53
44 +
45 + # Workaround for https://github.com/golangci/golangci-lint-action/issues/135
46 + skip-pkg-cache: true
47 +
48 # Windows times out frequently after about 5m50s if we don't set a longer timeout.
49 args: --timeout 10m
50 +
51 # Optional: show only new issues if it's a pull request. The default value is `false`.
52 # only-new-issues: true
.github/workflows/release.yml
+5 -3
@@ -10,14 +10,16 @@ jobs:
10 name: Release
11 strategy:
12 matrix:
13 - os: [ ubuntu-latest ]
14 - go: [ '1.20' ]
13 + os:
14 + - ubuntu-latest
15 + go:
16 + - '1.20'
17
18 include:
19 # Set the minimum Go patch version for the given Go minor
20 # Usable via ${{ matrix.GO_SEMVER }}
21 - go: '1.20'
20 - GO_SEMVER: '~1.20.1'
22 + GO_SEMVER: '~1.20.6'
23
24 runs-on: ${{ matrix.os }}
25 # https://github.com/sigstore/cosign/issues/1258#issuecomment-1002251233
.github/workflows/release_published.yml
+2 -1
@@ -10,7 +10,8 @@ jobs:
10 name: Release Published
11 strategy:
12 matrix:
13 - os: [ ubuntu-latest ]
13 + os:
14 + - ubuntu-latest
15 runs-on: ${{ matrix.os }}
16
17 steps:
README.md
+1 -1
@@ -87,7 +87,7 @@ See [our online documentation](https://caddyserver.com/docs/install) for other i
87
88 Requirements:
89
90 -- [Go 1.19 or newer](https://golang.org/dl/)
90 +- [Go 1.20 or newer](https://golang.org/dl/)
91
92 ### For development
93
go.mod
+3 -4
@@ -1,6 +1,6 @@
1 module github.com/caddyserver/caddy/v2
2
3 -go 1.19
3 +go 1.20
4
5 require (
6 github.com/BurntSushi/toml v1.3.2
@@ -17,7 +17,7 @@ require (
17 github.com/mastercactapus/proxyprotocol v0.0.4
18 github.com/mholt/acmez v1.2.0
19 github.com/prometheus/client_golang v1.14.0
20 - github.com/quic-go/quic-go v0.36.2
20 + github.com/quic-go/quic-go v0.37.0
21 github.com/smallstep/certificates v0.24.2
22 github.com/smallstep/nosql v0.6.0
23 github.com/smallstep/truststore v0.12.1
@@ -57,8 +57,7 @@ require (
57 github.com/onsi/ginkgo/v2 v2.9.5 // indirect
58 github.com/pmezard/go-difflib v1.0.0 // indirect
59 github.com/quic-go/qpack v0.4.0 // indirect
60 - github.com/quic-go/qtls-go1-19 v0.3.2 // indirect
61 - github.com/quic-go/qtls-go1-20 v0.2.2 // indirect
60 + github.com/quic-go/qtls-go1-20 v0.3.0 // indirect
61 github.com/smallstep/go-attestation v0.4.4-0.20230509120429-e17291421738 // indirect
62 github.com/x448/float16 v0.8.4 // indirect
63 github.com/zeebo/blake3 v0.2.3 // indirect
go.sum
+4 -6
@@ -862,12 +862,10 @@ github.com/pseudomuto/protoc-gen-doc v1.5.0/go.mod h1:exDTOVwqpp30eV/EDPFLZy3Pwr
862 github.com/pseudomuto/protokit v0.2.0/go.mod h1:2PdH30hxVHsup8KpBTOXTBeMVhJZVio3Q8ViKSAXT0Q=
863 github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo=
864 github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A=
865 -github.com/quic-go/qtls-go1-19 v0.3.2 h1:tFxjCFcTQzK+oMxG6Zcvp4Dq8dx4yD3dDiIiyc86Z5U=
866 -github.com/quic-go/qtls-go1-19 v0.3.2/go.mod h1:ySOI96ew8lnoKPtSqx2BlI5wCpUVPT05RMAlajtnyOI=
867 -github.com/quic-go/qtls-go1-20 v0.2.2 h1:WLOPx6OY/hxtTxKV1Zrq20FtXtDEkeY00CGQm8GEa3E=
868 -github.com/quic-go/qtls-go1-20 v0.2.2/go.mod h1:JKtK6mjbAVcUTN/9jZpvLbGxvdWIKS8uT7EiStoU1SM=
869 -github.com/quic-go/quic-go v0.36.2 h1:ZX/UNQ4gvpCv2RmwdbA6lrRjF6EBm5yZ7TMoT4NQVrA=
870 -github.com/quic-go/quic-go v0.36.2/go.mod h1:zPetvwDlILVxt15n3hr3Gf/I3mDf7LpLKPhR4Ez0AZQ=
865 +github.com/quic-go/qtls-go1-20 v0.3.0 h1:NrCXmDl8BddZwO67vlvEpBTwT89bJfKYygxv4HQvuDk=
866 +github.com/quic-go/qtls-go1-20 v0.3.0/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k=
867 +github.com/quic-go/quic-go v0.37.0 h1:wf/Ym2yeWi98oQn4ahiBSqdnaXVxNQGj2oBQFgiVChc=
868 +github.com/quic-go/quic-go v0.37.0/go.mod h1:XtCUOCALTTWbPyd0IxFfHf6h0sEMubRFvEYHl3QxKw8=
869 github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
870 github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
871 github.com/rogpeppe/fastuuid v1.1.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
modules/caddyhttp/caddyauth/basicauth.go
-3
@@ -23,7 +23,6 @@ import (
23 "net/http"
24 "strings"
25 "sync"
26 - "time"
26
27 "github.com/caddyserver/caddy/v2"
28 "golang.org/x/sync/singleflight"
@@ -31,8 +30,6 @@ import (
30
31 func init() {
32 caddy.RegisterModule(HTTPBasicAuth{})
34 -
35 - weakrand.Seed(time.Now().UnixNano())
33 }
34
35 // HTTPBasicAuth facilitates HTTP basic authentication.
modules/caddyhttp/errors.go
-5
@@ -20,15 +20,10 @@ import (
20 "path"
21 "runtime"
22 "strings"
23 - "time"
23
24 "github.com/caddyserver/caddy/v2"
25 )
26
28 -func init() {
29 - weakrand.Seed(time.Now().UnixNano())
30 -}
31 -
27 // Error is a convenient way for a Handler to populate the
28 // essential fields of a HandlerError. If err is itself a
29 // HandlerError, then any essential fields that are not
modules/caddyhttp/fileserver/staticfiles.go
-3
@@ -29,7 +29,6 @@ import (
29 "runtime"
30 "strconv"
31 "strings"
32 - "time"
32
33 "github.com/caddyserver/caddy/v2"
34 "github.com/caddyserver/caddy/v2/modules/caddyhttp"
@@ -38,8 +37,6 @@ import (
37 )
38
39 func init() {
41 - weakrand.Seed(time.Now().UnixNano())
42 -
40 caddy.RegisterModule(FileServer{})
41 }
42
modules/caddyhttp/reverseproxy/reverseproxy.go
+15 -24
@@ -27,7 +27,6 @@ import (
27 "net/netip"
28 "net/textproto"
29 "net/url"
30 - "runtime"
30 "strconv"
31 "strings"
32 "sync"
@@ -43,13 +42,7 @@ import (
42 "golang.org/x/net/http/httpguts"
43 )
44
46 -var supports1xx bool
47 -
45 func init() {
49 - // Caddy requires at least Go 1.18, but Early Hints requires Go 1.19; thus we can simply check for 1.18 in version string
50 - // TODO: remove this once our minimum Go version is 1.19
51 - supports1xx = !strings.Contains(runtime.Version(), "go1.18")
52 -
46 caddy.RegisterModule(Handler{})
47 }
48
@@ -752,25 +745,23 @@ func (h *Handler) reverseProxy(rw http.ResponseWriter, req *http.Request, origRe
745 server := req.Context().Value(caddyhttp.ServerCtxKey).(*caddyhttp.Server)
746 shouldLogCredentials := server.Logs != nil && server.Logs.ShouldLogCredentials
747
755 - if supports1xx {
756 - // Forward 1xx status codes, backported from https://github.com/golang/go/pull/53164
757 - trace := &httptrace.ClientTrace{
758 - Got1xxResponse: func(code int, header textproto.MIMEHeader) error {
759 - h := rw.Header()
760 - copyHeader(h, http.Header(header))
761 - rw.WriteHeader(code)
762 -
763 - // Clear headers coming from the backend
764 - // (it's not automatically done by ResponseWriter.WriteHeader() for 1xx responses)
765 - for k := range header {
766 - delete(h, k)
767 - }
748 + // Forward 1xx status codes, backported from https://github.com/golang/go/pull/53164
749 + trace := &httptrace.ClientTrace{
750 + Got1xxResponse: func(code int, header textproto.MIMEHeader) error {
751 + h := rw.Header()
752 + copyHeader(h, http.Header(header))
753 + rw.WriteHeader(code)
754 +
755 + // Clear headers coming from the backend
756 + // (it's not automatically done by ResponseWriter.WriteHeader() for 1xx responses)
757 + for k := range header {
758 + delete(h, k)
759 + }
760
769 - return nil
770 - },
771 - }
772 - req = req.WithContext(httptrace.WithClientTrace(req.Context(), trace))
761 + return nil
762 + },
763 }
764 + req = req.WithContext(httptrace.WithClientTrace(req.Context(), trace))
765
766 // if FlushInterval is explicitly configured to -1 (i.e. flush continuously to achieve
767 // low-latency streaming), don't let the transport cancel the request if the client
modules/caddyhttp/reverseproxy/selectionpolicies.go
-3
@@ -27,7 +27,6 @@ import (
27 "strconv"
28 "strings"
29 "sync/atomic"
30 - "time"
30
31 "github.com/caddyserver/caddy/v2"
32 "github.com/caddyserver/caddy/v2/caddyconfig"
@@ -48,8 +47,6 @@ func init() {
47 caddy.RegisterModule(QueryHashSelection{})
48 caddy.RegisterModule(HeaderHashSelection{})
49 caddy.RegisterModule(CookieHashSelection{})
51 -
52 - weakrand.Seed(time.Now().UTC().UnixNano())
50 }
51
52 // RandomSelection is a policy that selects