envoyhttp

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2018 License: MIT Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SvcName

func SvcName(entry *Entry) string

Format an Envoy service name from an endpoint

Types

type CDSResult

type CDSResult struct {
	Clusters []*EnvoyCluster `json:"clusters"`
}

func (*CDSResult) MarshalJSON

func (mj *CDSResult) MarshalJSON() ([]byte, error)

func (*CDSResult) MarshalJSONBuf

func (mj *CDSResult) MarshalJSONBuf(buf fflib.EncodingBuffer) error

func (*CDSResult) UnmarshalJSON

func (uj *CDSResult) UnmarshalJSON(input []byte) error

func (*CDSResult) UnmarshalJSONFFLexer

func (uj *CDSResult) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

type Entry

type Entry struct {
	FrontendAddr    *net.TCPAddr
	BackendAddr     *net.TCPAddr
	ServiceName     string
	EnvironmentName string
	ProxyMode       string
}

func RequestToEntry

func RequestToEntry(req *shimrpc.RegistrarRequest) *Entry

RequestToEntry turns a shimrpc Request into a permanent state entry for storage in the registrar.

type EnvoyApi

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

func NewEnvoyApi

func NewEnvoyApi(registrar *Registrar) *EnvoyApi

func (*EnvoyApi) EnvoyClustersFromRegistrar

func (s *EnvoyApi) EnvoyClustersFromRegistrar() []*EnvoyCluster

EnvoyClustersFromRegistrar genenerates a set of Envoy API cluster definitions from Registrar state.

func (*EnvoyApi) EnvoyListenerFromEntry

func (s *EnvoyApi) EnvoyListenerFromEntry(entry *Entry) *EnvoyListener

EnvoyListenerFromEntry takes a Registrar request service and formats it into the API format for an Envoy proxy listener (LDS API v1)

func (*EnvoyApi) EnvoyListenersFromRegistrar

func (s *EnvoyApi) EnvoyListenersFromRegistrar() []*EnvoyListener

EnvoyListenersFromRegistrar creates a set of Enovy API listener definitions from all the ports in the Registrar.

func (*EnvoyApi) EnvoyServiceFromEntry

func (s *EnvoyApi) EnvoyServiceFromEntry(entry *Entry) *EnvoyService

EnvoyServiceFromRequest converts a Registrar request to an Envoy API service for reporting to the proxy.

func (*EnvoyApi) HttpMux

func (s *EnvoyApi) HttpMux() http.Handler

HttpMux returns a configured Gorilla mux to handle all the endpoints for the Envoy API.

type EnvoyCluster

type EnvoyCluster struct {
	Name             string `json:"name"`
	Type             string `json:"type"`
	ConnectTimeoutMs int64  `json:"connect_timeout_ms"`
	LBType           string `json:"lb_type"`
	ServiceName      string `json:"service_name"`
}

See https://www.envoyproxy.io/docs/envoy/latest/api-v1/cluster_manager/cluster.html

func (*EnvoyCluster) MarshalJSON

func (mj *EnvoyCluster) MarshalJSON() ([]byte, error)

func (*EnvoyCluster) MarshalJSONBuf

func (mj *EnvoyCluster) MarshalJSONBuf(buf fflib.EncodingBuffer) error

func (*EnvoyCluster) UnmarshalJSON

func (uj *EnvoyCluster) UnmarshalJSON(input []byte) error

func (*EnvoyCluster) UnmarshalJSONFFLexer

func (uj *EnvoyCluster) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

type EnvoyFilter

type EnvoyFilter struct {
	Name   string             `json:"name"`
	Config *EnvoyFilterConfig `json:"config"`
}

A basic Envoy Route Filter

func (*EnvoyFilter) MarshalJSON

func (mj *EnvoyFilter) MarshalJSON() ([]byte, error)

func (*EnvoyFilter) MarshalJSONBuf

func (mj *EnvoyFilter) MarshalJSONBuf(buf fflib.EncodingBuffer) error

func (*EnvoyFilter) UnmarshalJSON

func (uj *EnvoyFilter) UnmarshalJSON(input []byte) error

func (*EnvoyFilter) UnmarshalJSONFFLexer

func (uj *EnvoyFilter) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

type EnvoyFilterConfig

type EnvoyFilterConfig struct {
	CodecType   string              `json:"codec_type,omitempty"`
	StatPrefix  string              `json:"stat_prefix,omitempty"`
	RouteConfig *EnvoyRouteConfig   `json:"route_config,omitempty"`
	Filters     []*EnvoyFilter      `json:"filters,omitempty"`
	Tracing     *EnvoyTracingConfig `json:"tracing,omitempty"`
}

func (*EnvoyFilterConfig) MarshalJSON

func (mj *EnvoyFilterConfig) MarshalJSON() ([]byte, error)

func (*EnvoyFilterConfig) MarshalJSONBuf

func (mj *EnvoyFilterConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error

func (*EnvoyFilterConfig) UnmarshalJSON

func (uj *EnvoyFilterConfig) UnmarshalJSON(input []byte) error

func (*EnvoyFilterConfig) UnmarshalJSONFFLexer

func (uj *EnvoyFilterConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

type EnvoyHTTPVirtualHost

type EnvoyHTTPVirtualHost struct {
	Name    string        `json:"name"`
	Domains []string      `json:"domains"`
	Routes  []*EnvoyRoute `json:"routes"`
}

func (*EnvoyHTTPVirtualHost) MarshalJSON

func (mj *EnvoyHTTPVirtualHost) MarshalJSON() ([]byte, error)

func (*EnvoyHTTPVirtualHost) MarshalJSONBuf

func (mj *EnvoyHTTPVirtualHost) MarshalJSONBuf(buf fflib.EncodingBuffer) error

func (*EnvoyHTTPVirtualHost) UnmarshalJSON

func (uj *EnvoyHTTPVirtualHost) UnmarshalJSON(input []byte) error

func (*EnvoyHTTPVirtualHost) UnmarshalJSONFFLexer

func (uj *EnvoyHTTPVirtualHost) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

type EnvoyListener

type EnvoyListener struct {
	Name    string         `json:"name"`
	Address string         `json:"address"`
	Filters []*EnvoyFilter `json:"filters"`
}

https://www.envoyproxy.io/docs/envoy/latest/api-v1/listeners/listeners.html

func (*EnvoyListener) MarshalJSON

func (mj *EnvoyListener) MarshalJSON() ([]byte, error)

func (*EnvoyListener) MarshalJSONBuf

func (mj *EnvoyListener) MarshalJSONBuf(buf fflib.EncodingBuffer) error

func (*EnvoyListener) UnmarshalJSON

func (uj *EnvoyListener) UnmarshalJSON(input []byte) error

func (*EnvoyListener) UnmarshalJSONFFLexer

func (uj *EnvoyListener) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

type EnvoyRoute

type EnvoyRoute struct {
	TimeoutMs   int                  `json:"timeout_ms"`
	Prefix      string               `json:"prefix"`
	HostRewrite string               `json:"host_rewrite"`
	Cluster     string               `json:"cluster"`
	Decorator   *EnvoyRouteDecorator `json:"decorator,omitempty"`
}

func (*EnvoyRoute) MarshalJSON

func (mj *EnvoyRoute) MarshalJSON() ([]byte, error)

func (*EnvoyRoute) MarshalJSONBuf

func (mj *EnvoyRoute) MarshalJSONBuf(buf fflib.EncodingBuffer) error

func (*EnvoyRoute) UnmarshalJSON

func (uj *EnvoyRoute) UnmarshalJSON(input []byte) error

func (*EnvoyRoute) UnmarshalJSONFFLexer

func (uj *EnvoyRoute) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

type EnvoyRouteConfig

type EnvoyRouteConfig struct {
	VirtualHosts []*EnvoyHTTPVirtualHost `json:"virtual_hosts,omitempty"` // Used for HTTP
	Routes       []*EnvoyTCPRoute        `json:"routes,omitempty"`        // Use for TCP
}

func (*EnvoyRouteConfig) MarshalJSON

func (mj *EnvoyRouteConfig) MarshalJSON() ([]byte, error)

func (*EnvoyRouteConfig) MarshalJSONBuf

func (mj *EnvoyRouteConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error

func (*EnvoyRouteConfig) UnmarshalJSON

func (uj *EnvoyRouteConfig) UnmarshalJSON(input []byte) error

func (*EnvoyRouteConfig) UnmarshalJSONFFLexer

func (uj *EnvoyRouteConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

type EnvoyRouteDecorator

type EnvoyRouteDecorator struct {
	Operation string `json:"operation,omitempty"`
}

func (*EnvoyRouteDecorator) MarshalJSON

func (mj *EnvoyRouteDecorator) MarshalJSON() ([]byte, error)

func (*EnvoyRouteDecorator) MarshalJSONBuf

func (mj *EnvoyRouteDecorator) MarshalJSONBuf(buf fflib.EncodingBuffer) error

func (*EnvoyRouteDecorator) UnmarshalJSON

func (uj *EnvoyRouteDecorator) UnmarshalJSON(input []byte) error

func (*EnvoyRouteDecorator) UnmarshalJSONFFLexer

func (uj *EnvoyRouteDecorator) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

type EnvoyService

type EnvoyService struct {
	IPAddress       string            `json:"ip_address"`
	LastCheckIn     string            `json:"last_check_in"`
	Port            int64             `json:"port"`
	Revision        string            `json:"revision"`
	Service         string            `json:"service"`
	ServiceRepoName string            `json:"service_repo_name"`
	Tags            map[string]string `json:"tags"`
}

See https://www.envoyproxy.io/docs/envoy/latest/api-v1/cluster_manager/sds.html

func (*EnvoyService) MarshalJSON

func (mj *EnvoyService) MarshalJSON() ([]byte, error)

func (*EnvoyService) MarshalJSONBuf

func (mj *EnvoyService) MarshalJSONBuf(buf fflib.EncodingBuffer) error

func (*EnvoyService) UnmarshalJSON

func (uj *EnvoyService) UnmarshalJSON(input []byte) error

func (*EnvoyService) UnmarshalJSONFFLexer

func (uj *EnvoyService) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

type EnvoyTCPRoute

type EnvoyTCPRoute struct {
	Cluster           string   `json:"cluster"`
	DestinationIPList []string `json:"destination_ip_list,omitempty"`
	DestinationPorts  string   `json:"destination_ports,omitempty"`
	SourceIPList      []string `json:"source_ip_list,omitempty"`
	SourcePorts       []string `json:"source_ports,omitempty"`
}

func (*EnvoyTCPRoute) MarshalJSON

func (mj *EnvoyTCPRoute) MarshalJSON() ([]byte, error)

func (*EnvoyTCPRoute) MarshalJSONBuf

func (mj *EnvoyTCPRoute) MarshalJSONBuf(buf fflib.EncodingBuffer) error

func (*EnvoyTCPRoute) UnmarshalJSON

func (uj *EnvoyTCPRoute) UnmarshalJSON(input []byte) error

func (*EnvoyTCPRoute) UnmarshalJSONFFLexer

func (uj *EnvoyTCPRoute) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

type EnvoyTracingConfig

type EnvoyTracingConfig struct {
	OperationName string `json:"operation_name"`
}

func (*EnvoyTracingConfig) MarshalJSON

func (mj *EnvoyTracingConfig) MarshalJSON() ([]byte, error)

func (*EnvoyTracingConfig) MarshalJSONBuf

func (mj *EnvoyTracingConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error

func (*EnvoyTracingConfig) UnmarshalJSON

func (uj *EnvoyTracingConfig) UnmarshalJSON(input []byte) error

func (*EnvoyTracingConfig) UnmarshalJSONFFLexer

func (uj *EnvoyTracingConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

type LDSResult

type LDSResult struct {
	Listeners []*EnvoyListener `json:"listeners"`
}

func (*LDSResult) MarshalJSON

func (mj *LDSResult) MarshalJSON() ([]byte, error)

func (*LDSResult) MarshalJSONBuf

func (mj *LDSResult) MarshalJSONBuf(buf fflib.EncodingBuffer) error

func (*LDSResult) UnmarshalJSON

func (uj *LDSResult) UnmarshalJSON(input []byte) error

func (*LDSResult) UnmarshalJSONFFLexer

func (uj *LDSResult) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

type Registrar

type Registrar struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewRegistrar

func NewRegistrar() *Registrar

func (*Registrar) EachEntry

func (r *Registrar) EachEntry(fn func(svcName string, entry *Entry) error) error

EachEntry iterates the entries, calling the passed function on each.

func (*Registrar) GetEntry

func (r *Registrar) GetEntry(svcName string) *Entry

GetRequest looks up on request from the map and returns a pointer if present.

func (*Registrar) PrintRequests

func (r *Registrar) PrintRequests()

func (*Registrar) Register

Register is a GRPC callback function that handles our remote calls.

type SDSResult

type SDSResult struct {
	Env     string          `json:"env"`
	Hosts   []*EnvoyService `json:"hosts"`
	Service string          `json:"service"`
}

func (*SDSResult) MarshalJSON

func (mj *SDSResult) MarshalJSON() ([]byte, error)

func (*SDSResult) MarshalJSONBuf

func (mj *SDSResult) MarshalJSONBuf(buf fflib.EncodingBuffer) error

func (*SDSResult) UnmarshalJSON

func (uj *SDSResult) UnmarshalJSON(input []byte) error

func (*SDSResult) UnmarshalJSONFFLexer

func (uj *SDSResult) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

Jump to

Keyboard shortcuts

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