endpoint

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatUpstream

func FormatUpstream(some interface{}) string

Types

type EndpointStatus

type EndpointStatus int
const (
	EndpointStatusHealthy EndpointStatus = 1 << iota
	EndpointStatusAvailable
	EndpointStatusUnreachable
)

type Provider

type Provider interface {
	GetAliveEndpoint(string, int) string
	GetEndpoint(string, string, int) string
	GetStatus(string) map[string]EndpointStatus
}

type Upstream

type Upstream struct {
	MustResolve bool
	Addr        *url.URL
	Ports       map[string]string
	// contains filtered or unexported fields
}

func ParseUpstreamAddr

func ParseUpstreamAddr(in string) (*Upstream, error)

func (*Upstream) Check

func (u *Upstream) Check(ctx context.Context) error

func (*Upstream) CheckContinuously

func (u *Upstream) CheckContinuously(ctx context.Context)

func (*Upstream) GetAddr

func (u *Upstream) GetAddr(kind string) string

func (*Upstream) ResolveDNSRecord

func (u *Upstream) ResolveDNSRecord(ctx context.Context) error

type UpstreamEndpoint

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

func (*UpstreamEndpoint) GetAddr

func (e *UpstreamEndpoint) GetAddr(kind string) string

type UpstreamHealthcheckFunc

type UpstreamHealthcheckFunc func(context.Context, string) (EndpointStatus, error)

type UpstreamProvider

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

func NewAlwaysAliveEndpoint

func NewAlwaysAliveEndpoint(url string) *UpstreamProvider

func NewUpstreamProvider

func NewUpstreamProvider(ctx context.Context, l *logrus.Logger, hosts []string, hc UpstreamHealthcheckFunc) (*UpstreamProvider, error)

func (*UpstreamProvider) GetAliveEndpoint

func (prov *UpstreamProvider) GetAliveEndpoint(kind string, tries int) string

func (*UpstreamProvider) GetEndpoint

func (prov *UpstreamProvider) GetEndpoint(kind string, exclude string, tries int) string

func (*UpstreamProvider) GetMonitoringEventTypes

func (prov *UpstreamProvider) GetMonitoringEventTypes() []string

func (*UpstreamProvider) GetStatus

func (prov *UpstreamProvider) GetStatus(kind string) map[string]EndpointStatus

func (*UpstreamProvider) SetObserver

func (prov *UpstreamProvider) SetObserver(mon monitoring.Observer)

func (*UpstreamProvider) TcpCheck

func (prov *UpstreamProvider) TcpCheck(addr string) bool

Jump to

Keyboard shortcuts

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