proxy

package
Version: v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2018 License: MIT Imports: 12 Imported by: 8

Documentation

Index

Constants

View Source
const (
	PortEnv       = "ERGO_PORT"
	DomainEnv     = "ERGO_DOMAIN"
	VerboseEnv    = "ERGO_VERBOSE"
	ConfigFileEnv = "ERGO_CONFIG_FILE"

	PortDefault           = "2000"
	DomainDefault         = ".dev"
	ConfigFilePathDefault = "./.ergo"
)

Defines the name of ergo env variable for configuration.

Variables

This section is empty.

Functions

func AddService added in v0.2.0

func AddService(filepath string, service Service) error

AddService adds new service to the filepath

func NewErgoProxy

func NewErgoProxy(config *Config) *httputil.ReverseProxy

NewErgoProxy returns the new reverse proxy.

func RemoveService added in v0.2.2

func RemoveService(filepath string, service Service) error

RemoveService removes a service from the filepath

func ServeProxy added in v0.0.5

func ServeProxy(config *Config) error

ServeProxy listens & serves the HTTP proxy.

Types

type Config

type Config struct {
	Port       string
	Domain     string
	Verbose    bool
	Services   map[string]Service
	ConfigFile string
	// contains filtered or unexported fields
}

Config holds the configuration for the proxy.

func NewConfig added in v0.1.4

func NewConfig() *Config

NewConfig gets the defaults config.

func (*Config) AddService added in v0.2.2

func (c *Config) AddService(service Service) error

AddService add a service using the correct key

func (*Config) GetProxyPacURL added in v0.2.2

func (c *Config) GetProxyPacURL() string

GetProxyPacURL returns the correct url for the pac file

func (*Config) GetService

func (c *Config) GetService(host string) Service

GetService gets the service for the given host.

func (*Config) LoadServices added in v0.2.2

func (c *Config) LoadServices() error

LoadServices loads the services from filepath, returns an error if the configuration could not be parsed

func (*Config) OverrideBy added in v0.2.3

func (c *Config) OverrideBy(new *Config)

OverrideBy makes sure that it sets the correct config based on the defaults and the passed by argument

func (*Config) WatchConfigFile added in v0.2.2

func (c *Config) WatchConfigFile(tickerChan <-chan time.Time)

WatchConfigFile listen for file changes and updates the config services

type Service

type Service struct {
	Name string
	URL  string
}

Service holds the details of the service (Name and URL)

func (Service) Empty added in v0.2.2

func (s Service) Empty() bool

Empty service means no name or no url

Source Files

Jump to

Keyboard shortcuts

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