proc

package
v1.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIPNotSet = errors.New("ip not set")
)
View Source
var (
	// ErrUnsupportedProtocol indicates the protocol is not supported.
	ErrUnsupportedProtocol = errors.New("unsupported protocol")
)

Functions

func RegisterBuilder

func RegisterBuilder(p protocol.Protocol, b Builder)

RegisterBuilder registers the given proc builder to the builder map.

Types

type BuildParams

type BuildParams struct {
	Name   string
	Cfg    *service.Config
	Hosts  []*host.Host
	Stats  *Stats
	Logger log.Logger
}

type Builder

type Builder interface {
	// Build builds a new processor.
	Build(params BuildParams) (Proc, error)
}

Builder creates a processor.

type CommonStats

type CommonStats struct {
	CxTotal        *stats.Counter   // total connections
	CxDestroyTotal *stats.Counter   // destroyed connections
	CxActive       *stats.Gauge     // active connections
	CxLengthSec    *stats.Histogram // connection length
	CxRxBytesTotal *stats.Counter   // received connection bytes
	CxTxBytesTotal *stats.Counter   // sent connection bytes

	RqTotal         *stats.Counter   // total request
	RqSuccessTotal  *stats.Counter   // success request
	RqFailureTotal  *stats.Counter   // failed request
	RqActive        *stats.Gauge     // active request
	RqDurationMs    *stats.Histogram // request duration
	RqRxBytesLength *stats.Histogram // received request bytes length
	RqTxBytesLength *stats.Histogram // sent request bytes length
}

type ConnHandlerFunc

type ConnHandlerFunc func(conn net.Conn)

type DownstreamStats

type DownstreamStats struct {
	*stats.Scope
	CommonStats
	CxRestricted *stats.Counter // restricted connections
}

func NewDownstreamStats

func NewDownstreamStats(scope *stats.Scope) *DownstreamStats

type Listener

type Listener interface {
	Address() string
	Serve() error
	Drain() error
	Stop() error
}

func NewListener

func NewListener(cfg *service.Listener, stats *DownstreamStats, logger log.Logger, connHandleFn ConnHandlerFunc) (Listener, error)

type Proc

type Proc interface {
	Name() string
	Address() string
	Config() *service.Config

	OnSvcHostAdd([]*host.Host) error
	OnSvcHostRemove([]*host.Host) error
	OnSvcAllHostReplace([]*host.Host) error

	OnSvcConfigUpdate(*service.Config) error

	Start() error
	StopListen() error
	Stop() error
}

Proc is used to handle and forward the network traffic.

func New

func New(name string, cfg *service.Config, hosts []*host.Host) (p Proc, err error)

New creates a processor with given config.

type Stats

type Stats struct {
	*stats.Scope
	Downstream *DownstreamStats
	Upstream   *UpstreamStats
}

func NewStats

func NewStats(scope *stats.Scope) *Stats

type UpstreamStats

type UpstreamStats struct {
	*stats.Scope
	CommonStats
	CxConnectTimeout *stats.Counter // total connection connect timeouts
	CxConnectFail    *stats.Counter // total connection failures
}

func NewUpstreamStats

func NewUpstreamStats(scope *stats.Scope) *UpstreamStats

Directories

Path Synopsis
internal
hc
lb
log
net
syscall
Package syscall provides functionalities that grpc uses to get low-level operating system stats/info.
Package syscall provides functionalities that grpc uses to get low-level operating system stats/info.
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
compressor
Package compressor is a generated GoMock package.
Package compressor is a generated GoMock package.

Jump to

Keyboard shortcuts

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