diff --git a/internal/httputil/tls_config.go b/internal/httputil/tls_config.go deleted file mode 100644 index b92f4d983..000000000 --- a/internal/httputil/tls_config.go +++ /dev/null @@ -1,22 +0,0 @@ -package httputil - -import "crypto/tls" - -// MinTLSVersion is the minimum TLS version enforced across gateway listeners -// and outbound HTTP clients. -const MinTLSVersion = tls.VersionTLS12 - -// NewServerTLSConfig creates a server TLS config with the standard minimum TLS -// version and a single certificate chain. -func NewServerTLSConfig(cert tls.Certificate) *tls.Config { - return &tls.Config{ - Certificates: []tls.Certificate{cert}, - MinVersion: MinTLSVersion, - } -} - -// NewClientTLSConfig creates an HTTP client TLS config with the standard -// minimum TLS version. -func NewClientTLSConfig() *tls.Config { - return &tls.Config{MinVersion: MinTLSVersion} -} diff --git a/internal/httputil/tls_config_test.go b/internal/httputil/tls_config_test.go deleted file mode 100644 index 26e7167ca..000000000 --- a/internal/httputil/tls_config_test.go +++ /dev/null @@ -1,27 +0,0 @@ -package httputil - -import ( - "crypto/tls" - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestNewServerTLSConfig(t *testing.T) { - cert := tls.Certificate{Certificate: [][]byte{[]byte("cert")}} - - cfg := NewServerTLSConfig(cert) - - assert.NotNil(t, cfg) - assert.Equal(t, uint16(MinTLSVersion), cfg.MinVersion) - assert.Len(t, cfg.Certificates, 1) - assert.Equal(t, cert, cfg.Certificates[0]) -} - -func TestNewClientTLSConfig(t *testing.T) { - cfg := NewClientTLSConfig() - - assert.NotNil(t, cfg) - assert.Equal(t, uint16(MinTLSVersion), cfg.MinVersion) - assert.Empty(t, cfg.Certificates) -} diff --git a/internal/httputil/tls_test.go b/internal/httputil/tls_test.go index 5d48f185c..494ac1dbd 100644 --- a/internal/httputil/tls_test.go +++ b/internal/httputil/tls_test.go @@ -12,6 +12,7 @@ func TestNewServerTLSConfig(t *testing.T) { cfg := NewServerTLSConfig(cert) + assert.NotNil(t, cfg) assert.EqualValues(t, MinTLSVersion, cfg.MinVersion) assert.Len(t, cfg.Certificates, 1) assert.Equal(t, cert, cfg.Certificates[0]) @@ -20,6 +21,7 @@ func TestNewServerTLSConfig(t *testing.T) { func TestNewClientTLSConfig(t *testing.T) { cfg := NewClientTLSConfig() + assert.NotNil(t, cfg) assert.EqualValues(t, MinTLSVersion, cfg.MinVersion) assert.Empty(t, cfg.Certificates) }