config

package
v2.0.0-beta12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cidrs

type Cidrs []*net.IPNet

Cidrs is a slice of IPNet addresses

func ParseCIDRs

func ParseCIDRs(subnets []string) (Cidrs, error)

ParseCIDRs parse IPNet addresses and return slice of its

func (*Cidrs) IsTrusted

func (c *Cidrs) IsTrusted(ip string) bool

IsTrusted checks if the ip address exists in the provided in the config addresses

type FCGI

type FCGI struct {
	// Address and port to handle as http server.
	Address string
}

FCGI for FastCGI server.

type HTTP

type HTTP struct {
	// Host and port to handle as http server.
	Address string

	// SSLConfig defines https server options.
	SSLConfig *SSL `mapstructure:"ssl"`

	// FCGIConfig configuration. You can use FastCGI without HTTP server.
	FCGIConfig *FCGI `mapstructure:"fcgi"`

	// HTTP2Config configuration
	HTTP2Config *HTTP2 `mapstructure:"http2"`

	// MaxRequestSize specified max size for payload body in megabytes, set 0 to unlimited.
	MaxRequestSize uint64 `mapstructure:"max_request_size"`

	// TrustedSubnets declare IP subnets which are allowed to set ip using X-Real-Ip and X-Forwarded-For
	TrustedSubnets []string `mapstructure:"trusted_subnets"`

	// Uploads configures uploads configuration.
	Uploads *Uploads `mapstructure:"uploads"`

	// Pool configures worker pool.
	Pool *poolImpl.Config `mapstructure:"pool"`

	// Env is environment variables passed to the  http pool
	Env map[string]string

	// List of the middleware names (order will be preserved)
	Middleware []string

	// slice of net.IPNet
	Cidrs Cidrs
}

HTTP configures RoadRunner HTTP server.

func (*HTTP) EnableFCGI

func (c *HTTP) EnableFCGI() bool

EnableFCGI is true when FastCGI server must be enabled.

func (*HTTP) EnableH2C

func (c *HTTP) EnableH2C() bool

EnableH2C when HTTP/2 extension must be enabled on TCP.

func (*HTTP) EnableHTTP

func (c *HTTP) EnableHTTP() bool

EnableHTTP is true when http server must run.

func (*HTTP) EnableTLS

func (c *HTTP) EnableTLS() bool

EnableTLS returns true if pool must listen TLS connections.

func (*HTTP) InitDefaults

func (c *HTTP) InitDefaults() error

InitDefaults must populate HTTP values using given HTTP source. Must return error if HTTP is not valid.

func (*HTTP) Valid

func (c *HTTP) Valid() error

Valid validates the configuration.

type HTTP2

type HTTP2 struct {

	// H2C enables HTTP/2 over TCP
	H2C bool

	// MaxConcurrentStreams defaults to 128.
	MaxConcurrentStreams uint32 `mapstructure:"max_concurrent_streams"`
}

HTTP2 HTTP/2 server customizations.

func (*HTTP2) InitDefaults

func (cfg *HTTP2) InitDefaults() error

InitDefaults sets default values for HTTP/2 configuration.

type SSL

type SSL struct {
	// Address to listen as HTTPS server, defaults to 0.0.0.0:443.
	Address string

	// Redirect when enabled forces all http connections to switch to https.
	Redirect bool

	// Key defined private server key.
	Key string

	// Cert is https certificate.
	Cert string

	// Root CA file
	RootCA string `mapstructure:"root_ca"`

	Port int
	// contains filtered or unexported fields
}

SSL defines https server configuration.

func (*SSL) Valid

func (s *SSL) Valid() error

type Uploads

type Uploads struct {
	// Dir contains name of directory to control access to.
	Dir string

	// Forbid specifies list of file extensions which are forbidden for access.
	// Example: .php, .exe, .bat, .htaccess and etc.
	Forbid []string
}

Uploads describes file location and controls access to them.

func (*Uploads) Forbids

func (cfg *Uploads) Forbids(filename string) bool

Forbids must return true if file extension is not allowed for the upload.

func (*Uploads) InitDefaults

func (cfg *Uploads) InitDefaults() error

InitDefaults sets missing values to their default values.

func (*Uploads) TmpDir

func (cfg *Uploads) TmpDir() string

TmpDir returns temporary directory.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL