server

package
v0.0.0-...-062a6ae Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2019 License: GPL-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultBindingAddress is all addresses
	DefaultBindingAddress = "0.0.0.0"
	// DefaultBindingPort is standard unprivileged http
	DefaultBindingPort = 8080
)
View Source
const TracingEnabled = "enabled"

Variables

View Source
var DefaultResolver *net.Resolver = net.DefaultResolver
View Source
var (
	ErrorNotResolvable = errors.New("Unable to resolve ip")
)
View Source
var Settings = &Config{}

Settings contains Viper loaded settings

Functions

func BindAddress

func BindAddress() (bindAddress string)

func NewNonChunkedRequest

func NewNonChunkedRequest(method, url string, r *http.Request) (newRequest *http.Request, err error)

func NewResolver

func NewResolver(servers []string) *net.Resolver

func RequestBodyTracingEnabled

func RequestBodyTracingEnabled(r *http.Request) bool

func RequestHeaderTracingEnabled

func RequestHeaderTracingEnabled(r *http.Request) bool

func ResponseBodyTracingEnabled

func ResponseBodyTracingEnabled(r *http.Response) bool

func ResponseHeaderTracingEnabled

func ResponseHeaderTracingEnabled(r *http.Response) bool

func SetResolvers

func SetResolvers(nameservers []string)

func TraceEventData

func TraceEventData(r interface{})

Types

type Config

type Config struct {
	ConfigFile string                 `mapstructure:"config" diff:"config"`
	DNS        ConfigDNS              `mapstructure:"dns" diff:"dns"`
	Logging    ConfigLogging          `mapstructure:"logging" diff:"logging"`
	Network    ConfigNetwork          `mapstructure:"network" diff:"network"`
	NewRelic   ConfigNewRelic         `mapstructure:"newrelic" diff:"newrelic"`
	Response   ConfigResponse         `mapstructure:"response" diff:"response"`
	Routes     map[string]ConfigRoute `mapstructure:"routes" diff:"routes"`
	Server     ConfigServer           `mapstructure:"server" diff:"server"`
	Transform  ConfigTransform        `mapstructure:"transform" diff:"transform"`
}

func DecodeConfigMap

func DecodeConfigMap(input map[string]interface{}) (*Config, error)

func (*Config) LoadAndLogDiff

func (c *Config) LoadAndLogDiff(input map[string]interface{})

func (*Config) LoadFromMap

func (c *Config) LoadFromMap(input map[string]interface{}, onChangeFunc func(old, new *Config))

type ConfigDNS

type ConfigDNS struct {
	Resolvers []string `mapstructure:"resolvers" diff:"resolvers"`
}

type ConfigErrorCollections

type ConfigErrorCollections struct {
	Enabled           bool  `mapstructure:"enabled" diff:"enabled"`
	IgnoreStatusCodes []int `mapstructure:"ignore_status_codes" diff:"ignore_status_codes"`
}

type ConfigHTTP2

type ConfigHTTP2 struct {
	Enabled bool `mapstructure:"enabled" diff:"enabled"`
}

type ConfigLogging

type ConfigLogging struct {
	Level string `mapstructure:"level" diff:"level"`
}

type ConfigNetwork

type ConfigNetwork struct {
	MaxIdleConnections int                   `mapstructure:"max_idle_connections" diff:"max_idle_connections"`
	MaxIdlePerHost     int                   `mapstructure:"max_idle_per_host" diff:"max_idle_per_host"`
	Timeouts           ConfigNetworkTimeouts `mapstructure:"timeouts" diff:"timeouts"`
}

type ConfigNetworkTimeouts

type ConfigNetworkTimeouts struct {
	Connect        time.Duration `mapstructure:"connect" diff:"connect"`
	Continue       time.Duration `mapstructure:"continue" diff:"continue"`
	IdleConnection time.Duration `mapstructure:"idle_connection" diff:"idle_connection"`
	Keepalive      time.Duration `mapstructure:"keepalive" diff:"keepalive"`
	TLSHandshake   time.Duration `mapstructure:"tls_handshake" diff:"tls_handshake"`
	Read           time.Duration `mapstructure:"read" diff:"read"`
	Write          time.Duration `mapstructure:"write" diff:"write"`
}

