Skip to content

Commit

Permalink
This fixes panic when the host is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandrestein committed Apr 15, 2019
1 parent 336bc51 commit c341bad
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ import (
func (a *Armor) GetConfigForClient(clientHelloInfo *tls.ClientHelloInfo) (*tls.Config, error) {
// Get the host from the hello info
host := a.Hosts[clientHelloInfo.ServerName]
if len(host.ClientCAs) == 0 {
return nil, nil
// If the host or the clientCAs are not configured the function
// returns the default TLS configuration
if host == nil || len(host.ClientCAs) == 0 {
return a.setupTLSConfig(), nil
}

// Use existing host config if exist
Expand Down

0 comments on commit c341bad

Please sign in to comment.