cdn

package
v0.0.0-...-bbdb812 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackendConf

type BackendConf struct {
	Name                 string `yaml:"name"`
	Domain               string `yaml:"domain"`
	IP                   string `yaml:"ip"`
	Port                 int    `yaml:"port"`
	IfModifiedValidation int    `yaml:"ifmodified_validation"`
	CertFile             string `yaml:"cert"`
	KeyFile              string `yaml:"key"`
}

BackendConf is the configuration for a website we cache for

func (BackendConf) IsValid

func (bc BackendConf) IsValid() (bool, string)

IsValid checks the validity of a backend config

type CDN

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

CDN represents the CDN ojbect

func NewCDN

func NewCDN(conf Conf) (*CDN, error)

NewCDN returns a new CDN object

func (*CDN) Shutdown

func (c *CDN) Shutdown() error

Shutdown terminates the CDN in a clean way

func (*CDN) Start

func (c *CDN) Start() <-chan struct{}

Start starts the CDN by starting the HTTP/HTTPS endpoint and API. It returns a channel which can be used to understand when an error occurs in one of the handlers

type Conf

type Conf struct {
	API   api.Conf   `yaml:"api"`
	Cache cache.Conf `yaml:"cache"`
	HTTP  HTTPConf   `yaml:"http"`
	HTTPS HTTPConf   `yaml:"https"`
}

Conf is the cdn configuration

func DefaultConf

func DefaultConf() Conf

DefaultConf returns a HTTP configuration with some defaults

func (Conf) IsValid

func (c Conf) IsValid() (bool, string)

IsValid is a way of validating the configuration before starting the CDN

type HTTPConf

type HTTPConf struct {
	Address  string        `yaml:"address"`
	Port     int           `yaml:"port"`
	Backends []BackendConf `yaml:"backends"`
}

HTTPConf is the configuration for the http server

func DefaultHTTPConf

func DefaultHTTPConf() HTTPConf

DefaultHTTPConf returns a HTTP configuration with some defaults

func DefaultHTTPSConf

func DefaultHTTPSConf() HTTPConf

DefaultHTTPSConf returns a HTTPS configuration with some defaults

func (HTTPConf) IsValid

func (hc HTTPConf) IsValid() (bool, string)

IsValid checks the validity of a HTTP conf

Jump to

Keyboard shortcuts

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