mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-23 18:15:26 +00:00
linting/formatting
This commit is contained in:
parent
5935b13b67
commit
c98a559b4d
18
app.go
18
app.go
@ -646,19 +646,19 @@ func (h *Headscale) getTLSSettings() (*tls.Config, error) {
|
||||
log.Warn().Msg("Listening with TLS but ServerURL does not start with https://")
|
||||
}
|
||||
|
||||
var client_auth_mode tls.ClientAuthType
|
||||
if(h.cfg.TLSClientAuthMode == "disabled"){
|
||||
var clientAuthMode tls.ClientAuthType
|
||||
if h.cfg.TLSClientAuthMode == "disabled" {
|
||||
// Client cert is _not_ required.
|
||||
client_auth_mode = tls.NoClientCert
|
||||
}else if (h.cfg.TLSClientAuthMode == "relaxed"){
|
||||
clientAuthMode = tls.NoClientCert
|
||||
} else if h.cfg.TLSClientAuthMode == "relaxed" {
|
||||
// Client cert required, but not verified.
|
||||
client_auth_mode = tls.RequireAnyClientCert
|
||||
}else if (h.cfg.TLSClientAuthMode == "enforced"){
|
||||
clientAuthMode = tls.RequireAnyClientCert
|
||||
} else if h.cfg.TLSClientAuthMode == "enforced" {
|
||||
// Client cert is required and verified.
|
||||
client_auth_mode = tls.RequireAndVerifyClientCert
|
||||
clientAuthMode = tls.RequireAndVerifyClientCert
|
||||
} else {
|
||||
return nil, errors.New(
|
||||
"Invalid tls_client_auth_mode provided: " +
|
||||
"Invalid tls_clientAuthMode provided: " +
|
||||
h.cfg.TLSClientAuthMode)
|
||||
}
|
||||
|
||||
@ -667,7 +667,7 @@ func (h *Headscale) getTLSSettings() (*tls.Config, error) {
|
||||
h.cfg.TLSClientAuthMode))
|
||||
|
||||
tlsConfig := &tls.Config{
|
||||
ClientAuth: client_auth_mode,
|
||||
ClientAuth: clientAuthMode,
|
||||
NextProtos: []string{"http/1.1"},
|
||||
Certificates: make([]tls.Certificate, 1),
|
||||
MinVersion: tls.VersionTLS12,
|
||||
|
@ -82,8 +82,8 @@ func LoadConfig(path string) error {
|
||||
errorText += "Fatal config error: server_url must start with https:// or http://\n"
|
||||
}
|
||||
|
||||
auth_mode := viper.GetString("tls_client_auth_mode")
|
||||
if (auth_mode != "disabled" && auth_mode != "relaxed" && auth_mode != "enforced"){
|
||||
clientAuthMode := viper.GetString("tls_client_auth_mode")
|
||||
if clientAuthMode != "disabled" && clientAuthMode != "relaxed" && clientAuthMode != "enforced" {
|
||||
errorText += "Invalid tls_client_auth_mode supplied. Accepted values: disabled, relaxed, enforced."
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user