config

package
v0.0.0-...-0d6bb38 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package config implements the gofer configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ControlAddr string `yaml:"control_addr,omitempty"`

	// Map address -> config.
	HTTP  map[string]HTTP  `yaml:",omitempty"`
	HTTPS map[string]HTTPS `yaml:",omitempty"`
	Raw   map[string]Raw   `yaml:",omitempty"`

	ReqLog map[string]ReqLog `yaml:",omitempty"`
}

func Load

func Load(filename string) (*Config, error)

func LoadString

func LoadString(contents string) (*Config, error)

func (Config) Check

func (c Config) Check() []error

func (Config) String

func (c Config) String() string

func (Config) ToString

func (c Config) ToString() (string, error)

type DirOpts

type DirOpts struct {
	Listing map[string]bool `yaml:",omitempty"`
	Exclude []Regexp        `yaml:",omitempty"`
}

type HTTP

type HTTP struct {
	Routes map[string]Route

	Auth map[string]string `yaml:",omitempty"`

	SetHeader map[string]map[string]string `yaml:",omitempty"`

	ReqLog map[string]string `yaml:",omitempty"`
}

func (HTTP) Check

func (h HTTP) Check(c Config, addr string) []error

type HTTPS

type HTTPS struct {
	HTTP  `yaml:",inline"`
	Certs string `yaml:",omitempty"`
}

type Raw

type Raw struct {
	Certs  string `yaml:",omitempty"`
	To     string `yaml:",omitempty"`
	ToTLS  bool   `yaml:"to_tls,omitempty"`
	ReqLog string `yaml:",omitempty"`
}

type Regexp

type Regexp struct {
	*regexp.Regexp
	// contains filtered or unexported fields
}

Wrapper to simplify regexp in configuration.

func (Regexp) MarshalYAML

func (re Regexp) MarshalYAML() (interface{}, error)

func (*Regexp) UnmarshalYAML

func (re *Regexp) UnmarshalYAML(unmarshal func(interface{}) error) error

type ReqLog

type ReqLog struct {
	File    string `yaml:",omitempty"`
	BufSize int    `yaml:",omitempty"`
	Format  string `yaml:",omitempty"`
}

type Route

type Route struct {
	Dir      string   `yaml:",omitempty"`
	File     string   `yaml:",omitempty"`
	Proxy    *URL     `yaml:",omitempty"`
	Redirect *URL     `yaml:",omitempty"`
	CGI      []string `yaml:",omitempty"`
	Status   int      `yaml:",omitempty"`
	DirOpts  DirOpts  `yaml:",omitempty"`
}

type URL

type URL url.URL

Wrapper to simplify URLs in configuration.

func (*URL) MarshalYAML

func (u *URL) MarshalYAML() (interface{}, error)

func (URL) String

func (u URL) String() string

func (*URL) URL

func (u *URL) URL() url.URL

func (*URL) UnmarshalYAML

func (u *URL) UnmarshalYAML(unmarshal func(interface{}) error) error

Jump to

Keyboard shortcuts

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