type ConfigNewRelic

type ConfigNewRelic struct {
	AppName         string                 `mapstructure:"app_name" diff:"app_name"`
	Enabled         bool                   `mapstructure:"enabled" diff:"enabled"`
	ErrorCollector  ConfigErrorCollections `mapstructure:"error_collector" diff:"error_collector"`
	HighSecurity    bool                   `mapstructure:"high_security" diff:"high_security"`
	HostDisplayName string                 `mapstructure:"host_display_name" diff:"host_display_name"`
	Labels          map[string]string      `mapstructure:"labels" diff:"labels"`
	LicenseKey      string                 `mapstructure:"license_key" diff:"license_key"`
	ProxyURL        string                 `mapstructure:"proxy_url" diff:"proxy_url"`
}

type ConfigResponse

type ConfigResponse struct {
	NotFound    ConfigResponseEntry `mapstructure:"not_found" diff:"not_found"`
	ServerError ConfigResponseEntry `mapstructure:"server_error" diff:"server_error"`
}

type ConfigResponseEntry

type ConfigResponseEntry struct {
	Body string `mapstructure:"body" diff:"body"`
	Code int    `mapstructure:"code" diff:"code"`
}

type ConfigRoute

type ConfigRoute struct {
	Upstream                 string   `mapstructure:"upstream" diff:"upstream"`
	Paths                    []string `mapstructure:"paths" diff:"paths"`
	AggregateChunkedRequests bool     `mapstructure:"aggregate_chunked_requests" diff:"aggregate_chunked_requests"`
}

type ConfigServer

type ConfigServer struct {
	BindAddress     string        `mapstructure:"bind_address" diff:"bind_address"`
	Threads         int           `mapstructure:"threads" diff:"threads"`
	ShutdownTimeout time.Duration `mapstructure:"shutdown_timeout" diff:"shutdown_timeout" `
	HTTP2           ConfigHTTP2   `mapstructure:"http2" diff:"http2"`
	TLS             ConfigTLS     `mapstructure:"tls" diff:"tls"`
}

type ConfigTLS

type ConfigTLS struct {
	Enabled bool   `mapstructure:"enabled" diff:"enabled"`
	Cert    string `mapstructure:"cert" diff:"cert"`
	Key     string `mapstructure:"key" diff:"key"`
}

type ConfigTransform

type ConfigTransform struct {
	Request  ConfigTransformEntry `mapstructure:"request" diff:"request"`
	Response ConfigTransformEntry `mapstructure:"response" diff:"response"`
}

type ConfigTransformEntry

type ConfigTransformEntry struct {
	Insert   map[string]string `mapstructure:"insert" diff:"insert"`
	Override map[string]string `mapstructure:"override" diff:"override"`
	Delete   []string          `mapstructure:"delete" diff:"delete"`
}

type DNSError

type DNSError net.DNSError

type ProxyTransport

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

func NewProxyTransport

func NewProxyTransport(server *Server) *ProxyTransport

func (*ProxyTransport) RoundTrip

func (pt *ProxyTransport) RoundTrip(request *http.Request) (*http.Response, error)

type Route

type Route struct {
	Name         string
	MatchedPath  string
	Upstream     string
	AggReqChunks bool
}

func (*Route) AggregateRequestChunks

func (r *Route) AggregateRequestChunks() bool

type RouteTree

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

func NewRouteTree

func NewRouteTree() *RouteTree

func (*RouteTree) Load

func (rt *RouteTree) Load() *RouteTree

func (*RouteTree) Lookup

func (rt *RouteTree) Lookup(s string) (*Route, bool)

type Router

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

func NewRouter

func NewRouter(server *Server) *Router

type Server

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

func NewServer

func NewServer() *Server

func (*Server) HandleSignalReload

func (s *Server) HandleSignalReload()

func (*Server) HandleSignalShutdown

func (s *Server) HandleSignalShutdown()

func (*Server) ListenAndServe

func (s *Server) ListenAndServe()

func (*Server) Listener

func (s *Server) Listener() (*net.Listener, error)

func (*Server) Run

func (s *Server) Run() int

func (*Server) SetupSignalHandlers

func (s *Server) SetupSignalHandlers() error

Jump to

Keyboard shortcuts

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