config

package
v2.7.1 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AcmeConfig

type AcmeConfig struct {
	// directory to save the certificates, le_certs default
	CacheDir string `mapstructure:"cache_dir"`

	// User email, mandatory
	Email string `mapstructure:"email"`

	// supported values: http-01, tlsalpn-01
	ChallengeType string `mapstructure:"challenge_type"`

	// The alternate port to use for the ACME HTTP challenge
	AltHTTPPort int `mapstructure:"alt_http_port"`

	// The alternate port to use for the ACME TLS-ALPN
	AltTLSALPNPort int `mapstructure:"alt_tlsalpn_port"`

	// Use LE production endpoint or staging
	UseProductionEndpoint bool `mapstructure:"use_production_endpoint"`

	// Domains to obtain certificates
	Domains []string `mapstructure:"domains"`
}

func (*AcmeConfig) InitDefaults

func (ac *AcmeConfig) InitDefaults() error

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 `mapstructure:"address"`

	// AccessLogs turn on/off, logged at Info log level, default: false
	AccessLogs bool `mapstructure:"access_logs"`

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

	// InternalErrorCode used to override default 500 (InternalServerError) http code
	InternalErrorCode uint64 `mapstructure:"internal_error_code"`

	// 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"`

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

	// 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"`

	// 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) EnableACME

func (c *HTTP) EnableACME() bool

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

	// ACME configuration
	Acme *AcmeConfig `mapstructure:"acme"`

	// 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) InitDefaults

func (s *SSL) InitDefaults() error

func (*SSL) Valid

func (s *SSL) Valid() error

type Uploads

type Uploads struct {
	// Dir contains name of directory to control access to.
	Dir string `mapstructure:"dir"`

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

	// Allowed files
	Allow []string `mapstructure:"allow"`

	// internal
	Forbidden map[string]struct{} `mapstructure:"-"`
	Allowed   map[string]struct{} `mapstructure:"-"`
}

Uploads describes file location and controls access to them.

func (*Uploads) InitDefaults

func (cfg *Uploads) InitDefaults() error

InitDefaults sets missing values to their default values.

Jump to

Keyboard shortcuts

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