mirror of
https://github.com/caddyserver/caddy.git
synced 2025-06-05 12:00:29 +08:00
Remove dead code, do struct alignment, simplify code
This commit is contained in:
@ -217,7 +217,7 @@ func (c *Config) StorageFor(caURL string) (Storage, error) {
|
||||
// MakeTLSConfig reduces configs into a single tls.Config.
|
||||
// If TLS is to be disabled, a nil tls.Config will be returned.
|
||||
func MakeTLSConfig(configs []*Config) (*tls.Config, error) {
|
||||
if configs == nil || len(configs) == 0 {
|
||||
if len(configs) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
@ -418,27 +418,6 @@ var supportedCiphersMap = map[string]uint16{
|
||||
"RSA-3DES-EDE-CBC-SHA": tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA,
|
||||
}
|
||||
|
||||
// List of supported cipher suites in descending order of preference.
|
||||
// Ordering is very important! Getting the wrong order will break
|
||||
// mainstream clients, especially with HTTP/2.
|
||||
//
|
||||
// Note that TLS_FALLBACK_SCSV is not in this list since it is always
|
||||
// added manually.
|
||||
var supportedCiphers = []uint16{
|
||||
tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
|
||||
tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
|
||||
tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
|
||||
tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
|
||||
tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
|
||||
tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
|
||||
tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
|
||||
tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
|
||||
tls.TLS_RSA_WITH_AES_256_CBC_SHA,
|
||||
tls.TLS_RSA_WITH_AES_128_CBC_SHA,
|
||||
tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,
|
||||
tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA,
|
||||
}
|
||||
|
||||
// List of all the ciphers we want to use by default
|
||||
var defaultCiphers = []uint16{
|
||||
tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
|
||||
|
@ -120,7 +120,7 @@ func TestStandaloneTLSTicketKeyRotation(t *testing.T) {
|
||||
t.Errorf("Expected TLS ticket keys in use: %d; Got instead: %d.", rounds, pkt.keysInUse)
|
||||
return
|
||||
}
|
||||
if c.SessionTicketsDisabled == true {
|
||||
if c.SessionTicketsDisabled {
|
||||
t.Error("Session tickets have been disabled unexpectedly.")
|
||||
return
|
||||
}
|
||||
|
@ -301,5 +301,3 @@ var failedIssuanceMu sync.RWMutex
|
||||
// If this value is recent, do not make any on-demand certificate requests.
|
||||
var lastIssueTime time.Time
|
||||
var lastIssueTimeMu sync.Mutex
|
||||
|
||||
var errNoCert = errors.New("no certificate available")
|
||||
|
@ -118,11 +118,7 @@ func getUser(storage Storage, email string) (User, error) {
|
||||
|
||||
// load their private key
|
||||
user.key, err = loadPrivateKey(userData.Key)
|
||||
if err != nil {
|
||||
return user, err
|
||||
}
|
||||
|
||||
return user, nil
|
||||
return user, err
|
||||
}
|
||||
|
||||
// saveUser persists a user's key and account registration
|
||||
|
Reference in New Issue
Block a user