Back to godoc.org

Package route

v0.0.0-...-1e28509
Latest Go to latest

The highest tagged major version is .

Published: Oct 13, 2020 | Licenses: Apache-2.0 , BSD-2-Clause-FreeBSD , BSD-3-Clause , MIT | Module: code.cloudfoundry.org/gorouter

Index

Constants

const (
	UNMODIFIED = PoolPutResult(iota)
	UPDATED
	ADDED
)

func PoolsMatch

func PoolsMatch(p1, p2 *EndpointPool) bool

type Counter

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

func NewCounter

func NewCounter(initial int64) *Counter

func (*Counter) Count

func (c *Counter) Count() int64

func (*Counter) Decrement

func (c *Counter) Decrement()

func (*Counter) Increment

func (c *Counter) Increment()

type Endpoint

type Endpoint struct {
	ApplicationId string

	Tags                 map[string]string
	ServerCertDomainSAN  string
	PrivateInstanceId    string
	StaleThreshold       time.Duration
	RouteServiceUrl      string
	PrivateInstanceIndex string
	ModificationTag      models.ModificationTag
	Stats                *Stats
	IsolationSegment     string

	UpdatedAt        time.Time
	RoundTripperInit sync.Once
	// contains filtered or unexported fields
}

func NewEndpoint

func NewEndpoint(opts *EndpointOpts) *Endpoint

func (*Endpoint) CanonicalAddr

func (e *Endpoint) CanonicalAddr() string

func (*Endpoint) Component

func (rm *Endpoint) Component() string

func (*Endpoint) IsTLS

func (e *Endpoint) IsTLS() bool

func (*Endpoint) MarshalJSON

func (e *Endpoint) MarshalJSON() ([]byte, error)

func (*Endpoint) RoundTripper

func (e *Endpoint) RoundTripper() ProxyRoundTripper

func (*Endpoint) SetRoundTripper

func (e *Endpoint) SetRoundTripper(tripper ProxyRoundTripper)

func (*Endpoint) SetRoundTripperIfNil

func (e *Endpoint) SetRoundTripperIfNil(roundTripperCtor func() ProxyRoundTripper)

func (*Endpoint) ToLogData

func (e *Endpoint) ToLogData() []zap.Field

type EndpointIterator

type EndpointIterator interface {
	Next() *Endpoint
	EndpointFailed(err error)
	PreRequest(e *Endpoint)
	PostRequest(e *Endpoint)
}

go:generate counterfeiter -o fakes/fake_endpoint_iterator.go . EndpointIterator

func NewLeastConnection

func NewLeastConnection(p *EndpointPool, initial string) EndpointIterator

func NewRoundRobin

func NewRoundRobin(p *EndpointPool, initial string) EndpointIterator

type EndpointOpts

type EndpointOpts struct {
	AppId                   string
	Host                    string
	Port                    uint16
	ServerCertDomainSAN     string
	PrivateInstanceId       string
	PrivateInstanceIndex    string
	Tags                    map[string]string
	StaleThresholdInSeconds int
	RouteServiceUrl         string
	ModificationTag         models.ModificationTag
	IsolationSegment        string
	UseTLS                  bool
	UpdatedAt               time.Time
}

type EndpointPool

type EndpointPool struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewPool

func NewPool(opts *PoolOpts) *EndpointPool

func (*EndpointPool) ContextPath

func (p *EndpointPool) ContextPath() string

func (*EndpointPool) Each

func (p *EndpointPool) Each(f func(endpoint *Endpoint))

func (*EndpointPool) EndpointFailed

func (p *EndpointPool) EndpointFailed(endpoint *Endpoint, err error)

func (*EndpointPool) Endpoints

func (p *EndpointPool) Endpoints(defaultLoadBalance, initial string) EndpointIterator

func (*EndpointPool) Host

func (p *EndpointPool) Host() string

func (*EndpointPool) IsEmpty

func (p *EndpointPool) IsEmpty() bool

func (*EndpointPool) IsOverloaded

func (p *EndpointPool) IsOverloaded() bool

func (*EndpointPool) MarkUpdated

func (p *EndpointPool) MarkUpdated(t time.Time)

func (*EndpointPool) MarshalJSON

func (p *EndpointPool) MarshalJSON() ([]byte, error)

func (*EndpointPool) MaxConnsPerBackend

func (p *EndpointPool) MaxConnsPerBackend() int64

func (*EndpointPool) PruneEndpoints

func (p *EndpointPool) PruneEndpoints() []*Endpoint

func (*EndpointPool) Put

func (p *EndpointPool) Put(endpoint *Endpoint) PoolPutResult

func (*EndpointPool) Remove

func (p *EndpointPool) Remove(endpoint *Endpoint) bool

Returns true if the endpoint was removed from the EndpointPool, false otherwise.

func (*EndpointPool) RouteServiceUrl

func (p *EndpointPool) RouteServiceUrl() string

type LeastConnection

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

func (*LeastConnection) EndpointFailed

func (r *LeastConnection) EndpointFailed(err error)

func (*LeastConnection) Next

func (r *LeastConnection) Next() *Endpoint

func (*LeastConnection) PostRequest

func (r *LeastConnection) PostRequest(e *Endpoint)

func (*LeastConnection) PreRequest

func (r *LeastConnection) PreRequest(e *Endpoint)

type PoolOpts

type PoolOpts struct {
	RetryAfterFailure  time.Duration
	Host               string
	ContextPath        string
	MaxConnsPerBackend int64
	Logger             logger.Logger
}

type PoolPutResult

type PoolPutResult int

type ProxyRoundTripper

type ProxyRoundTripper interface {
	http.RoundTripper
	CancelRequest(*http.Request)
}

type RoundRobin

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

func (*RoundRobin) EndpointFailed

func (r *RoundRobin) EndpointFailed(err error)

func (*RoundRobin) Next

func (r *RoundRobin) Next() *Endpoint

func (*RoundRobin) PostRequest

func (r *RoundRobin) PostRequest(e *Endpoint)

func (*RoundRobin) PreRequest

func (r *RoundRobin) PreRequest(e *Endpoint)

type Stats

type Stats struct {
	NumberConnections *Counter
}

func NewStats

func NewStats() *Stats

type Uri

type Uri string

func (Uri) NextWildcard

func (u Uri) NextWildcard() (Uri, error)

func (Uri) RouteKey

func (u Uri) RouteKey() Uri

func (Uri) String

func (u Uri) String() string

func (Uri) ToLower

func (u Uri) ToLower() Uri

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier