From 0315f55fcde9519320cf5d9f006fe2b3f6c54443 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Sun, 14 Nov 2021 17:51:34 +0100 Subject: [PATCH] Add and fix nilnil --- .golangci.yaml | 1 - app.go | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index 058158ba..3006b0f4 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -45,7 +45,6 @@ linters: - goconst - exhaustive - varnamelen - - nilnil # We might want to enable this, but it might be a lot of work - cyclop diff --git a/app.go b/app.go index 0da088f2..034f86f9 100644 --- a/app.go +++ b/app.go @@ -588,6 +588,7 @@ func (h *Headscale) Serve() error { } func (h *Headscale) getTLSSettings() (*tls.Config, error) { + var err error if h.cfg.TLSLetsEncryptHostname != "" { if !strings.HasPrefix(h.cfg.ServerURL, "https://") { log.Warn(). @@ -628,12 +629,11 @@ func (h *Headscale) getTLSSettings() (*tls.Config, error) { log.Warn().Msg("Listening without TLS but ServerURL does not start with http://") } - return nil, nil + return nil, err } else { if !strings.HasPrefix(h.cfg.ServerURL, "https://") { log.Warn().Msg("Listening with TLS but ServerURL does not start with https://") } - var err error tlsConfig := &tls.Config{} tlsConfig.ClientAuth = tls.RequireAnyClientCert tlsConfig.NextProtos = []string{"http/1.1"}