Add and fix nilnil

This commit is contained in:
Kristoffer Dalby 2021-11-14 17:51:34 +01:00
parent 668e958d3e
commit 0315f55fcd
No known key found for this signature in database
GPG key ID: 09F62DC067465735
2 changed files with 2 additions and 3 deletions

View file

@ -45,7 +45,6 @@ linters:
- goconst
- exhaustive
- varnamelen
- nilnil
# We might want to enable this, but it might be a lot of work
- cyclop

4
app.go
View file

@ -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"}