Documentation
¶
Index ¶
- func BrowserFlags() []cli.Flag
- func FromConfig(path string, envVars ...string) cli.ValueSourceChain
- func LoggingFlags() []cli.Flag
- func RateLimitFlags() []cli.Flag
- func ServerFlags() []cli.Flag
- func TracingFlags() []cli.Flag
- type BrowserConfig
- type LogLevel
- type LoggingConfig
- type RateLimitConfig
- type ServerConfig
- type TLSVersion
- type TracingConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BrowserFlags ¶
func FromConfig ¶
func FromConfig(path string, envVars ...string) cli.ValueSourceChain
func LoggingFlags ¶
func RateLimitFlags ¶
func ServerFlags ¶
func TracingFlags ¶
Types ¶
type BrowserConfig ¶
type BrowserConfig struct {
// Path is the path to the browser binary.
// This is resolved against PATH.
Path string
// Flags are the parameters to pass to the browser.
// A leading `--` is implied, but still valid to pass in.
Flags []string
// GPU indicates whether to enable GPU support in the browser.
GPU bool
// Sandbox indicates whether to enable the browser's sandbox.
// This may require extra configuration on the service to work properly in Kubernetes and similar environments, but in exchange, it is a very good security practice.
Sandbox bool
// Namespaced indicates whether to run the browser in a new namespace jail.
// This is implemented by the service itself. It requires Linux and some capabilities (CAP_SYS_ADMIN, CAP_SYS_CHROOT) or a privileged user.
// Most users don't need this, but it may be interesting for users who care more about security than performance.
Namespaced bool
// TimeZone is the timezone for the browser to use.
TimeZone *time.Location // DeepClone: can be copied, because the value should be immutable
// Cookies are injected into the browser for every request.
// The browser will only send cookies to the domains they are valid for, in the situations they are valid to share.
Cookies []*network.SetCookieParams // DeepClone: values can't just be copied
// Headers are set on every request the browser makes, not only to a specific domain.
// This is useful to pass around trace IDs and similar, but should be avoided for sensitive data (e.g. authentication).
Headers network.Headers // DeepClone: can't just be copied (is a map)
// TimeBetweenScrolls changes how long we wait for a scroll event to complete before starting a new one.
//
// We will scroll the entire web-page by the entire viewport over and over until we have seen everything.
// That means for a viewport that is 500px high, and a webpage that is 2500px high, we will scroll 5 times, meaning a total wait duration of 6 * duration (as we have to wait on the first & last scrolls as well).
TimeBetweenScrolls time.Duration
// ReadinessTimeout is the maximum time to wait for the web-page to become ready (i.e. no longer loading anything).
ReadinessTimeout time.Duration
ReadinessIterationInterval time.Duration
// ReadinessWaitForNQueryCycles is the number of readiness checks that must pass consecutively before considering the page ready. This handles the case where queries drop to 0 briefly before incrementing again.
ReadinessWaitForNQueryCycles int
// ReadinessPriorWait is the time to wait before checking for how ready the page is.
// This lets you force the webpage to take a beat and just do its thing before the service starts looking for whether it's time to render anything.
ReadinessPriorWait time.Duration
ReadinessDisableQueryWait bool
ReadinessFirstQueryTimeout time.Duration
ReadinessQueriesTimeout time.Duration
ReadinessDisableNetworkWait bool
ReadinessNetworkIdleTimeout time.Duration
ReadinessDisableDOMHashCodeWait bool
ReadinessDOMHashCodeTimeout time.Duration
// MinWidth is the minimum width of the browser viewport.
// If larger than MaxWidth, MaxWidth is used instead.
MinWidth int
// MinHeight is the minimum height of the browser viewport.
// If larger than MaxHeight, MaxHeight is used instead.
MinHeight int
// MaxWidth is the maximum width of the browser viewport.
// A request cannot request a larger browser viewport than this.
// If negative, it is ignored.
MaxWidth int
// MaxHeight is the maximum height of the browser viewport.
// A request cannot request a larger browser viewport than this, except for when capturing full-page screenshots.
// If negative, it is ignored.
MaxHeight int
PageScaleFactor float64
Landscape bool
}
func BrowserConfigFromCommand ¶
func BrowserConfigFromCommand(c *cli.Command) (BrowserConfig, error)
func (BrowserConfig) DeepClone ¶
func (c BrowserConfig) DeepClone() BrowserConfig
type LoggingConfig ¶
type LoggingConfig struct {
// Level is the minimum level to log.
Level LogLevel
}
func LoggingConfigFromCommand ¶
func LoggingConfigFromCommand(c *cli.Command) (LoggingConfig, error)
type RateLimitConfig ¶
type RateLimitConfig struct {
// Disabled indicates whether rate limiting is disabled.
Disabled bool
// TrackerDecay is the number N in decaying averages, `avg = ((N-1)*avg + new) / N`.
// This must be a minimum of 1, which will not use a slow-moving average at all.
TrackerDecay int64
// TrackerInterval is how often to sample process statistics on the browser processes.
// This must be a minimum of 1ms.
TrackerInterval time.Duration
// MinLimit is the minimum number of requests to permit.
// Even if we don't have slots for it, we will permit at least this many requests.
// Set to 0 to disable minimum; this is generally not recommended, especially in containerised environments like Kubernetes.
MinLimit uint32
// MaxLimit is the maximum number of requests to permit.
// Even if we have memory slots for more, we won't exceed this.
// Set to 0 to disable maximum; this is generally the way to go in horizontally scaled deployments.
MaxLimit uint32
// MaxAvailable is the maximum amount of memory (in bytes) available to processes.
// If there is more memory than this, we will only consider this amount.
// Set to 0 to use all available memory.
MaxAvailable uint64
// MinMemoryPerBrowser is the minimum amount of memory (in bytes) each browser process is expected to use.
// If the process tracker reports less, this is the value used. Otherwise, we use the process tracker's value.
// Set to 0 to disable the minimum.
MinMemoryPerBrowser uint64
// Headroom is how much memory (in bytes) should be left after the request's browser takes its share.
// If this cannot be accommodated, we will reject the request.
// Set to 0 to disable headroom.
Headroom uint64
}
func RateLimitConfigFromCommand ¶
func RateLimitConfigFromCommand(c *cli.Command) (RateLimitConfig, error)
type ServerConfig ¶
type ServerConfig struct {
// Addr is the HTTP address to listen on.
// This must be a TCP address, e.g. ":8080" or "[::1]:1234".
Addr string
// AuthTokens are the tokens that must be presented in the X-Auth-Token header to authorize requests.
AuthTokens []string
CertificateFile string
KeyFile string
MinTLSVersion TLSVersion
}
func ServerConfigFromCommand ¶
func ServerConfigFromCommand(c *cli.Command) (ServerConfig, error)
type TLSVersion ¶
type TLSVersion string
const ( TLSVersion1_0 TLSVersion = "1.0" TLSVersion1_1 TLSVersion = "1.1" TLSVersion1_2 TLSVersion = "1.2" TLSVersion1_3 TLSVersion = "1.3" )
func (TLSVersion) String ¶
func (v TLSVersion) String() string
func (TLSVersion) ToTLSConstant ¶
func (v TLSVersion) ToTLSConstant() (uint16, error)
type TracingConfig ¶
type TracingConfig struct {
Endpoint string
Insecure *bool
Headers map[string]string
Compressor string
Timeout time.Duration
TrustedCertificate string
ClientCertificate string
ClientKey string
ServiceName string
}
func TracingConfigFromCommand ¶
func TracingConfigFromCommand(c *cli.Command) (TracingConfig, error)
Click to show internal directories.
Click to hide internal directories.