conf

package
v0.0.0-...-b9d1a8a Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend struct {
	Addr           string `yaml:"addr" json:"addr"`
	ConnectTimeout int    `yaml:"connect_timeout" json:"connectTimeout"`
}

Backend struct

type Binding

type Binding struct {
	BindAddr  string               `yaml:"bind_addr" json:"bindAddr"`
	Watch     bool                 `yaml:"watch" json:"watch"`
	Secure    bool                 `yaml:"secure" json:"secure"`
	Frontends map[string]*Frontend `yaml:"frontends" json:"frontends"`
}

Binding struct

type ConfigWatcher

type ConfigWatcher struct {
	// contains filtered or unexported fields
}

ConfigWatcher struct

func NewConfigWatcher

func NewConfigWatcher() (*ConfigWatcher, error)

NewConfigWatcher creates new file watcher for config files

func (*ConfigWatcher) Add

func (cw *ConfigWatcher) Add(dir string, bindAddr string, updater Updater) error

Add starts watching the named file or directory (non-recursively).

func (*ConfigWatcher) Start

func (cw *ConfigWatcher) Start()

Start config directory watching

func (*ConfigWatcher) Stop

func (cw *ConfigWatcher) Stop() error

Stop config directory watching

type Configuration

type Configuration map[string]*Binding

Configuration map

func NewConfiguration

func NewConfiguration() Configuration

NewConfiguration returns a new Configuration

func (Configuration) ParseFile

func (c Configuration) ParseFile(confPath string) error

ParseFile func

func (Configuration) ParseJSON

func (c Configuration) ParseJSON(b []byte) error

ParseJSON func

func (Configuration) ParseYaml

func (c Configuration) ParseYaml(b []byte) error

ParseYaml func

func (Configuration) SetDefaultsAndValidate

func (c Configuration) SetDefaultsAndValidate() error

SetDefaultsAndValidate sets defaults and validates

type Frontend

type Frontend struct {
	Name      string `yaml:"-" json:"-"`
	BoundAddr string `yaml:"-" json:"-"`

	Backends []Backend `yaml:"backends" json:"backends"`
	Strategy string    `yaml:"strategy" json:"strategy"`
	Autocert bool      `yaml:"autocert" json:"autocert"`
	TLSCrt   string    `yaml:"tls_crt" json:"tlsCrt"`
	TLSKey   string    `yaml:"tls_key" json:"tlsKey"`
}

Frontend struct

func NewFrontend

func NewFrontend(bindAddr, name string, backends []Backend) *Frontend

NewFrontend returns a new Configuration

func (*Frontend) ParseFile

func (f *Frontend) ParseFile(confPath string) error

ParseFile func

func (*Frontend) ParseJSON

func (f *Frontend) ParseJSON(b []byte) error

ParseJSON func

func (*Frontend) ParseYaml

func (f *Frontend) ParseYaml(b []byte) error

ParseYaml func

func (*Frontend) SetDefaultsAndValidate

func (f *Frontend) SetDefaultsAndValidate() error

SetDefaultsAndValidate sets defaults and validates

type Updater

type Updater interface {
	ReplaceFrontend(*Frontend) error
	RemoveFrontend(string)
}

Jump to

Keyboard shortcuts

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