Skip to content

Commit

Permalink
fsthttp: set UseSSL=true when setting other TLS options for backend c…
Browse files Browse the repository at this point in the history
…onfig
  • Loading branch information
dgryski committed Aug 22, 2024
1 parent ca3b46e commit 49f359f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions fsthttp/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,42 +245,55 @@ func (b *BackendOptions) UseSSL(v bool) *BackendOptions {
}

// SSLMinVersion sets the minimum allowed TLS version on SSL connections to this backend.
// Setting this will enable SSL for the connection as a side effect.
func (b *BackendOptions) SSLMinVersion(min TLSVersion) *BackendOptions {
b.abiOpts.UseSSL(true)
b.abiOpts.SSLMinVersion(fastly.TLSVersion(min))
return b
}

// SSLMaxVersion sets the maximum allowed TLS version on SSL connections to this backend.
// Setting this will enable SSL for the connection as a side effect.
func (b *BackendOptions) SSLMaxVersion(max TLSVersion) *BackendOptions {
b.abiOpts.UseSSL(true)
b.abiOpts.SSLMaxVersion(fastly.TLSVersion(max))
return b
}

// CertHostname sets the hostname that the server certificate should declare.
// Setting this will enable SSL for the connection as a side effect.
func (b *BackendOptions) CertHostname(host string) *BackendOptions {
b.abiOpts.UseSSL(true)
b.abiOpts.CertHostname(host)
return b
}

// CACert sets the CA certificate to use when checking the validity of the backend.
// Setting this will enable SSL for the connection as a side effect.
func (b *BackendOptions) CACert(cert string) *BackendOptions {
b.abiOpts.UseSSL(true)
b.abiOpts.CACert(cert)
return b
}

// Ciphers sets the list of OpenSSL ciphers to support for connections to this origin.
// Setting this will enable SSL for the connection as a side effect.
func (b *BackendOptions) Ciphers(ciphers string) *BackendOptions {
b.abiOpts.UseSSL(true)
b.abiOpts.Ciphers(ciphers)
return b
}

// SNIHostname sets the SNI hostname to use on connections to this backend.
// Setting this will enable SSL for the connection as a side effect.
func (b *BackendOptions) SNIHostname(host string) *BackendOptions {
b.abiOpts.UseSSL(true)
b.abiOpts.SNIHostname(host)
return b
}

// ClientCertificate sets the client certificate to be provided to the server as part of the SSL handshake.
// Setting this will enable SSL for the connection as a side effect.
func (b *BackendOptions) ClientCertificate(certificate string, key secretstore.Secret) *BackendOptions {
b.abiOpts.UseSSL(true)
b.abiOpts.ClientCert(certificate, key.Handle())
Expand Down

0 comments on commit 49f359f

Please sign in to comment.