BackendOptions

Structin fsthttpcompute-sdk-go v1.11.0View source
type BackendOptions struct {
// contains filtered or unexported fields
}

BackendOption is a builder for the configuration of a dynamic backend.

Methods

BetweenBytesTimeout

View source
func (b *BackendOptions) BetweenBytesTimeout(t time.Duration) *BackendOptions

BetweenBytesTimeout sets the maximum duration that Fastly will wait while receiving no data on a download from a backend.

Parameters

t: time.Duration

Returns

func (b *BackendOptions) CACert(cert string) *BackendOptions

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.

If CACert is not provided (default), the backend's certificate is validated using a set of public root CAs.

Parameters

cert: string

Returns

CertHostname

View source
func (b *BackendOptions) CertHostname(host string) *BackendOptions

CertHostname sets the hostname that the server certificate should declare. Setting this will enable SSL for the connection as a side effect.

If CertHostname is not provided (default), the server certificate's hostname can have any value.

Parameters

host: string

Returns

func (b *BackendOptions) Ciphers(ciphers string) *BackendOptions

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.

Parameters

ciphers: string

Returns

ClientCertificate

View source
func (b *BackendOptions) ClientCertificate(certificate string, key secretstore.Secret) *BackendOptions

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.

Parameters

certificate: string
key: secretstore.Secret

Returns

ConnectTimeout

View source
func (b *BackendOptions) ConnectTimeout(t time.Duration) *BackendOptions

ConnectTimeout sets the maximum duration to wait for a connection to this backend to be established.

Parameters

t: time.Duration

Returns

FirstByteTimeout

View source
func (b *BackendOptions) FirstByteTimeout(t time.Duration) *BackendOptions

FirstByteTimeout sets the maximum duration to wait for the server response to begin after a TCP connection is established and the request has been sent.

Parameters

t: time.Duration

Returns

Healthcheck

View source
func (b *BackendOptions) Healthcheck(h *BackendHealthcheckOptions) *BackendOptions

Healthcheck sets the backend health check configuration

NOTE: Support for this feature is experimental and may be removed at any time.

Parameters

h: *BackendHealthcheckOptions

Returns

HostOverride

View source
func (b *BackendOptions) HostOverride(host string) *BackendOptions

HostOverride sets the HTTP Host header on connections to this backend.

Parameters

host: string

Returns

HTTPKeepaliveTime

View source
func (b *BackendOptions) HTTPKeepaliveTime(t time.Duration) *BackendOptions

HTTPKeepaliveTime configures how long to allow HTTP connections to remain idle in a connection pool before it should be considered closed.

Parameters

t: time.Duration

Returns

MaxConnections

View source
func (b *BackendOptions) MaxConnections(count uint32) *BackendOptions

MaxConnections sets how many connections to allow in the connection pool for this backend.

0 is treated as unlimited. The default is 200.

Note that this limit is best determined experimentally, since the total number of connections to the backend will depend on POP sizes, HTTP keepalive limits, and the traffic patterns for individual POPs.

Parameters

count: uint32

Returns

MaxLifetime

View source
func (b *BackendOptions) MaxLifetime(t time.Duration) *BackendOptions

MaxLifetime sets an upper bound for how long a pooled HTTP keepalive connection is allowed to have been open before we stop trying to reuse it.

0ms is treated as unlimited. The default is 0ms.

Parameters

t: time.Duration

Returns

func (b *BackendOptions) MaxUse(count uint32) *BackendOptions

MaxUse sets how many times an HTTP keepalive connection can be reused in a connection pool.

0 is treated as unlimited. The default is 0.

Parameters

count: uint32

Returns

PoolConnections

View source
func (b *BackendOptions) PoolConnections(poolingOn bool) *BackendOptions

PoolConnections allows users to turn connection pooling on or off for the backend. Pooling allows the Compute platform to reuse connections across multiple executions, resulting in lower resource use at the server (because it does not need to repeat the TCP handhsake and TLS authentication when the connection is reused). The default is to pool connections. Set this to false to create a new connection to the backend for every incoming request.

Parameters

poolingOn: bool

Returns

PreferIPV6

View source
func (b *BackendOptions) PreferIPV6(v bool) *BackendOptions

PreferIPV6 sets whether to prefer trying IPv6 connections first before IPv4 when a hostname has both A and AAAA records.

This defaults to true.

Parameters

v: bool

Returns

SNIHostname

View source
func (b *BackendOptions) SNIHostname(host string) *BackendOptions

SNIHostname sets the SNI hostname to use on connections to this backend. Setting this will enable SSL for the connection as a side effect.

Parameters

host: string

Returns

SSLMaxVersion

View source
func (b *BackendOptions) SSLMaxVersion(max TLSVersion) *BackendOptions

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.

Parameters

max: TLSVersion

Returns

SSLMinVersion

View source
func (b *BackendOptions) SSLMinVersion(min TLSVersion) *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.

Parameters

min: TLSVersion

Returns

TCPKeepaliveEnable

View source
func (b *BackendOptions) TCPKeepaliveEnable(enable bool) *BackendOptions

TCPKeepaliveEnable sets whether or not to use TCP keepalives to try to maintain the connetion to the backend.

Parameters

enable: bool

Returns

TCPKeepaliveInterval

View source
func (b *BackendOptions) TCPKeepaliveInterval(interval time.Duration) *BackendOptions

TCPKeepaliveInterval sets the interval to use when sending TCP keepalive probes. Intervals of less than 1 second will be rounded up to 1 second.

Setting this value implicitly enables TCP keepalives. If you are calling both this method and TCPKeepAliveEnable with dynamically loaded or generated values, make sure to call TCPKeepAliveEnable last.

Parameters

interval: time.Duration

Returns

TCPKeepaliveProbes

View source
func (b *BackendOptions) TCPKeepaliveProbes(count uint32) *BackendOptions

TCPKeepaliveProbes sets how many unanswered TCP probes we should send to the backend before we consider the connection dead. Setting this value implicitly enables TCP keepalives.

Parameters

count: uint32

Returns

TCPKeepaliveTime

View source
func (b *BackendOptions) TCPKeepaliveTime(interval time.Duration) *BackendOptions

TCPKeepaliveTime sets how long to wait after the last data was sent before starting to send keepalive probes. Setting this value implicitly enables TCP keepalives.

Parameters

interval: time.Duration

Returns

func (b *BackendOptions) UseGRPC(v bool) *BackendOptions

UseGRPC sets whether or not to connect to the backend via gRPC

Parameters

v: bool

Returns

func (b *BackendOptions) UseSSL(v bool) *BackendOptions

UseSSL sets whether or not to require TLS for connections to this backend.

When using TLS, Fastly checks the validity of the backend's certificate, and fails the connection if the certificate is invalid. This check is not optional: an invalid certificate will cause the backend connection to fail (but read on).

By default, the validity check does not require that the certificate hostname matches the hostname of your request. You can use BackendOptions.CertHostname to request a check of the certificate hostname.

By default, certificate validity uses a set of public certificate authorities. You can specify an alternative CA using BackendOptions.CACert.

Parameters

v: bool

Returns