@marcel91200 / caddy Mirror · read-only / commits / d6f86ccc
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 12, 23:15 UTC

ci: use gci linter (#5708)

* use gofmput to format code * use gci to format imports * reconfigure gci * linter autofixes * rearrange imports a little * export GOOS=windows golangci-lint run ./... --fix

Jacob Gadikian committed Aug 14, 2023 at 23:41 UTC d6f86cccf5fa5b4eb30141da390cf2439746c5da
77 files changed +225 -134
.github/workflows/lint.yml
+4 -4
@@ -17,12 +17,12 @@ jobs:
17 # From https://github.com/golangci/golangci-lint-action
18 golangci:
19 permissions:
20 - contents: read # for actions/checkout to fetch code
21 - pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
20 + contents: read # for actions/checkout to fetch code
21 + pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
22 name: lint
23 strategy:
24 matrix:
25 - os:
25 + os:
26 - ubuntu-latest
27 - macos-latest
28 - windows-latest
@@ -40,7 +40,7 @@ jobs:
40 - name: golangci-lint
41 uses: golangci/golangci-lint-action@v3
42 with:
43 - version: v1.53
43 + version: v1.54
44
45 # Workaround for https://github.com/golangci/golangci-lint-action/issues/135
46 skip-pkg-cache: true
.golangci.yml
+19 -5
@@ -2,12 +2,26 @@ 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
19 linters:
20 disable-all: true
21 enable:
22 - bodyclose
23 - errcheck
24 + - gci
25 - gofumpt
26 - gosec
27 - gosimple
@@ -76,23 +90,23 @@ output:
90 issues:
91 exclude-rules:
92 # we aren't calling unknown URL
79 - - text: "G107" # G107: Url provided to HTTP request as taint input
93 + - text: 'G107' # G107: Url provided to HTTP request as taint input
94 linters:
95 - gosec
96 # as a web server that's expected to handle any template, this is totally in the hands of the user.
83 - - text: "G203" # G203: Use of unescaped data in HTML templates
97 + - text: 'G203' # G203: Use of unescaped data in HTML templates
98 linters:
99 - gosec
100 # we're shelling out to known commands, not relying on user-defined input.
87 - - text: "G204" # G204: Audit use of command execution
101 + - text: 'G204' # G204: Audit use of command execution
102 linters:
103 - gosec
104 # the choice of weakrand is deliberate, hence the named import "weakrand"
105 - path: modules/caddyhttp/reverseproxy/selectionpolicies.go
92 - text: "G404" # G404: Insecure random number source (rand)
106 + text: 'G404' # G404: Insecure random number source (rand)
107 linters:
108 - gosec
109 - path: modules/caddyhttp/reverseproxy/streaming.go
96 - text: "G404" # G404: Insecure random number source (rand)
110 + text: 'G404' # G404: Insecure random number source (rand)
111 linters:
112 - gosec
caddy.go
+2 -1
@@ -34,10 +34,11 @@ import (
34 "sync/atomic"
35 "time"
36
37 - "github.com/caddyserver/caddy/v2/notify"
37 "github.com/caddyserver/certmagic"
38 "github.com/google/uuid"
39 "go.uber.org/zap"
40 +
41 + "github.com/caddyserver/caddy/v2/notify"
42 )
43
44 // Config is the top (or beginning) of the Caddy configuration structure.
caddyconfig/caddyfile/importargs.go
+2 -1
@@ -19,8 +19,9 @@ import (
19 "strconv"
20 "strings"
21
22 - "github.com/caddyserver/caddy/v2"
22 "go.uber.org/zap"
23 +
24 + "github.com/caddyserver/caddy/v2"
25 )
26
27 // parseVariadic determines if the token is a variadic placeholder,
caddyconfig/caddyfile/parse.go
+2 -1
@@ -22,8 +22,9 @@ import (
22 "path/filepath"
23 "strings"
24
25 - "github.com/caddyserver/caddy/v2"
25 "go.uber.org/zap"
26 +
27 + "github.com/caddyserver/caddy/v2"
28 )
29
30 // Parse parses the input just enough to group tokens, in
caddyconfig/httpcaddyfile/addresses.go
+2 -1
@@ -24,10 +24,11 @@ import (
24 "strings"
25 "unicode"
26
27 + "github.com/caddyserver/certmagic"
28 +
29 "github.com/caddyserver/caddy/v2"
30 "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
31 "github.com/caddyserver/caddy/v2/modules/caddyhttp"
30 - "github.com/caddyserver/certmagic"
32 )
33
34 // mapAddressToServerBlocks returns a map of listener address to list of server
caddyconfig/httpcaddyfile/builtins.go
+4 -3
@@ -26,14 +26,15 @@ import (
26 "strings"
27 "time"
28
29 + "github.com/caddyserver/certmagic"
30 + "github.com/mholt/acmez/acme"
31 + "go.uber.org/zap/zapcore"
32 +
33 "github.com/caddyserver/caddy/v2"
34 "github.com/caddyserver/caddy/v2/caddyconfig"
35 "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
36 "github.com/caddyserver/caddy/v2/modules/caddyhttp"
37 "github.com/caddyserver/caddy/v2/modules/caddytls"
34 - "github.com/caddyserver/certmagic"
35 - "github.com/mholt/acmez/acme"
36 - "go.uber.org/zap/zapcore"
38 )
39
40 func init() {
caddyconfig/httpcaddyfile/httptype.go
+3 -2
@@ -23,14 +23,15 @@ import (
23 "strconv"
24 "strings"
25
26 + "go.uber.org/zap"
27 + "golang.org/x/exp/slices"
28 +
29 "github.com/caddyserver/caddy/v2"
30 "github.com/caddyserver/caddy/v2/caddyconfig"
31 "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
32 "github.com/caddyserver/caddy/v2/modules/caddyhttp"
33 "github.com/caddyserver/caddy/v2/modules/caddypki"
34 "github.com/caddyserver/caddy/v2/modules/caddytls"
32 - "go.uber.org/zap"
33 - "golang.org/x/exp/slices"
35 )
36
37 func init() {
caddyconfig/httpcaddyfile/options.go
+3 -2
@@ -17,12 +17,13 @@ package httpcaddyfile
17 import (
18 "strconv"
19
20 + "github.com/caddyserver/certmagic"
21 + "github.com/mholt/acmez/acme"
22 +
23 "github.com/caddyserver/caddy/v2"
24 "github.com/caddyserver/caddy/v2/caddyconfig"
25 "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
26 "github.com/caddyserver/caddy/v2/modules/caddytls"
24 - "github.com/caddyserver/certmagic"
25 - "github.com/mholt/acmez/acme"
27 )
28
29 func init() {
caddyconfig/httpcaddyfile/serveroptions.go
+2 -1
@@ -18,11 +18,12 @@ import (
18 "encoding/json"
19 "fmt"
20
21 + "github.com/dustin/go-humanize"
22 +
23 "github.com/caddyserver/caddy/v2"
24 "github.com/caddyserver/caddy/v2/caddyconfig"
25 "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
26 "github.com/caddyserver/caddy/v2/modules/caddyhttp"
25 - "github.com/dustin/go-humanize"
27 )
28
29 // serverOptions collects server config overrides parsed from Caddyfile global options
caddyconfig/httpcaddyfile/tlsapp.go
+3 -2
@@ -23,12 +23,13 @@ import (
23 "strconv"
24 "strings"
25
26 + "github.com/caddyserver/certmagic"
27 + "github.com/mholt/acmez/acme"
28 +
29 "github.com/caddyserver/caddy/v2"
30 "github.com/caddyserver/caddy/v2/caddyconfig"
31 "github.com/caddyserver/caddy/v2/modules/caddyhttp"
32 "github.com/caddyserver/caddy/v2/modules/caddytls"
30 - "github.com/caddyserver/certmagic"
31 - "github.com/mholt/acmez/acme"
33 )
34
35 func (st ServerType) buildTLSApp(
caddytest/caddytest.go
+2 -1
@@ -22,9 +22,10 @@ import (
22 "time"
23
24 "github.com/aryann/difflib"
25 - "github.com/caddyserver/caddy/v2/caddyconfig"
25 +
26 caddycmd "github.com/caddyserver/caddy/v2/cmd"
27
28 + "github.com/caddyserver/caddy/v2/caddyconfig"
29 // plug in Caddy modules here
30 _ "github.com/caddyserver/caddy/v2/modules/standard"
31 )
cmd/commandfuncs.go
+2 -1
@@ -33,11 +33,12 @@ import (
33 "strings"
34
35 "github.com/aryann/difflib"
36 + "go.uber.org/zap"
37 +
38 "github.com/caddyserver/caddy/v2"
39 "github.com/caddyserver/caddy/v2/caddyconfig"
40 "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
41 "github.com/caddyserver/caddy/v2/internal"
40 - "go.uber.org/zap"
42 )
43
44 func cmdStart(fl Flags) (int, error) {
cmd/commands.go
+2 -1
@@ -21,9 +21,10 @@ import (
21 "regexp"
22 "strings"
23
24 - "github.com/caddyserver/caddy/v2"
24 "github.com/spf13/cobra"
25 "github.com/spf13/cobra/doc"
26 +
27 + "github.com/caddyserver/caddy/v2"
28 )
29
30 // Command represents a subcommand. Name, Func,
cmd/main.go
+3 -2
@@ -30,11 +30,12 @@ import (
30 "strings"
31 "time"
32
33 - "github.com/caddyserver/caddy/v2"
34 - "github.com/caddyserver/caddy/v2/caddyconfig"
33 "github.com/caddyserver/certmagic"
34 "github.com/spf13/pflag"
35 "go.uber.org/zap"
36 +
37 + "github.com/caddyserver/caddy/v2"
38 + "github.com/caddyserver/caddy/v2/caddyconfig"
39 )
40
41 func init() {
cmd/packagesfuncs.go
+2 -1
@@ -27,8 +27,9 @@ import (
27 "runtime/debug"
28 "strings"
29
30 - "github.com/caddyserver/caddy/v2"
30 "go.uber.org/zap"
31 +
32 + "github.com/caddyserver/caddy/v2"
33 )
34
35 func cmdUpgrade(fl Flags) (int, error) {
cmd/storagefuncs.go
+2 -1
@@ -23,8 +23,9 @@ import (
23 "io"
24 "os"
25
26 - "github.com/caddyserver/caddy/v2"
26 "github.com/caddyserver/certmagic"
27 +
28 + "github.com/caddyserver/caddy/v2"
29 )
30
31 type storVal struct {
listeners.go
+2 -1
@@ -31,10 +31,11 @@ import (
31 "syscall"
32 "time"
33
34 - "github.com/caddyserver/caddy/v2/internal"
34 "github.com/quic-go/quic-go"
35 "github.com/quic-go/quic-go/http3"
36 "go.uber.org/zap"
37 +
38 + "github.com/caddyserver/caddy/v2/internal"
39 )
40
41 // NetworkAddress represents one or more network addresses.
metrics.go
+2 -1
@@ -3,10 +3,11 @@ package caddy
3 import (
4 "net/http"
5
6 - "github.com/caddyserver/caddy/v2/internal/metrics"
6 "github.com/prometheus/client_golang/prometheus"
7 "github.com/prometheus/client_golang/prometheus/collectors"
8 "github.com/prometheus/client_golang/prometheus/promauto"
9 +
10 + "github.com/caddyserver/caddy/v2/internal/metrics"
11 )
12
13 // define and register the metrics used in this package.
modules/caddyevents/app.go
+2 -1
@@ -22,9 +22,10 @@ import (
22 "strings"
23 "time"
24
25 - "github.com/caddyserver/caddy/v2"
25 "github.com/google/uuid"
26 "go.uber.org/zap"
27 +
28 + "github.com/caddyserver/caddy/v2"
29 )
30
31 func init() {
modules/caddyhttp/app.go
+4 -3
@@ -26,12 +26,13 @@ import (
26 "sync"
27 "time"
28
29 - "github.com/caddyserver/caddy/v2"
30 - "github.com/caddyserver/caddy/v2/modules/caddyevents"
31 - "github.com/caddyserver/caddy/v2/modules/caddytls"
29 "go.uber.org/zap"
30 "golang.org/x/net/http2"
31 "golang.org/x/net/http2/h2c"
32 +
33 + "github.com/caddyserver/caddy/v2"
34 + "github.com/caddyserver/caddy/v2/modules/caddyevents"
35 + "github.com/caddyserver/caddy/v2/modules/caddytls"
36 )
37
38 func init() {
modules/caddyhttp/autohttps.go
+3 -2
@@ -20,10 +20,11 @@ import (
20 "strconv"
21 "strings"
22
23 - "github.com/caddyserver/caddy/v2"
24 - "github.com/caddyserver/caddy/v2/modules/caddytls"
23 "github.com/caddyserver/certmagic"
24 "go.uber.org/zap"
25 +
26 + "github.com/caddyserver/caddy/v2"
27 + "github.com/caddyserver/caddy/v2/modules/caddytls"
28 )
29
30 // AutoHTTPSConfig is used to disable automatic HTTPS
modules/caddyhttp/caddyauth/basicauth.go
+2 -1
@@ -24,8 +24,9 @@ import (
24 "strings"
25 "sync"
26
27 - "github.com/caddyserver/caddy/v2"
27 "golang.org/x/sync/singleflight"
28 +
29 + "github.com/caddyserver/caddy/v2"
30 )
31
32 func init() {
modules/caddyhttp/caddyauth/caddyauth.go
+2 -1
@@ -18,9 +18,10 @@ import (
18 "fmt"
19 "net/http"
20
21 + "go.uber.org/zap"
22 +
23 "github.com/caddyserver/caddy/v2"
24 "github.com/caddyserver/caddy/v2/modules/caddyhttp"
23 - "go.uber.org/zap"
25 )
26
27 func init() {
modules/caddyhttp/caddyauth/command.go
+4 -2
@@ -22,10 +22,12 @@ import (
22 "os"
23 "os/signal"
24
25 - "github.com/caddyserver/caddy/v2"
26 - caddycmd "github.com/caddyserver/caddy/v2/cmd"
25 "github.com/spf13/cobra"
26 "golang.org/x/term"
27 +
28 + caddycmd "github.com/caddyserver/caddy/v2/cmd"
29 +
30 + "github.com/caddyserver/caddy/v2"
31 )
32
33 func init() {
modules/caddyhttp/caddyauth/hashes.go
+2 -1
@@ -18,9 +18,10 @@ import (
18 "crypto/subtle"
19 "encoding/base64"
20
21 - "github.com/caddyserver/caddy/v2"
21 "golang.org/x/crypto/bcrypt"
22 "golang.org/x/crypto/scrypt"
23 +
24 + "github.com/caddyserver/caddy/v2"
25 )
26
27 func init() {
modules/caddyhttp/celmatcher.go
+3 -2
@@ -25,8 +25,6 @@ import (
25 "strings"
26 "time"
27
28 - "github.com/caddyserver/caddy/v2"
29 - "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
28 "github.com/google/cel-go/cel"
29 "github.com/google/cel-go/common"
30 "github.com/google/cel-go/common/operators"
@@ -39,6 +37,9 @@ import (
37 "github.com/google/cel-go/parser"
38 "go.uber.org/zap"
39 exprpb "google.golang.org/genproto/googleapis/api/expr/v1alpha1"
40 +
41 + "github.com/caddyserver/caddy/v2"
42 + "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
43 )
44
45 func init() {
modules/caddyhttp/encode/gzip/gzip.go
+2 -1
@@ -18,10 +18,11 @@ import (
18 "fmt"
19 "strconv"
20
21 + "github.com/klauspost/compress/gzip"
22 +
23 "github.com/caddyserver/caddy/v2"
24 "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
25 "github.com/caddyserver/caddy/v2/modules/caddyhttp/encode"
24 - "github.com/klauspost/compress/gzip"
26 )
27
28 func init() {
modules/caddyhttp/encode/zstd/zstd.go
+2 -1
@@ -15,10 +15,11 @@
15 package caddyzstd
16
17 import (
18 + "github.com/klauspost/compress/zstd"
19 +
20 "github.com/caddyserver/caddy/v2"
21 "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
22 "github.com/caddyserver/caddy/v2/modules/caddyhttp/encode"
21 - "github.com/klauspost/compress/zstd"
23 )
24
25 func init() {
modules/caddyhttp/fileserver/browse.go
+2 -1
@@ -29,10 +29,11 @@ import (
29 "sync"
30 "text/template"
31
32 + "go.uber.org/zap"
33 +
34 "github.com/caddyserver/caddy/v2"
35 "github.com/caddyserver/caddy/v2/modules/caddyhttp"
36 "github.com/caddyserver/caddy/v2/modules/caddyhttp/templates"
35 - "go.uber.org/zap"
37 )
38
39 //go:embed browse.html
modules/caddyhttp/fileserver/browsetplcontext.go
+3 -2
@@ -25,10 +25,11 @@ import (
25 "strings"
26 "time"
27
28 - "github.com/caddyserver/caddy/v2"
29 - "github.com/caddyserver/caddy/v2/modules/caddyhttp"
28 "github.com/dustin/go-humanize"
29 "go.uber.org/zap"
30 +
31 + "github.com/caddyserver/caddy/v2"
32 + "github.com/caddyserver/caddy/v2/modules/caddyhttp"
33 )
34
35 func (fsrv *FileServer) directoryListing(ctx context.Context, entries []fs.DirEntry, canGoUp bool, root, urlPath string, repl *caddy.Replacer) *browseTemplateContext {
modules/caddyhttp/fileserver/command.go
+6 -4
@@ -22,14 +22,16 @@ import (
22 "strconv"
23 "time"
24
25 + "github.com/caddyserver/certmagic"
26 + "github.com/spf13/cobra"
27 + "go.uber.org/zap"
28 +
29 + caddycmd "github.com/caddyserver/caddy/v2/cmd"
30 +
31 "github.com/caddyserver/caddy/v2"
32 "github.com/caddyserver/caddy/v2/caddyconfig"
27 - caddycmd "github.com/caddyserver/caddy/v2/cmd"
33 "github.com/caddyserver/caddy/v2/modules/caddyhttp"
34 caddytpl "github.com/caddyserver/caddy/v2/modules/caddyhttp/templates"
30 - "github.com/caddyserver/certmagic"
31 - "github.com/spf13/cobra"
32 - "go.uber.org/zap"
35 )
36
37 func init() {
modules/caddyhttp/fileserver/matcher.go
+4 -3
@@ -26,9 +26,6 @@ import (
26 "strconv"
27 "strings"
28
29 - "github.com/caddyserver/caddy/v2"
30 - "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
31 - "github.com/caddyserver/caddy/v2/modules/caddyhttp"
29 "github.com/google/cel-go/cel"
30 "github.com/google/cel-go/common"
31 "github.com/google/cel-go/common/operators"
@@ -36,6 +33,10 @@ import (
33 "github.com/google/cel-go/parser"
34 "go.uber.org/zap"
35 exprpb "google.golang.org/genproto/googleapis/api/expr/v1alpha1"
36 +
37 + "github.com/caddyserver/caddy/v2"
38 + "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
39 + "github.com/caddyserver/caddy/v2/modules/caddyhttp"
40 )
41
42 func init() {
modules/caddyhttp/fileserver/staticfiles.go
+2 -1
@@ -30,10 +30,11 @@ import (
30 "strconv"
31 "strings"
32
33 + "go.uber.org/zap"
34 +
35 "github.com/caddyserver/caddy/v2"
36 "github.com/caddyserver/caddy/v2/modules/caddyhttp"
37 "github.com/caddyserver/caddy/v2/modules/caddyhttp/encode"
36 - "go.uber.org/zap"
38 )
39
40 func init() {
modules/caddyhttp/ip_matchers.go
+3 -2
@@ -23,11 +23,12 @@ import (
23 "reflect"
24 "strings"
25
26 - "github.com/caddyserver/caddy/v2"
27 - "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
26 "github.com/google/cel-go/cel"
27 "github.com/google/cel-go/common/types/ref"
28 "go.uber.org/zap"
29 +
30 + "github.com/caddyserver/caddy/v2"
31 + "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
32 )
33
34 // MatchRemoteIP matches requests by the remote IP address,
modules/caddyhttp/logging.go
+2 -1
@@ -20,9 +20,10 @@ import (
20 "net/http"
21 "strings"
22
23 - "github.com/caddyserver/caddy/v2"
23 "go.uber.org/zap"
24 "go.uber.org/zap/zapcore"
25 +
26 + "github.com/caddyserver/caddy/v2"
27 )
28
29 // ServerLogConfig describes a server's logging configuration. If
modules/caddyhttp/matchers.go
+3 -2
@@ -30,11 +30,12 @@ import (
30 "strconv"
31 "strings"
32
33 - "github.com/caddyserver/caddy/v2"
34 - "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
33 "github.com/google/cel-go/cel"
34 "github.com/google/cel-go/common/types"
35 "github.com/google/cel-go/common/types/ref"
36 +
37 + "github.com/caddyserver/caddy/v2"
38 + "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
39 )
40
41 type (
modules/caddyhttp/metrics.go
+2 -1
@@ -6,9 +6,10 @@ import (
6 "sync"
7 "time"
8
9 - "github.com/caddyserver/caddy/v2/internal/metrics"
9 "github.com/prometheus/client_golang/prometheus"
10 "github.com/prometheus/client_golang/prometheus/promauto"
11 +
12 + "github.com/caddyserver/caddy/v2/internal/metrics"
13 )
14
15 // Metrics configures metrics observations.
modules/caddyhttp/proxyprotocol/listenerwrapper.go
+2 -1
@@ -19,8 +19,9 @@ import (
19 "net"
20 "time"
21
22 - "github.com/caddyserver/caddy/v2"
22 "github.com/mastercactapus/proxyprotocol"
23 +
24 + "github.com/caddyserver/caddy/v2"
25 )
26
27 // ListenerWrapper provides PROXY protocol support to Caddy by implementing
modules/caddyhttp/push/handler.go
+2 -1
@@ -19,10 +19,11 @@ import (
19 "net/http"
20 "strings"
21
22 + "go.uber.org/zap"
23 +
24 "github.com/caddyserver/caddy/v2"
25 "github.com/caddyserver/caddy/v2/modules/caddyhttp"
26 "github.com/caddyserver/caddy/v2/modules/caddyhttp/headers"
25 - "go.uber.org/zap"
27 )
28
29 func init() {
modules/caddyhttp/replacer.go
+2 -1
@@ -39,9 +39,10 @@ import (
39 "strings"
40 "time"
41
42 + "github.com/google/uuid"
43 +
44 "github.com/caddyserver/caddy/v2"
45 "github.com/caddyserver/caddy/v2/modules/caddytls"
44 - "github.com/google/uuid"
46 )
47
48 // NewTestReplacer creates a replacer for an http.Request
modules/caddyhttp/requestbody/caddyfile.go
+2 -1
@@ -15,9 +15,10 @@
15 package requestbody
16
17 import (
18 + "github.com/dustin/go-humanize"
19 +
20 "github.com/caddyserver/caddy/v2/caddyconfig/httpcaddyfile"
21 "github.com/caddyserver/caddy/v2/modules/caddyhttp"
20 - "github.com/dustin/go-humanize"
22 )
23
24 func init() {
modules/caddyhttp/reverseproxy/caddyfile.go
+2 -1
@@ -21,6 +21,8 @@ import (
21 "strconv"
22 "strings"
23
24 + "github.com/dustin/go-humanize"
25 +
26 "github.com/caddyserver/caddy/v2"
27 "github.com/caddyserver/caddy/v2/caddyconfig"
28 "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
@@ -28,7 +30,6 @@ import (
30 "github.com/caddyserver/caddy/v2/modules/caddyhttp"
31 "github.com/caddyserver/caddy/v2/modules/caddyhttp/headers"
32 "github.com/caddyserver/caddy/v2/modules/caddyhttp/rewrite"
31 - "github.com/dustin/go-humanize"
33 )
34
35 func init() {
modules/caddyhttp/reverseproxy/command.go
+5 -3
@@ -21,15 +21,17 @@ import (
21 "strconv"
22 "strings"
23
24 + "github.com/spf13/cobra"
25 + "go.uber.org/zap"
26 +
27 + caddycmd "github.com/caddyserver/caddy/v2/cmd"
28 +
29 "github.com/caddyserver/caddy/v2"
30 "github.com/caddyserver/caddy/v2/caddyconfig"
31 "github.com/caddyserver/caddy/v2/caddyconfig/httpcaddyfile"
27 - caddycmd "github.com/caddyserver/caddy/v2/cmd"
32 "github.com/caddyserver/caddy/v2/modules/caddyhttp"
33 "github.com/caddyserver/caddy/v2/modules/caddyhttp/headers"
34 "github.com/caddyserver/caddy/v2/modules/caddytls"
31 - "github.com/spf13/cobra"
32 - "go.uber.org/zap"
35 )
36
37 func init() {
modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go
+3 -3
@@ -24,13 +24,13 @@ import (
24 "strings"
25 "time"
26
27 - "github.com/caddyserver/caddy/v2/modules/caddyhttp"
28 - "github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy"
29 - "github.com/caddyserver/caddy/v2/modules/caddytls"
27 "go.uber.org/zap"
28 "go.uber.org/zap/zapcore"
29
30 "github.com/caddyserver/caddy/v2"
31 + "github.com/caddyserver/caddy/v2/modules/caddyhttp"
32 + "github.com/caddyserver/caddy/v2/modules/caddyhttp/reverseproxy"
33 + "github.com/caddyserver/caddy/v2/modules/caddytls"
34 )
35
36 var noopLogger = zap.NewNop()
modules/caddyhttp/reverseproxy/healthchecks.go
+2 -1
@@ -26,9 +26,10 @@ import (
26 "strconv"
27 "time"
28
29 + "go.uber.org/zap"
30 +
31 "github.com/caddyserver/caddy/v2"
32 "github.com/caddyserver/caddy/v2/modules/caddyhttp"
31 - "go.uber.org/zap"
33 )
34
35 // HealthChecks configures active and passive health checks.
modules/caddyhttp/reverseproxy/httptransport.go
+4 -3
@@ -28,12 +28,13 @@ import (
28 "strings"
29 "time"
30
31 - "github.com/caddyserver/caddy/v2"
32 - "github.com/caddyserver/caddy/v2/modules/caddyhttp"
33 - "github.com/caddyserver/caddy/v2/modules/caddytls"
31 "github.com/mastercactapus/proxyprotocol"
32 "go.uber.org/zap"
33 "golang.org/x/net/http2"
34 +
35 + "github.com/caddyserver/caddy/v2"
36 + "github.com/caddyserver/caddy/v2/modules/caddyhttp"
37 + "github.com/caddyserver/caddy/v2/modules/caddytls"
38 )
39
40 func init() {
modules/caddyhttp/reverseproxy/reverseproxy.go
+3 -2
@@ -32,14 +32,15 @@ import (
32 "sync"
33 "time"
34
35 + "go.uber.org/zap"
36 + "golang.org/x/net/http/httpguts"
37 +
38 "github.com/caddyserver/caddy/v2"
39 "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
40 "github.com/caddyserver/caddy/v2/modules/caddyevents"
41 "github.com/caddyserver/caddy/v2/modules/caddyhttp"
42 "github.com/caddyserver/caddy/v2/modules/caddyhttp/headers"
43 "github.com/caddyserver/caddy/v2/modules/caddyhttp/rewrite"
41 - "go.uber.org/zap"
42 - "golang.org/x/net/http/httpguts"
44 )
45
46 func init() {
modules/caddyhttp/reverseproxy/upstreams.go
+2 -1
@@ -11,8 +11,9 @@ import (
11 "sync"
12 "time"
13
14 - "github.com/caddyserver/caddy/v2"
14 "go.uber.org/zap"
15 +
16 + "github.com/caddyserver/caddy/v2"
17 )
18
19 func init() {
modules/caddyhttp/rewrite/rewrite.go
+2 -1
@@ -22,9 +22,10 @@ import (
22 "strconv"
23 "strings"
24
25 + "go.uber.org/zap"
26 +
27 "github.com/caddyserver/caddy/v2"
28 "github.com/caddyserver/caddy/v2/modules/caddyhttp"
27 - "go.uber.org/zap"
29 )
30
31 func init() {
modules/caddyhttp/server.go
+4 -3
@@ -30,14 +30,15 @@ import (
30 "sync/atomic"
31 "time"
32
33 - "github.com/caddyserver/caddy/v2"
34 - "github.com/caddyserver/caddy/v2/modules/caddyevents"
35 - "github.com/caddyserver/caddy/v2/modules/caddytls"
33 "github.com/caddyserver/certmagic"
34 "github.com/quic-go/quic-go"
35 "github.com/quic-go/quic-go/http3"
36 "go.uber.org/zap"
37 "go.uber.org/zap/zapcore"
38 +
39 + "github.com/caddyserver/caddy/v2"
40 + "github.com/caddyserver/caddy/v2/modules/caddyevents"
41 + "github.com/caddyserver/caddy/v2/modules/caddytls"
42 )
43
44 // Server describes an HTTP server.
modules/caddyhttp/staticresp.go
+5 -3
@@ -27,12 +27,14 @@ import (
27 "text/template"
28 "time"
29
30 + "github.com/spf13/cobra"
31 + "go.uber.org/zap"
32 +
33 + caddycmd "github.com/caddyserver/caddy/v2/cmd"
34 +
35 "github.com/caddyserver/caddy/v2"
36 "github.com/caddyserver/caddy/v2/caddyconfig"
37 "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
33 - caddycmd "github.com/caddyserver/caddy/v2/cmd"
34 - "github.com/spf13/cobra"
35 - "go.uber.org/zap"
38 )
39
40 func init() {
modules/caddyhttp/templates/tplcontext.go
+3 -2
@@ -31,14 +31,15 @@ import (
31
32 "github.com/Masterminds/sprig/v3"
33 chromahtml "github.com/alecthomas/chroma/v2/formatters/html"
34 - "github.com/caddyserver/caddy/v2"
35 - "github.com/caddyserver/caddy/v2/modules/caddyhttp"
34 "github.com/dustin/go-humanize"
35 "github.com/yuin/goldmark"
36 highlighting "github.com/yuin/goldmark-highlighting/v2"
37 "github.com/yuin/goldmark/extension"
38 "github.com/yuin/goldmark/parser"
39 gmhtml "github.com/yuin/goldmark/renderer/html"
40 +
41 + "github.com/caddyserver/caddy/v2"
42 + "github.com/caddyserver/caddy/v2/modules/caddyhttp"
43 )
44
45 // TemplateContext is the TemplateContext with which HTTP templates are executed.
modules/caddyhttp/tracing/module.go
+2 -1
@@ -4,11 +4,12 @@ import (
4 "fmt"
5 "net/http"
6
7 + "go.uber.org/zap"
8 +
9 "github.com/caddyserver/caddy/v2"
10 "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
11 "github.com/caddyserver/caddy/v2/caddyconfig/httpcaddyfile"
12 "github.com/caddyserver/caddy/v2/modules/caddyhttp"
11 - "go.uber.org/zap"
13 )
14
15 func init() {
modules/caddyhttp/tracing/tracer.go
+3 -2
@@ -5,8 +5,6 @@ import (
5 "fmt"
6 "net/http"
7
8 - "github.com/caddyserver/caddy/v2"
9 - "github.com/caddyserver/caddy/v2/modules/caddyhttp"
8 "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
9 "go.opentelemetry.io/contrib/propagators/autoprop"
10 "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc"
@@ -16,6 +14,9 @@ import (
14 semconv "go.opentelemetry.io/otel/semconv/v1.17.0"
15 "go.opentelemetry.io/otel/trace"
16 "go.uber.org/zap"
17 +
18 + "github.com/caddyserver/caddy/v2"
19 + "github.com/caddyserver/caddy/v2/modules/caddyhttp"
20 )
21
22 const (
modules/caddypki/acmeserver/acmeserver.go
+4 -3
@@ -26,9 +26,6 @@ import (
26 "strings"
27 "time"
28
29 - "github.com/caddyserver/caddy/v2"
30 - "github.com/caddyserver/caddy/v2/modules/caddyhttp"
31 - "github.com/caddyserver/caddy/v2/modules/caddypki"
29 "github.com/go-chi/chi"
30 "github.com/smallstep/certificates/acme"
31 "github.com/smallstep/certificates/acme/api"
@@ -38,6 +35,10 @@ import (
35 "github.com/smallstep/certificates/db"
36 "github.com/smallstep/nosql"
37 "go.uber.org/zap"
38 +
39 + "github.com/caddyserver/caddy/v2"
40 + "github.com/caddyserver/caddy/v2/modules/caddyhttp"
41 + "github.com/caddyserver/caddy/v2/modules/caddypki"
42 )
43
44 func init() {
modules/caddypki/adminapi.go
+2 -1
@@ -20,8 +20,9 @@ import (
20 "net/http"
21 "strings"
22
23 - "github.com/caddyserver/caddy/v2"
23 "go.uber.org/zap"
24 +
25 + "github.com/caddyserver/caddy/v2"
26 )
27
28 func init() {
modules/caddypki/ca.go
+2 -1
@@ -25,12 +25,13 @@ import (
25 "sync"
26 "time"
27
28 - "github.com/caddyserver/caddy/v2"
28 "github.com/caddyserver/certmagic"
29 "github.com/smallstep/certificates/authority"
30 "github.com/smallstep/certificates/db"
31 "github.com/smallstep/truststore"
32 "go.uber.org/zap"
33 +
34 + "github.com/caddyserver/caddy/v2"
35 )
36
37 // CA describes a certificate authority, which consists of
modules/caddypki/command.go
+4 -2
@@ -23,10 +23,12 @@ import (
23 "os"
24 "path"
25
26 - "github.com/caddyserver/caddy/v2"
27 - caddycmd "github.com/caddyserver/caddy/v2/cmd"
26 "github.com/smallstep/truststore"
27 "github.com/spf13/cobra"
28 +
29 + caddycmd "github.com/caddyserver/caddy/v2/cmd"
30 +
31 + "github.com/caddyserver/caddy/v2"
32 )
33
34 func init() {
modules/caddypki/pki.go
+2 -1
@@ -17,8 +17,9 @@ package caddypki
17 import (
18 "fmt"
19
20 - "github.com/caddyserver/caddy/v2"
20 "go.uber.org/zap"
21 +
22 + "github.com/caddyserver/caddy/v2"
23 )
24
25 func init() {
modules/caddytls/acmeissuer.go
+4 -3
@@ -24,13 +24,14 @@ import (
24 "strconv"
25 "time"
26
27 - "github.com/caddyserver/caddy/v2"
28 - "github.com/caddyserver/caddy/v2/caddyconfig"
29 - "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
27 "github.com/caddyserver/certmagic"
28 "github.com/mholt/acmez"
29 "github.com/mholt/acmez/acme"
30 "go.uber.org/zap"
31 +
32 + "github.com/caddyserver/caddy/v2"
33 + "github.com/caddyserver/caddy/v2/caddyconfig"
34 + "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
35 )
36
37 func init() {
modules/caddytls/automation.go
+2 -1
@@ -22,10 +22,11 @@ import (
22 "strings"
23 "time"
24
25 - "github.com/caddyserver/caddy/v2"
25 "github.com/caddyserver/certmagic"
26 "github.com/mholt/acmez"
27 "go.uber.org/zap"
28 +
29 + "github.com/caddyserver/caddy/v2"
30 )
31
32 // AutomationConfig governs the automated management of TLS certificates.
modules/caddytls/certmanagers.go
+3 -2
@@ -9,11 +9,12 @@ import (
9 "net/url"
10 "strings"
11
12 - "github.com/caddyserver/caddy/v2"
13 - "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
12 "github.com/caddyserver/certmagic"
13 "github.com/tailscale/tscert"
14 "go.uber.org/zap"
15 +
16 + "github.com/caddyserver/caddy/v2"
17 + "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
18 )
19
20 func init() {
modules/caddytls/connpolicy.go
+2 -1
@@ -25,9 +25,10 @@ import (
25 "path/filepath"
26 "strings"
27
28 - "github.com/caddyserver/caddy/v2"
28 "github.com/mholt/acmez"
29 "go.uber.org/zap"
30 +
31 + "github.com/caddyserver/caddy/v2"
32 )
33
34 func init() {
modules/caddytls/distributedstek/distributedstek.go
+2 -1
@@ -33,9 +33,10 @@ import (
33 "runtime/debug"
34 "time"
35
36 + "github.com/caddyserver/certmagic"
37 +
38 "github.com/caddyserver/caddy/v2"
39 "github.com/caddyserver/caddy/v2/modules/caddytls"
38 - "github.com/caddyserver/certmagic"
40 )
41
42 func init() {
modules/caddytls/internalissuer.go
+4 -3
@@ -21,12 +21,13 @@ import (
21 "encoding/pem"
22 "time"
23
24 - "github.com/caddyserver/caddy/v2"
25 - "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
26 - "github.com/caddyserver/caddy/v2/modules/caddypki"
24 "github.com/caddyserver/certmagic"
25 "github.com/smallstep/certificates/authority/provisioner"
26 "go.uber.org/zap"
27 +
28 + "github.com/caddyserver/caddy/v2"
29 + "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
30 + "github.com/caddyserver/caddy/v2/modules/caddypki"
31 )
32
33 func init() {
modules/caddytls/matchers.go
+2 -1
@@ -21,9 +21,10 @@ import (
21 "net/netip"
22 "strings"
23
24 - "github.com/caddyserver/caddy/v2"
24 "github.com/caddyserver/certmagic"
25 "go.uber.org/zap"
26 +
27 + "github.com/caddyserver/caddy/v2"
28 )
29
30 func init() {
modules/caddytls/storageloader.go
+2 -1
@@ -18,8 +18,9 @@ import (
18 "crypto/tls"
19 "fmt"
20
21 - "github.com/caddyserver/caddy/v2"
21 "github.com/caddyserver/certmagic"
22 +
23 + "github.com/caddyserver/caddy/v2"
24 )
25
26 func init() {
modules/caddytls/tls.go
+3 -2
@@ -25,10 +25,11 @@ import (
25 "sync"
26 "time"
27
28 - "github.com/caddyserver/caddy/v2"
29 - "github.com/caddyserver/caddy/v2/modules/caddyevents"
28 "github.com/caddyserver/certmagic"
29 "go.uber.org/zap"
30 +
31 + "github.com/caddyserver/caddy/v2"
32 + "github.com/caddyserver/caddy/v2/modules/caddyevents"
33 )
34
35 func init() {
modules/caddytls/zerosslissuer.go
+3 -2
@@ -25,11 +25,12 @@ import (
25 "strings"
26 "sync"
27
28 - "github.com/caddyserver/caddy/v2"
29 - "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
28 "github.com/caddyserver/certmagic"
29 "github.com/mholt/acmez/acme"
30 "go.uber.org/zap"
31 +
32 + "github.com/caddyserver/caddy/v2"
33 + "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
34 )
35
36 func init() {
modules/filestorage/filestorage.go
+2 -1
@@ -15,9 +15,10 @@
15 package filestorage
16
17 import (
18 + "github.com/caddyserver/certmagic"
19 +
20 "github.com/caddyserver/caddy/v2"
21 "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
20 - "github.com/caddyserver/certmagic"
22 )
23
24 func init() {
modules/logging/encoders.go
+3 -2
@@ -17,11 +17,12 @@ package logging
17 import (
18 "time"
19
20 - "github.com/caddyserver/caddy/v2"
21 - "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
20 "go.uber.org/zap"
21 "go.uber.org/zap/buffer"
22 "go.uber.org/zap/zapcore"
23 +
24 + "github.com/caddyserver/caddy/v2"
25 + "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
26 )
27
28 func init() {
modules/logging/filewriter.go
+3 -2
@@ -22,10 +22,11 @@ import (
22 "path/filepath"
23 "strconv"
24
25 - "github.com/caddyserver/caddy/v2"
26 - "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
25 "github.com/dustin/go-humanize"
26 "gopkg.in/natefinch/lumberjack.v2"
27 +
28 + "github.com/caddyserver/caddy/v2"
29 + "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
30 )
31
32 func init() {
modules/logging/filterencoder.go
+4 -3
@@ -19,12 +19,13 @@ import (
19 "fmt"
20 "time"
21
22 - "github.com/caddyserver/caddy/v2"
23 - "github.com/caddyserver/caddy/v2/caddyconfig"
24 - "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
22 "go.uber.org/zap"
23 "go.uber.org/zap/buffer"
24 "go.uber.org/zap/zapcore"
25 +
26 + "github.com/caddyserver/caddy/v2"
27 + "github.com/caddyserver/caddy/v2/caddyconfig"
28 + "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
29 )
30
31 func init() {
modules/logging/filters.go
+2 -1
@@ -25,10 +25,11 @@ import (
25 "strconv"
26 "strings"
27
28 + "go.uber.org/zap/zapcore"
29 +
30 "github.com/caddyserver/caddy/v2"
31 "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
32 "github.com/caddyserver/caddy/v2/modules/caddyhttp"
31 - "go.uber.org/zap/zapcore"
33 )
34
35 func init() {
modules/metrics/metrics.go
+4 -5
@@ -17,15 +17,14 @@ package metrics
17 import (
18 "net/http"
19
20 + "github.com/prometheus/client_golang/prometheus"
21 + "github.com/prometheus/client_golang/prometheus/promhttp"
22 + "go.uber.org/zap"
23 +
24 "github.com/caddyserver/caddy/v2"
25 "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
26 "github.com/caddyserver/caddy/v2/caddyconfig/httpcaddyfile"
27 "github.com/caddyserver/caddy/v2/modules/caddyhttp"
24 -
25 - "go.uber.org/zap"
26 -
27 - "github.com/prometheus/client_golang/prometheus"
28 - "github.com/prometheus/client_golang/prometheus/promhttp"
28 )
29
30 func init() {
service_windows.go
+2 -1
@@ -18,8 +18,9 @@ import (
18 "os"
19 "path/filepath"
20
21 - "github.com/caddyserver/caddy/v2/notify"
21 "golang.org/x/sys/windows/svc"
22 +
23 + "github.com/caddyserver/caddy/v2/notify"
24 )
25
26 func init() {