config

package
v0.0.0-...-12494cd Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	Algorithm string   `json:"algorithm"`
	CDF       int      `json:"-"` //cumulative density function (sum of weights)
	Servers   []Server `json:"servers"`
}

A Cluster aggregates more Servers into a pool

func (*Cluster) Add

func (c *Cluster) Add(s Server) (result bool)

Add server to the cluster

func (*Cluster) Update

func (c *Cluster) Update(s Server) (updated int)

Update server in the cluster

type Config

type Config struct {
	Frontends map[string]*Frontend `json:"frontends"`
	Clusters  map[string]*Cluster  `json:"clusters"`
	// contains filtered or unexported fields
}

Config for the main program

func ReadConfigJSON

func ReadConfigJSON(path string) (c *Config, err error)

ReadConfigJSON reads a json configuration file returning the Config object

func ReadConfigYAML

func ReadConfigYAML(path string) (c *Config, err error)

ReadConfigYAML reads a yaml configuration file returning the Config object

func (*Config) Reload

func (c *Config) Reload() (err error)

Reload reloads config file

type Frontend

type Frontend struct {
	Name     string           `json:"name"`
	Active   bool             `json:"active"`
	Listen   string           `json:"listen"`
	TLS      TLS              `json:"tls,omitempty"`
	Pool     string           `json:"pool"`
	Bounce   []int            `json:"bounce,omitempty"`
	Logfile  string           `json:"logfile,omitempty"`
	Proxy    *http.Server     `json:"-"`
	Logger   *zap.Logger      `json:"-"`
	LogLevel *zap.AtomicLevel `json:"-"`
}

A Frontend is the proxy interface

type Server

type Server struct {
	Name   string `json:"name"`
	Scheme string `json:"scheme"`
	Host   string `json:"host"`
	Port   string `json:"port"`
	Weight int    `json:"weight,omitempty"`
}

A Server represents a service provider listener

type TLS

type TLS struct {
	Enabled bool   `json:"enabled"`
	Key     string `json:"key"`
	Cert    string `json:"cert"`
}

TLS contains the frontend TLS settings

Jump to

Keyboard shortcuts

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