Add and fix nilnil
This commit is contained in:
parent
668e958d3e
commit
0315f55fcd
2 changed files with 2 additions and 3 deletions
|
@ -45,7 +45,6 @@ linters:
|
||||||
- goconst
|
- goconst
|
||||||
- exhaustive
|
- exhaustive
|
||||||
- varnamelen
|
- varnamelen
|
||||||
- nilnil
|
|
||||||
|
|
||||||
# We might want to enable this, but it might be a lot of work
|
# We might want to enable this, but it might be a lot of work
|
||||||
- cyclop
|
- cyclop
|
||||||
|
|
4
app.go
4
app.go
|
@ -588,6 +588,7 @@ func (h *Headscale) Serve() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Headscale) getTLSSettings() (*tls.Config, error) {
|
func (h *Headscale) getTLSSettings() (*tls.Config, error) {
|
||||||
|
var err error
|
||||||
if h.cfg.TLSLetsEncryptHostname != "" {
|
if h.cfg.TLSLetsEncryptHostname != "" {
|
||||||
if !strings.HasPrefix(h.cfg.ServerURL, "https://") {
|
if !strings.HasPrefix(h.cfg.ServerURL, "https://") {
|
||||||
log.Warn().
|
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://")
|
log.Warn().Msg("Listening without TLS but ServerURL does not start with http://")
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, nil
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
if !strings.HasPrefix(h.cfg.ServerURL, "https://") {
|
if !strings.HasPrefix(h.cfg.ServerURL, "https://") {
|
||||||
log.Warn().Msg("Listening with TLS but ServerURL does not start with https://")
|
log.Warn().Msg("Listening with TLS but ServerURL does not start with https://")
|
||||||
}
|
}
|
||||||
var err error
|
|
||||||
tlsConfig := &tls.Config{}
|
tlsConfig := &tls.Config{}
|
||||||
tlsConfig.ClientAuth = tls.RequireAnyClientCert
|
tlsConfig.ClientAuth = tls.RequireAnyClientCert
|
||||||
tlsConfig.NextProtos = []string{"http/1.1"}
|
tlsConfig.NextProtos = []string{"http/1.1"}
|
||||||
|
|
Loading…
Reference in a new issue