mirror of
https://github.com/coredns/coredns.git
synced 2026-03-11 16:15:05 -04:00
chore(lint): bump golangci-lint to v2.11.1 (#7905)
- Added nolint to plugin/auto/walk.go to avoid a symlink/TOCTOU warning, as it needs to follow symlink. - Replaced a few flagged integer conversions with safe equivalents in cache hashing, reuseport socket setup, and TLS arg handling - Preallocated response rule slices in plugin/rewrite/name.go - Replaced WriteString(fmt.Sprintf/Sprintln(...)) with direct fmt.Fprint* calls - Removed stale nolint directives from code and tests that are no longer needed Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
This commit is contained in:
@@ -59,19 +59,29 @@ func setTLSDefaults(ctls *tls.Config) {
|
||||
func NewTLSConfigFromArgs(args ...string) (*tls.Config, error) {
|
||||
var err error
|
||||
var c *tls.Config
|
||||
var certPath, keyPath, caPath string
|
||||
if len(args) > 0 {
|
||||
certPath = args[0]
|
||||
}
|
||||
if len(args) > 1 {
|
||||
keyPath = args[1]
|
||||
}
|
||||
if len(args) > 2 {
|
||||
caPath = args[2]
|
||||
}
|
||||
switch len(args) {
|
||||
case 0:
|
||||
// No client cert, use system CA
|
||||
c, err = NewTLSClientConfig("")
|
||||
case 1:
|
||||
// No client cert, use specified CA
|
||||
c, err = NewTLSClientConfig(args[0])
|
||||
c, err = NewTLSClientConfig(certPath)
|
||||
case 2:
|
||||
// Client cert, use system CA
|
||||
c, err = NewTLSConfig(args[0], args[1], "")
|
||||
c, err = NewTLSConfig(certPath, keyPath, "")
|
||||
case 3:
|
||||
// Client cert, use specified CA
|
||||
c, err = NewTLSConfig(args[0], args[1], args[2])
|
||||
c, err = NewTLSConfig(certPath, keyPath, caPath)
|
||||
default:
|
||||
err = fmt.Errorf("maximum of three arguments allowed for TLS config, found %d", len(args))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user