Documentation ¶
Overview ¶
Package fastly provides access to the Fastly Compute hostcall ABI.
The TinyGo SDK is modeled in layers. Each layer has a single purpose. This package is the lowest layer, and it's singular purpose is to adapt each Compute hostcall to a function which is basically idiomatic Go.
In support of that purpose, the package defines a few types, e.g. HTTPBody, which model the modules of the hostcalls, and implement corresponding functions as methods on those types. Each hostcall should have a single corresponding Go method or function.
There are also helper types, like Values, which make it easier to interact with the hostcall ABI. But, in general, this package should be kept as small as possible, and all nontrivial work performed at the next layer up, e.g. package fsthttp.
This package is not and should not be user-accessible. All features, capabilities, etc. that should be accessible by users should be made available via separate packages that treat this package as a dependency.
Index ¶
- Constants
- Variables
- func BackendExists(name string) (bool, error)
- func BackendGetBetweenBytesTimeout(name string) (time.Duration, error)
- func BackendGetConnectTimeout(name string) (time.Duration, error)
- func BackendGetFirstByteTimeout(name string) (time.Duration, error)
- func BackendGetHost(name string) (string, error)
- func BackendGetOverrideHost(name string) (string, error)
- func BackendGetPort(name string) (int, error)
- func BackendIsDynamic(name string) (bool, error)
- func BackendIsSSL(name string) (bool, error)
- func BodyDownstreamGet() (*HTTPRequest, *HTTPBody, error)
- func DeviceLookup(userAgent string) ([]byte, error)
- func DownstreamClientIPAddr() (net.IP, error)
- func DownstreamServerIPAddr() (net.IP, error)
- func DownstreamTLSCipherOpenSSLName() (string, error)
- func DownstreamTLSClientHello() ([]byte, error)
- func DownstreamTLSProtocol() (string, error)
- func ERLCheckRate(rateCounter, entry string, delta uint32, window RateWindow, limit uint32, ...) (bool, error)
- func GeoLookup(ip net.IP) ([]byte, error)
- func GetOriginalHeaderCount() (int, error)
- func GetVCPUMilliseconds() (uint64, error)
- func HandoffFanout(backend string) error
- func HandoffWebsocket(backend string) error
- func ParseUserAgent(userAgent string) (family, major, minor, patch string, err error)
- func PenaltyBoxAdd(penaltyBox, entry string, ttl time.Duration) error
- func PenaltyBoxHas(penaltyBox, entry string) (bool, error)
- func PurgeSurrogateKey(surrogateKey string, opts PurgeOptions) error
- func RateCounterIncrement(rateCounter, entry string, delta uint32) error
- func RateCounterLookupCount(rateCounter, entry string, duration CounterDuration) (uint32, error)
- func RateCounterLookupRate(rateCounter, entry string, window RateWindow) (uint32, error)
- func RegisterDynamicBackend(name string, target string, opts *BackendConfigOptions) error
- type AutoDecompressResponseOptions
- type BackendConfigOptions
- func (b *BackendConfigOptions) BetweenBytesTimeout(t time.Duration)
- func (b *BackendConfigOptions) CACert(caCert string)
- func (b *BackendConfigOptions) CertHostname(certHostname string)
- func (b *BackendConfigOptions) Ciphers(ciphers string)
- func (b *BackendConfigOptions) ClientCert(certificate string, key *Secret)
- func (b *BackendConfigOptions) ConnectTimeout(t time.Duration)
- func (b *BackendConfigOptions) FirstByteTimeout(t time.Duration)
- func (b *BackendConfigOptions) HTTPKeepaliveTime(t time.Duration)
- func (b *BackendConfigOptions) HostOverride(host string)
- func (b *BackendConfigOptions) PoolConnections(poolingOn bool)
- func (b *BackendConfigOptions) SNIHostname(sniHostname string)
- func (b *BackendConfigOptions) SSLMaxVersion(v TLSVersion)
- func (b *BackendConfigOptions) SSLMinVersion(v TLSVersion)
- func (b *BackendConfigOptions) TCPKeepaliveEnable(v bool)
- func (b *BackendConfigOptions) TCPKeepaliveInterval(t time.Duration)
- func (b *BackendConfigOptions) TCPKeepaliveProbes(count uint32)
- func (b *BackendConfigOptions) TCPKeepaliveTime(t time.Duration)
- func (b *BackendConfigOptions) UseGRPC(v bool)
- func (b *BackendConfigOptions) UseSSL(v bool)
- type BackendHealth
- type CacheEntry
- func (c *CacheEntry) Age() (time.Duration, error)
- func (c *CacheEntry) Body(opts CacheGetBodyOptions) (*HTTPBody, error)
- func (e *CacheEntry) Cancel() error
- func (c *CacheEntry) Close() error
- func (c *CacheEntry) Hits() (uint64, error)
- func (e *CacheEntry) Insert(opts CacheWriteOptions) (*HTTPBody, error)
- func (e *CacheEntry) InsertAndStreamBack(opts CacheWriteOptions) (*HTTPBody, *CacheEntry, error)
- func (c *CacheEntry) Length() (uint64, error)
- func (c *CacheEntry) MaxAge() (time.Duration, error)
- func (c *CacheEntry) StaleWhileRevalidate() (time.Duration, error)
- func (c *CacheEntry) State() (CacheLookupState, error)
- func (e *CacheEntry) Update(opts CacheWriteOptions) error
- func (c *CacheEntry) UserMetadata() ([]byte, error)
- type CacheGetBodyOptions
- type CacheLookupOptions
- type CacheLookupState
- type CacheOverrideOptions
- type CacheWriteOptions
- func (o *CacheWriteOptions) ContentLength(v uint64) error
- func (o *CacheWriteOptions) InitialAge(v time.Duration) error
- func (o *CacheWriteOptions) MaxAge(v time.Duration) error
- func (o *CacheWriteOptions) SensitiveData(v bool) error
- func (o *CacheWriteOptions) SetRequest(req *HTTPRequest) error
- func (o *CacheWriteOptions) StaleWhileRevalidate(v time.Duration) error
- func (o *CacheWriteOptions) SurrogateKeys(v []string) error
- func (o *CacheWriteOptions) UserMetadata(v []byte) error
- func (o *CacheWriteOptions) Vary(v []string) error
- type ConfigStore
- type CounterDuration
- type Dictionary
- type FastlyError
- type FastlyStatus
- type HTTPBody
- type HTTPRequest
- func (r *HTTPRequest) AppendHeader(name, value string) error
- func (r *HTTPRequest) GetHeaderNames(maxHeaderNameLen int) *Values
- func (r *HTTPRequest) GetHeaderValue(name string, maxHeaderValueLen int) (string, error)
- func (r *HTTPRequest) GetHeaderValues(name string, maxHeaderValueLen int) *Values
- func (r *HTTPRequest) GetMethod() (string, error)
- func (r *HTTPRequest) GetURI() (string, error)
- func (r *HTTPRequest) GetVersion() (proto string, major, minor int, err error)
- func (r *HTTPRequest) InsertHeader(name, value string) error
- func (r *HTTPRequest) RemoveHeader(name string) error
- func (r *HTTPRequest) Send(requestBody *HTTPBody, backend string) (response *HTTPResponse, responseBody *HTTPBody, err error)
- func (r *HTTPRequest) SendAsync(requestBody *HTTPBody, backend string) (*PendingRequest, error)
- func (r *HTTPRequest) SendAsyncStreaming(requestBody *HTTPBody, backend string) (*PendingRequest, error)
- func (r *HTTPRequest) SetAutoDecompressResponse(options AutoDecompressResponseOptions) error
- func (r *HTTPRequest) SetCacheOverride(options CacheOverrideOptions) error
- func (r *HTTPRequest) SetFramingHeadersMode(manual bool) error
- func (r *HTTPRequest) SetHeaderValues(name string, values []string) error
- func (r *HTTPRequest) SetMethod(method string) error
- func (r *HTTPRequest) SetURI(uri string) error
- func (r *HTTPRequest) SetVersion(v HTTPVersion) error
- type HTTPResponse
- func (r *HTTPResponse) AppendHeader(name, value string) error
- func (r *HTTPResponse) GetAddrDestIP() (net.IP, error)
- func (r *HTTPResponse) GetAddrDestPort() (uint16, error)
- func (r *HTTPResponse) GetHeaderNames(maxHeaderNameLen int) *Values
- func (r *HTTPResponse) GetHeaderValue(name string, maxHeaderValueLen int) (string, error)
- func (r *HTTPResponse) GetHeaderValues(name string, maxHeaderValueLen int) *Values
- func (r *HTTPResponse) GetStatusCode() (int, error)
- func (r *HTTPResponse) GetVersion() (proto string, major, minor int, err error)
- func (r *HTTPResponse) InsertHeader(name, value string) error
- func (r *HTTPResponse) RemoveHeader(name string) error
- func (r *HTTPResponse) SendDownstream(responseBody *HTTPBody, stream bool) error
- func (r *HTTPResponse) SetFramingHeadersMode(manual bool) error
- func (r *HTTPResponse) SetHeaderValues(name string, values []string) error
- func (r *HTTPResponse) SetStatusCode(code int) error
- func (r *HTTPResponse) SetVersion(v HTTPVersion) error
- type HTTPVersion
- type KVStore
- type LogEndpoint
- type PendingRequest
- type PurgeOptions
- type RateWindow
- type Secret
- type SecretStore
- type TLSVersion
- type Values
Constants ¶
const ( DefaultSmallBufLen = 128 // default size for "typically-small" values with variable sizes: HTTP methods, header names, tls protocol names, cipher suites DefaultMediumBufLen = 1024 // default size for values between small and large, with variable sizes DefaultLargeBufLen = 8192 // default size for "typically-large" values with variable sizes; header values, URLs. )
Variables ¶
var ( RateWindow1s = RateWindow{/* contains filtered or unexported fields */} RateWindow10s = RateWindow{/* contains filtered or unexported fields */} RateWindow60s = RateWindow{/* contains filtered or unexported fields */} )
var ( CounterDuration10s = CounterDuration{/* contains filtered or unexported fields */} CounterDuration20s = CounterDuration{/* contains filtered or unexported fields */} CounterDuration30s = CounterDuration{/* contains filtered or unexported fields */} CounterDuration40s = CounterDuration{/* contains filtered or unexported fields */} CounterDuration50s = CounterDuration{/* contains filtered or unexported fields */} CounterDuration60s = CounterDuration{/* contains filtered or unexported fields */} )
Functions ¶
func BackendExists ¶ added in v0.1.7
func BackendGetBetweenBytesTimeout ¶ added in v0.1.7
func BackendGetConnectTimeout ¶ added in v0.1.7
func BackendGetFirstByteTimeout ¶ added in v0.1.7
func BackendGetHost ¶ added in v0.1.7
func BackendGetOverrideHost ¶ added in v0.1.7
func BackendGetPort ¶ added in v0.1.7
func BackendIsDynamic ¶ added in v0.1.7
func BackendIsSSL ¶ added in v0.1.7
func BodyDownstreamGet ¶
func BodyDownstreamGet() (*HTTPRequest, *HTTPBody, error)
func DeviceLookup ¶ added in v1.2.0
func DownstreamClientIPAddr ¶
func DownstreamServerIPAddr ¶ added in v1.3.3
func DownstreamTLSProtocol ¶
func ERLCheckRate ¶ added in v1.3.0
func GetOriginalHeaderCount ¶
func GetVCPUMilliseconds ¶ added in v1.3.3
func HandoffFanout ¶ added in v0.1.7
func HandoffWebsocket ¶ added in v0.1.7
func ParseUserAgent ¶
func PenaltyBoxAdd ¶ added in v1.3.0
func PenaltyBoxHas ¶ added in v1.3.0
func PurgeSurrogateKey ¶ added in v0.1.4
func PurgeSurrogateKey(surrogateKey string, opts PurgeOptions) error
func RateCounterIncrement ¶ added in v1.3.0
func RateCounterLookupCount ¶ added in v1.3.0
func RateCounterLookupCount(rateCounter, entry string, duration CounterDuration) (uint32, error)
func RateCounterLookupRate ¶ added in v1.3.0
func RateCounterLookupRate(rateCounter, entry string, window RateWindow) (uint32, error)
func RegisterDynamicBackend ¶ added in v0.1.5
func RegisterDynamicBackend(name string, target string, opts *BackendConfigOptions) error
Types ¶
type AutoDecompressResponseOptions ¶
type AutoDecompressResponseOptions struct {
Gzip bool
}
AutoDecompressResponseOptions collects the auto decompress response options for the request. See the equivalent DecompressResponseOptions type in package fsthttp for more detailed descriptions of each field.
type BackendConfigOptions ¶ added in v0.1.5
type BackendConfigOptions struct {
// contains filtered or unexported fields
}
func (*BackendConfigOptions) BetweenBytesTimeout ¶ added in v0.1.5
func (b *BackendConfigOptions) BetweenBytesTimeout(t time.Duration)
func (*BackendConfigOptions) CACert ¶ added in v0.1.5
func (b *BackendConfigOptions) CACert(caCert string)
func (*BackendConfigOptions) CertHostname ¶ added in v0.1.5
func (b *BackendConfigOptions) CertHostname(certHostname string)
func (*BackendConfigOptions) Ciphers ¶ added in v0.1.5
func (b *BackendConfigOptions) Ciphers(ciphers string)
func (*BackendConfigOptions) ClientCert ¶ added in v1.3.3
func (b *BackendConfigOptions) ClientCert(certificate string, key *Secret)
func (*BackendConfigOptions) ConnectTimeout ¶ added in v0.1.5
func (b *BackendConfigOptions) ConnectTimeout(t time.Duration)
func (*BackendConfigOptions) FirstByteTimeout ¶ added in v0.1.5
func (b *BackendConfigOptions) FirstByteTimeout(t time.Duration)
func (*BackendConfigOptions) HTTPKeepaliveTime ¶ added in v1.3.3
func (b *BackendConfigOptions) HTTPKeepaliveTime(t time.Duration)
func (*BackendConfigOptions) HostOverride ¶ added in v0.1.5
func (b *BackendConfigOptions) HostOverride(host string)
func (*BackendConfigOptions) PoolConnections ¶ added in v1.3.3
func (b *BackendConfigOptions) PoolConnections(poolingOn bool)
func (*BackendConfigOptions) SNIHostname ¶ added in v0.1.5
func (b *BackendConfigOptions) SNIHostname(sniHostname string)
func (*BackendConfigOptions) SSLMaxVersion ¶ added in v0.1.5
func (b *BackendConfigOptions) SSLMaxVersion(v TLSVersion)
func (*BackendConfigOptions) SSLMinVersion ¶ added in v0.1.5
func (b *BackendConfigOptions) SSLMinVersion(v TLSVersion)
func (*BackendConfigOptions) TCPKeepaliveEnable ¶ added in v1.3.3
func (b *BackendConfigOptions) TCPKeepaliveEnable(v bool)
func (*BackendConfigOptions) TCPKeepaliveInterval ¶ added in v1.3.3
func (b *BackendConfigOptions) TCPKeepaliveInterval(t time.Duration)
func (*BackendConfigOptions) TCPKeepaliveProbes ¶ added in v1.3.3
func (b *BackendConfigOptions) TCPKeepaliveProbes(count uint32)
func (*BackendConfigOptions) TCPKeepaliveTime ¶ added in v1.3.3
func (b *BackendConfigOptions) TCPKeepaliveTime(t time.Duration)
func (*BackendConfigOptions) UseGRPC ¶ added in v1.3.3
func (b *BackendConfigOptions) UseGRPC(v bool)
func (*BackendConfigOptions) UseSSL ¶ added in v0.1.5
func (b *BackendConfigOptions) UseSSL(v bool)
type BackendHealth ¶ added in v0.1.7
witx:
(typename $backend_health (enum (@witx tag u32) $unknown $healthy $unhealthy))
const ( BackendHealthUnknown BackendHealth = 0 BackendHealthHealthy BackendHealth = 1 BackendHealthUnhealthy BackendHealth = 2 )
func BackendIsHealthy ¶ added in v0.1.7
func BackendIsHealthy(name string) (BackendHealth, error)
type CacheEntry ¶ added in v0.1.4
type CacheEntry struct{}
func CacheLookup ¶ added in v0.1.4
func CacheLookup(key []byte, opts CacheLookupOptions) (*CacheEntry, error)
func CacheTransactionLookup ¶ added in v0.1.4
func CacheTransactionLookup(key []byte, opts CacheLookupOptions) (*CacheEntry, error)
func (*CacheEntry) Body ¶ added in v0.1.4
func (c *CacheEntry) Body(opts CacheGetBodyOptions) (*HTTPBody, error)
func (*CacheEntry) Cancel ¶ added in v0.1.4
func (e *CacheEntry) Cancel() error
func (*CacheEntry) Close ¶ added in v0.1.4
func (c *CacheEntry) Close() error
func (*CacheEntry) Hits ¶ added in v0.1.4
func (c *CacheEntry) Hits() (uint64, error)
func (*CacheEntry) Insert ¶ added in v0.1.4
func (e *CacheEntry) Insert(opts CacheWriteOptions) (*HTTPBody, error)
func (*CacheEntry) InsertAndStreamBack ¶ added in v0.1.4
func (e *CacheEntry) InsertAndStreamBack(opts CacheWriteOptions) (*HTTPBody, *CacheEntry, error)
func (*CacheEntry) Length ¶ added in v0.1.4
func (c *CacheEntry) Length() (uint64, error)
func (*CacheEntry) StaleWhileRevalidate ¶ added in v0.1.4
func (c *CacheEntry) StaleWhileRevalidate() (time.Duration, error)
func (*CacheEntry) State ¶ added in v0.1.4
func (c *CacheEntry) State() (CacheLookupState, error)
func (*CacheEntry) Update ¶ added in v0.1.4
func (e *CacheEntry) Update(opts CacheWriteOptions) error
func (*CacheEntry) UserMetadata ¶ added in v0.1.4
func (c *CacheEntry) UserMetadata() ([]byte, error)
type CacheGetBodyOptions ¶ added in v0.1.4
type CacheGetBodyOptions struct{}
func (*CacheGetBodyOptions) From ¶ added in v0.1.4
func (o *CacheGetBodyOptions) From(from uint64) error
func (*CacheGetBodyOptions) To ¶ added in v0.1.4
func (o *CacheGetBodyOptions) To(to uint64) error
type CacheLookupOptions ¶ added in v0.1.4
type CacheLookupOptions struct{}
func (*CacheLookupOptions) SetRequest ¶ added in v0.1.4
func (o *CacheLookupOptions) SetRequest(req *HTTPRequest) error
type CacheLookupState ¶ added in v0.1.4
witx:
;;; The status of this lookup (and potential transaction) (typename $cache_lookup_state (flags (@witx repr u32) $found ;; a cached object was found $usable ;; the cached object is valid to use (implies $found) $stale ;; the cached object is stale (but may or may not be valid to use) $must_insert_or_update ;; this client is requested to insert or revalidate an object ) )
const ( CacheLookupStateFound CacheLookupState = 0b0000_0001 // $found CacheLookupStateUsable CacheLookupState = 0b0000_0010 // $usable CacheLookupStateStale CacheLookupState = 0b0000_0100 // $stale CacheLookupStateMustInsertOrUpdate CacheLookupState = 0b0000_1000 // $must_insert_or_update )
type CacheOverrideOptions ¶
type CacheOverrideOptions struct { Pass bool PCI bool TTL uint32 // seconds StaleWhileRevalidate uint32 // seconds SurrogateKey string }
CacheOverrideOptions collects specific, caching-related options for outbound requests. See the equivalent CacheOverrideOptions type in package fsthttp for more detailed descriptions of each field.
type CacheWriteOptions ¶ added in v0.1.4
type CacheWriteOptions struct{}
func (*CacheWriteOptions) ContentLength ¶ added in v0.1.4
func (o *CacheWriteOptions) ContentLength(v uint64) error
func (*CacheWriteOptions) InitialAge ¶ added in v0.1.4
func (o *CacheWriteOptions) InitialAge(v time.Duration) error
func (*CacheWriteOptions) MaxAge ¶ added in v0.1.4
func (o *CacheWriteOptions) MaxAge(v time.Duration) error
func (*CacheWriteOptions) SensitiveData ¶ added in v0.1.4
func (o *CacheWriteOptions) SensitiveData(v bool) error
func (*CacheWriteOptions) SetRequest ¶ added in v0.1.4
func (o *CacheWriteOptions) SetRequest(req *HTTPRequest) error
func (*CacheWriteOptions) StaleWhileRevalidate ¶ added in v0.1.4
func (o *CacheWriteOptions) StaleWhileRevalidate(v time.Duration) error
func (*CacheWriteOptions) SurrogateKeys ¶ added in v0.1.4
func (o *CacheWriteOptions) SurrogateKeys(v []string) error
func (*CacheWriteOptions) UserMetadata ¶ added in v0.1.4
func (o *CacheWriteOptions) UserMetadata(v []byte) error
func (*CacheWriteOptions) Vary ¶ added in v0.1.4
func (o *CacheWriteOptions) Vary(v []string) error
type ConfigStore ¶ added in v1.3.3
type ConfigStore struct{}
func OpenConfigStore ¶ added in v1.3.3
func OpenConfigStore(name string) (*ConfigStore, error)
type CounterDuration ¶ added in v1.3.0
type CounterDuration struct {
// contains filtered or unexported fields
}
func (CounterDuration) String ¶ added in v1.3.0
func (c CounterDuration) String() string
type Dictionary ¶
type Dictionary struct{}
func OpenDictionary ¶
func OpenDictionary(name string) (*Dictionary, error)
type FastlyError ¶
type FastlyError struct { Status FastlyStatus // Detail contains an additional detailed error, if any. Detail error }
FastlyError decorates error-class FastlyStatus values and implements the error interface.
Note that TinyGo currently doesn't support errors.As. Callers can use the IsFastlyError helper instead.
func (FastlyError) Error ¶
func (e FastlyError) Error() string
Error implements the error interface.
type FastlyStatus ¶
type FastlyStatus uint32
FastlyStatus models a response status enum.
const ( // FastlyStatusOK maps to $fastly_status $ok. // TODO(pb): is this the only non-error status? FastlyStatusOK FastlyStatus = 0 // FastlyStatusError maps to $fastly_status $error. FastlyStatusError FastlyStatus = 1 // FastlyStatusInval maps to $fastly_status $inval. FastlyStatusInval FastlyStatus = 2 // FastlyStatusBadf maps to $fastly_status $badf. FastlyStatusBadf FastlyStatus = 3 // FastlyStatusBufLen maps to $fastly_status $buflen. FastlyStatusBufLen FastlyStatus = 4 // FastlyStatusUnsupported maps to $fastly_status $unsupported. FastlyStatusUnsupported FastlyStatus = 5 // FastlyStatusBadAlign maps to $fastly_status $badalign. FastlyStatusBadAlign FastlyStatus = 6 // FastlyStatusHTTPInvalid maps to $fastly_status $httpinvalid. FastlyStatusHTTPInvalid FastlyStatus = 7 // FastlyStatusHTTPUser maps to $fastly_status $httpuser. FastlyStatusHTTPUser FastlyStatus = 8 // FastlyStatusHTTPIncomplete maps to $fastly_status $httpincomplete. FastlyStatusHTTPIncomplete FastlyStatus = 9 // FastlyStatusNone maps to $fastly_status $none. FastlyStatusNone FastlyStatus = 10 // FastlyStatusHTTPHeadTooLarge maps to $fastly_status $httpheadtoolarge. FastlyStatusHTTPHeadTooLarge FastlyStatus = 11 // FastlyStatusHTTPInvalidStatus maps to $fastly_status $httpinvalidstatus. FastlyStatusHTTPInvalidStatus FastlyStatus = 12 // FastlyStatusLimitExceeded maps to $fastly_status $limitexceeded. FastlyStatusLimitExceeded FastlyStatus = 13 )
func IsFastlyError ¶
func IsFastlyError(err error) (FastlyStatus, bool)
IsFastlyError detects and unwraps a FastlyError to its component parts.
type HTTPBody ¶
type HTTPBody struct{}
func CacheInsert ¶ added in v0.1.4
func CacheInsert(key []byte, opts CacheWriteOptions) (*HTTPBody, error)
func NewHTTPBody ¶
type HTTPRequest ¶
type HTTPRequest struct{}
func NewHTTPRequest ¶
func NewHTTPRequest() (*HTTPRequest, error)
func (*HTTPRequest) AppendHeader ¶
func (r *HTTPRequest) AppendHeader(name, value string) error
func (*HTTPRequest) GetHeaderNames ¶
func (r *HTTPRequest) GetHeaderNames(maxHeaderNameLen int) *Values
func (*HTTPRequest) GetHeaderValue ¶
func (r *HTTPRequest) GetHeaderValue(name string, maxHeaderValueLen int) (string, error)
func (*HTTPRequest) GetHeaderValues ¶
func (r *HTTPRequest) GetHeaderValues(name string, maxHeaderValueLen int) *Values
func (*HTTPRequest) GetMethod ¶
func (r *HTTPRequest) GetMethod() (string, error)
func (*HTTPRequest) GetURI ¶
func (r *HTTPRequest) GetURI() (string, error)
func (*HTTPRequest) GetVersion ¶
func (r *HTTPRequest) GetVersion() (proto string, major, minor int, err error)
func (*HTTPRequest) InsertHeader ¶
func (r *HTTPRequest) InsertHeader(name, value string) error
func (*HTTPRequest) RemoveHeader ¶
func (r *HTTPRequest) RemoveHeader(name string) error
func (*HTTPRequest) Send ¶
func (r *HTTPRequest) Send(requestBody *HTTPBody, backend string) (response *HTTPResponse, responseBody *HTTPBody, err error)
func (*HTTPRequest) SendAsync ¶
func (r *HTTPRequest) SendAsync(requestBody *HTTPBody, backend string) (*PendingRequest, error)
func (*HTTPRequest) SendAsyncStreaming ¶
func (r *HTTPRequest) SendAsyncStreaming(requestBody *HTTPBody, backend string) (*PendingRequest, error)
func (*HTTPRequest) SetAutoDecompressResponse ¶
func (r *HTTPRequest) SetAutoDecompressResponse(options AutoDecompressResponseOptions) error
func (*HTTPRequest) SetCacheOverride ¶
func (r *HTTPRequest) SetCacheOverride(options CacheOverrideOptions) error
func (*HTTPRequest) SetFramingHeadersMode ¶
func (r *HTTPRequest) SetFramingHeadersMode(manual bool) error
func (*HTTPRequest) SetHeaderValues ¶
func (r *HTTPRequest) SetHeaderValues(name string, values []string) error
func (*HTTPRequest) SetMethod ¶
func (r *HTTPRequest) SetMethod(method string) error
func (*HTTPRequest) SetURI ¶
func (r *HTTPRequest) SetURI(uri string) error
func (*HTTPRequest) SetVersion ¶
func (r *HTTPRequest) SetVersion(v HTTPVersion) error
type HTTPResponse ¶
type HTTPResponse struct{}
func NewHTTPResponse ¶
func NewHTTPResponse() (*HTTPResponse, error)
func (*HTTPResponse) AppendHeader ¶
func (r *HTTPResponse) AppendHeader(name, value string) error
func (*HTTPResponse) GetAddrDestIP ¶ added in v1.3.3
func (r *HTTPResponse) GetAddrDestIP() (net.IP, error)
func (*HTTPResponse) GetAddrDestPort ¶ added in v1.3.3
func (r *HTTPResponse) GetAddrDestPort() (uint16, error)
func (*HTTPResponse) GetHeaderNames ¶
func (r *HTTPResponse) GetHeaderNames(maxHeaderNameLen int) *Values
func (*HTTPResponse) GetHeaderValue ¶
func (r *HTTPResponse) GetHeaderValue(name string, maxHeaderValueLen int) (string, error)
func (*HTTPResponse) GetHeaderValues ¶
func (r *HTTPResponse) GetHeaderValues(name string, maxHeaderValueLen int) *Values
func (*HTTPResponse) GetStatusCode ¶
func (r *HTTPResponse) GetStatusCode() (int, error)
func (*HTTPResponse) GetVersion ¶
func (r *HTTPResponse) GetVersion() (proto string, major, minor int, err error)
func (*HTTPResponse) InsertHeader ¶
func (r *HTTPResponse) InsertHeader(name, value string) error
func (*HTTPResponse) RemoveHeader ¶
func (r *HTTPResponse) RemoveHeader(name string) error
func (*HTTPResponse) SendDownstream ¶
func (r *HTTPResponse) SendDownstream(responseBody *HTTPBody, stream bool) error
func (*HTTPResponse) SetFramingHeadersMode ¶
func (r *HTTPResponse) SetFramingHeadersMode(manual bool) error
func (*HTTPResponse) SetHeaderValues ¶
func (r *HTTPResponse) SetHeaderValues(name string, values []string) error
func (*HTTPResponse) SetStatusCode ¶
func (r *HTTPResponse) SetStatusCode(code int) error
func (*HTTPResponse) SetVersion ¶
func (r *HTTPResponse) SetVersion(v HTTPVersion) error
type HTTPVersion ¶
type HTTPVersion uint32
HTTPVersion describes an HTTP protocol version.
const ( // HTTPVersionHTTP09 describes HTTP/0.9. HTTPVersionHTTP09 HTTPVersion = 0 // HTTPVersionHTTP10 describes HTTP/1.0. HTTPVersionHTTP10 HTTPVersion = 1 // HTTPVersionHTTP11 describes HTTP/1.1. HTTPVersionHTTP11 HTTPVersion = 2 // HTTPVersionH2 describes HTTP/2. HTTPVersionH2 HTTPVersion = 3 // HTTPVersionH3 describes HTTP/3. HTTPVersionH3 HTTPVersion = 4 )
type KVStore ¶ added in v0.1.3
type KVStore struct{}
func OpenKVStore ¶ added in v0.1.3
type LogEndpoint ¶
type LogEndpoint struct{}
func GetLogEndpoint ¶
func GetLogEndpoint(name string) (*LogEndpoint, error)
type PendingRequest ¶
type PendingRequest struct{}
func (*PendingRequest) Poll ¶
func (r *PendingRequest) Poll() (done bool, response *HTTPResponse, responseBody *HTTPBody, err error)
func (*PendingRequest) Wait ¶
func (r *PendingRequest) Wait() (response *HTTPResponse, responseBody *HTTPBody, err error)
type PurgeOptions ¶ added in v0.1.4
type PurgeOptions struct{}
func (*PurgeOptions) SoftPurge ¶ added in v0.1.4
func (o *PurgeOptions) SoftPurge(v bool) error
type RateWindow ¶ added in v1.3.0
type RateWindow struct {
// contains filtered or unexported fields
}
func (RateWindow) String ¶ added in v1.3.0
func (r RateWindow) String() string
type SecretStore ¶ added in v0.1.2
type SecretStore struct{}
func OpenSecretStore ¶ added in v0.1.2
func OpenSecretStore(name string) (*SecretStore, error)
type TLSVersion ¶ added in v0.1.5
witx:
(typename $tls_version (enum (@witx tag u32) $tls_1 $tls_1_1 $tls_1_2 $tls_1_3))
const ( TLSVersion1_0 TLSVersion = 0 TLSVersion1_1 TLSVersion = 1 TLSVersion1_2 TLSVersion = 2 TLSVersion1_3 TLSVersion = 3 )
func BackendGetSSLMaxVersion ¶ added in v0.1.7
func BackendGetSSLMaxVersion(name string) (TLSVersion, error)
func BackendGetSSLMinVersion ¶ added in v0.1.7
func BackendGetSSLMinVersion(name string) (TLSVersion, error)
type Values ¶
type Values struct {
// contains filtered or unexported fields
}
Values is the result of a multi-value hostcall. It offers an iterator API similar to bufio.Scanner or sql.Rows.
func GetOriginalHeaderNames ¶
func GetOriginalHeaderNames() *Values
func (*Values) Bytes ¶
Bytes returns the most recent value generated by a call to Next. The underlying array may point to data that will be overwritten by a subsequent call to Next. Bytes performs no allocation.
func (*Values) Next ¶
Next prepares the next value for reading with the Bytes method. It returns true on success, or false if there are no more values, or an error occurred. Err should be called to distinguish between those two cases. Every call to Bytes, even the first one, must be preceded by a call to Next.