Documentation ¶
Index ¶
- type EdgeRuntime
- type Header
- type Resource
- func AclResource[T EdgeRuntime](name string, v *vintage.Acl) Resource[T]
- func BackendResource[T EdgeRuntime](name string, v *vintage.Backend) Resource[T]
- func LoggingResource[T EdgeRuntime](name string, v *vintage.LoggingEndpoint) Resource[T]
- func SubroutineResource[T EdgeRuntime](name string, v Subroutine[T]) Resource[T]
- func TableResource[T EdgeRuntime](name string, v *vintage.Table) Resource[T]
- type Runtime
- func (c *Runtime[T]) Cleanup()
- func (c *Runtime[T]) GetClientIdentity() string
- func (c *Runtime[T]) Lifecycle(ctx context.Context, r T) error
- func (c *Runtime[T]) RegexpMatch(src, dst string) (bool, error)
- func (c *Runtime[T]) Register(resources ...Resource[T])
- func (c *Runtime[T]) RequestDigest() string
- func (c *Runtime[T]) RequestRangeHeader(mode string) (int64, error)
- type SameSite
- type Subroutine
- type UserAgent
- func (u *UserAgent) BotName() string
- func (u *UserAgent) BrowserName() string
- func (u *UserAgent) BrowserVersion() string
- func (u *UserAgent) IsBot() bool
- func (u *UserAgent) IsBrowser() bool
- func (u *UserAgent) IsEReader() bool
- func (u *UserAgent) IsGameConsole() bool
- func (u *UserAgent) IsMobile() bool
- func (u *UserAgent) IsSmartTV() bool
- func (u *UserAgent) IsTablet() bool
- func (u *UserAgent) IsTouchScreen() bool
- func (u *UserAgent) IsTvPlayer() bool
- func (u *UserAgent) OSName() string
- func (u *UserAgent) OSVersion() string
- type Waf
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EdgeRuntime ¶
type EdgeRuntime interface { // Execute starts VCL request lifecycle. Execute(context.Context) error // CreateBackendRequest is hook point of making bereq from req // This hook will be called before calling vcl_pass or vcl_miss // Must return raw headers of BackendRequest CreateBackendRequest() vintage.RawHeader // CreateBackendRequest is hook point of making resp from beresp // This hook will be called before calling vcl_deliver // Must return raw headers of ClientResponse CreateClientResponse() (vintage.RawHeader, error) // CreateObjectResponse is hool poing of construct object response. // This hook will be called before calling vcl_error. // VCL may call without request proxying like "error 400" statement, // then object (backend response) is nil, so runtime have to construct from empty. // First argument is status code that is set via error [statusCode] // Second argument is response body that is set via error [statusCode] [response] CreateObjectResponse(int, string) (vintage.RawHeader, error) // Proxy is hook point for actual senging origin request. // This hook will be called before calling vcl_fetch // Must return raw headers of BackendResponse Proxy(ctx context.Context, backendName string) (vintage.RawHeader, error) // WriteResponse is hook point for sending client response. // This hook will be called before calling vcl_log // the response is exact 3 length of in64 slice: // 0. written header bytes // 1. written body bytes // 2. written response bytes (include status line) WriteResponse() ([3]int64, error) }
type Header ¶
type Header struct {
MH textproto.MIMEHeader
}
func (*Header) DeleteSetCookie ¶
Used for setcookie.delete_by_name()
func (*Header) GetSetCookie ¶
Used for setcookie.get_value_by_name()
type Resource ¶
type Resource[T EdgeRuntime] func(c *Runtime[T])
func AclResource ¶
func AclResource[T EdgeRuntime](name string, v *vintage.Acl) Resource[T]
func BackendResource ¶
func BackendResource[T EdgeRuntime](name string, v *vintage.Backend) Resource[T]
func LoggingResource ¶
func LoggingResource[T EdgeRuntime](name string, v *vintage.LoggingEndpoint) Resource[T]
func SubroutineResource ¶
func SubroutineResource[T EdgeRuntime](name string, v Subroutine[T]) Resource[T]
func TableResource ¶
func TableResource[T EdgeRuntime](name string, v *vintage.Table) Resource[T]
type Runtime ¶
type Runtime[T EdgeRuntime] struct { Backend *vintage.Backend RequestHeader *Header BackendRequestHeader *Header BackendResponseHeader *Header ResponseHeader *Header RequestStartTime time.Time RequestEndTime time.Time Restarts int RequestHash string RequestHeaderBytes int64 ClientIp net.IP ClientIdentity string // We should implement User-Agent related matcher by ourselves UserAgent *UserAgent // Temporal WAF related variables Waf *Waf // Declaration stacks Backends map[string]*vintage.Backend Acls map[string]*vintage.Acl Tables map[string]*vintage.Table Subroutines map[string]Subroutine[T] LoggingEndpoints map[string]*vintage.LoggingEndpoint // Properties that will be assigned in the process OriginalHost string MaxStaleIfError time.Duration MaxStaleWhileRevalidate time.Duration ClientSocketCongestionAlgorithm string ClientSocketCWND int64 ClientSocketPace int64 EsiAllowInsideData bool EnableESI bool ESILevel int64 IsLocallyGenerated bool TimeToFirstByte time.Duration BackendResponseBrotli bool BackendResponseCachable bool BackendResponseDoESI bool BackendResponseDoStream bool BackendResponseGrace bool BackendResponseGzip bool BackendResponseHipaa bool BackendResponsePCI bool BackendResponseStaleIfError time.Duration BackendResponseStaleWhileRevalidate time.Duration BackendResponseTTL time.Duration ObjectStaleIfError time.Duration ObjectStaleWhileRevalidate time.Duration ObjectTTL time.Duration ObjectStatus int64 ObjectResponse string EnableRangeOnPass bool EnableSegmentedCaching bool HashAlwaysMiss bool HashIgnoreBusy bool ResponseBytesWritten int64 ResponseBodyBytesWritten int64 ResponseHeaderBytesWritten int64 GeoIpOverride string GeoIpUseXForwardedFor bool SegmentedCachingBlockSize int64 SaintMode bool ResponseStale bool ResponseStaleIsError bool ResponseStaleIsRevalidating bool ResponseCompleted bool // Following fields are set via builtin function FastlyError string DisableCompressionHeaders []string PushResources []string H3AltSvc bool }
func NewRuntime ¶
func NewRuntime[T EdgeRuntime](r map[string][]string, resources ...Resource[T]) *Runtime[T]
func (*Runtime[T]) GetClientIdentity ¶
Used for client.identity
type SameSite ¶
type SameSite int
SameSite allows a server to define a cookie attribute making it impossible for the browser to send this cookie along with cross-site requests. The main goal is to mitigate the risk of cross-origin information leakage, and provide some protection against cross-site request forgery attacks.
See https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00 for details.
type Subroutine ¶
type Subroutine[T EdgeRuntime] func(ctx T) (vintage.State, error)
type UserAgent ¶
type UserAgent struct {
// contains filtered or unexported fields
}
UserAgent struct wraps uasurfer library and returns User-Agent related values. Currently we truct this package but we should implement some or more features in the future, The we could replace this library without changing method interfaces.
func NewUserAgent ¶
func (*UserAgent) BrowserName ¶
used for client.browser.name
func (*UserAgent) BrowserVersion ¶
used for client.browser.version
func (*UserAgent) IsGameConsole ¶
used for client.platform.gameconsole
func (*UserAgent) IsTouchScreen ¶
used for client.display.touchscreen
func (*UserAgent) IsTvPlayer ¶
used for client.platform.tvplayer
type Waf ¶
type Waf struct { AnomalyScore int64 Blocked bool Counter int64 Executed bool Failures int64 HttpViolationScore int64 InboundAnomalyScore int64 LFIScore int64 Logdata string Logged bool Message string Passed bool PHPInjectionScore int64 RCEScore int64 RFIScore int64 RuleId int64 SessionFixationScore int64 SQLInjectionScore int64 Severity int64 XSSScore int64 }
Currently Edge runtime does not support WAF Can be set and get but always returns zero value or set value