proxy

package
v0.0.0-...-a0900a7 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2018 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

Package proxy implements types and functions to create and start proxy services.

Index

Constants

View Source
const (
	DefaultPort = 18080
	HealthRoute = "/sws-proxy/health"
)

Variables

This section is empty.

Functions

func BuildDefinition

func BuildDefinition(services []service.Service) string

buildDefinition creats a specification of backend services to proxy to.

func WriteConf

func WriteConf(conf, filename string) error

WriteConf creates a configuration file with the proxy configuration.

Types

type Pair

type Pair struct {
	Primary   Proxy
	Secondary Proxy
}

Pair holds info about primary and secondary proxy.

func (Pair) Alinged

func (pair Pair) Alinged() error

Alinged checks if primary and secondary proxy are identical in all but name.

type Proxy

type Proxy struct {
	Name       string `yaml:"name"`
	Port       int    `yaml:"port"`
	Image      string `yaml:"image"`
	Definition string `yaml:"definition"`
}

Proxy infromation needed to create and start a proxy.

func New

func New(name string, port int, services []service.Service) Proxy

New builds a proxy struct based on definitions of backend services.

func (Proxy) CreateConf

func (p Proxy) CreateConf(healthRoute string) string

CreateConf creates proxy configuration.

func (Proxy) ID

func (p Proxy) ID() string

ID returns a checksum of the proxy definition as an identifier.

func (Proxy) ProxySpec

func (p Proxy) ProxySpec() string

ProxySpec creates an server block in Nginx format in order to proxy traffic to a proxy.

func (Proxy) PublicRunCmd

func (p Proxy) PublicRunCmd(network string) []string

PublicRunCmd creates a docker run command, exposing the port of the proxy.

func (Proxy) RunCmd

func (p Proxy) RunCmd(network string) []string

RunCmd creates a docker run command for a proxy based on its attributes.

Jump to

Keyboard shortcuts

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