Skip to content

Commit c341bad

Browse files
This fixes panic when the host is not set
1 parent 336bc51 commit c341bad

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tls.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ import (
1010
func (a *Armor) GetConfigForClient(clientHelloInfo *tls.ClientHelloInfo) (*tls.Config, error) {
1111
// Get the host from the hello info
1212
host := a.Hosts[clientHelloInfo.ServerName]
13-
if len(host.ClientCAs) == 0 {
14-
return nil, nil
13+
// If the host or the clientCAs are not configured the function
14+
// returns the default TLS configuration
15+
if host == nil || len(host.ClientCAs) == 0 {
16+
return a.setupTLSConfig(), nil
1517
}
1618

1719
// Use existing host config if exist

0 commit comments

Comments
 (0)