Help us shape the future of Go! Take the 2026 Go Developer Survey

target

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EndpointHash

func EndpointHash(endpoints []*Endpoint) string

EndpointHash returns a deterministic hash of the given endpoints.

Types

type Endpoint

type Endpoint struct {
	Address string
	Weight  uint32
	Tags    map[string]string
	State   *State
}

Endpoint represents an upstream endpoint address with weight and state.

type State

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

State tracks the health of an endpoint with failure counting and timeout.

func NewState

func NewState(maxFails uint, failTimeout time.Duration) *State

NewState creates a new State with the given max failures and fail timeout.

func (*State) IsAvailable

func (s *State) IsAvailable() bool

IsAvailable returns true if the endpoint is healthy and accepting requests.

func (*State) RecordFailure

func (s *State) RecordFailure()

RecordFailure increments the failure count, resetting if past the fail timeout.

type Target

type Target struct {
	Name      string
	Weight    uint32
	Tags      map[string]string
	Endpoints map[string]*Endpoint
}

Target groups endpoints under a logical name with weight and tags.

Jump to

Keyboard shortcuts

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