Documentation
¶
Index ¶
- Constants
- func CanonicalAddressFingerprint(addresses []Address) string
- func CanonicalRequestID(raw string) string
- func ResolveAddress(addresses []Address, addressTag, preferredTag, cacheKey string) (string, error)
- func ResolveProxyURL(agentProxyURL, globalProxyURL string) string
- func SelectTarget(selector app.AgentSelector, requestID string, routeID uint, lookup AgentLookup) (models.Agent, error)
- func StableAgentRing(requestID string, routeID uint, tag string, candidates []string) []string
- func VerifyForwardTicket(snapshot ForwardAuthSnapshot, raw agentauth.ForwardTicket) (*agentauth.ForwardClaims, error)
- func WithIngressMeta(ctx context.Context, meta IngressMeta) context.Context
- type Address
- type AgentLookup
- type BeforeWriteError
- type DirectCircuitTransition
- type DirectForwarder
- func (f *DirectForwarder) Cancel()
- func (f *DirectForwarder) Close(ctx context.Context) error
- func (f *DirectForwarder) Done() <-chan struct{}
- func (f *DirectForwarder) Forward(ctx context.Context, req DirectRequest, dst http.ResponseWriter) DirectOutcome
- func (f *DirectForwarder) ResetCircuit(targetAgentID, addressFingerprint string)
- func (f *DirectForwarder) ResourceCount() int
- type DirectForwarderOptions
- type DirectOutcome
- type DirectRequest
- type DirectRequestForwarder
- type DirectTargetSnapshot
- type DirectTransportRequest
- type ForwardAuthSnapshot
- type IngressMeta
- type PreparedDirectTarget
- type RelayLink
- type RelayRequest
- type RelayStream
- type RelayTransportRequest
- type ReplayBody
- type TargetSelectionError
Constants ¶
View Source
const ( CodeDirectDNS = "direct_dns" CodeDirectConnect = "direct_connect" CodeDirectTLS = "direct_tls" CodeDirectRoundTrip = "direct_round_trip" CodeDirectCircuitOpen = "direct_circuit_open" CodeDirectCircuitHalfOpen = "direct_circuit_half_open" CodeDirectCircuitCapacity = "direct_circuit_capacity" CodeDirectInvalidInput = "direct_invalid_input" CodeDirectBody = "direct_body" CodeDirectResponseCopy = "direct_response_copy" CodeDirectClosed = "direct_closed" CodeDirectDisabled = "direct_disabled" CodeDirectIngressUnsupported = "direct_ingress_unsupported" CodeDirectIdentityMismatch = "direct_identity_mismatch" CodeDirectProbeInvalidResponse = "direct_probe_invalid_response" CodeDirectCommitUncertain = "direct_commit_uncertain" CodeDirectResponseInterrupted = "direct_response_interrupted" CodeRelayFallbackDisabled = tunnel.ErrorCodeRelayFallbackDisabled CodeRelayNotReady = "relay_not_ready" CodeRelayCommitUncertain = "relay_commit_uncertain" CodeRelayResponseInterrupted = "relay_response_interrupted" CodeRequestCancelled = "request_cancelled" CodeRequestDeadline = "request_deadline" )
View Source
const ( IngressKindDirect = "direct" IngressKindTunnel = "tunnel" )
View Source
const ( RouteHashVersionV1 = "route_hash_v1" CodeSelectorInvalid = "selector_invalid" CodeTargetNotFound = "target_not_found" CodeTargetDisabled = "target_disabled" CodeTagNoCandidate = "tag_no_candidate" )
Variables ¶
This section is empty.
Functions ¶
func CanonicalAddressFingerprint ¶ added in v0.0.13
func CanonicalRequestID ¶ added in v0.0.13
func ResolveAddress ¶
ResolveAddress selects the best address for the target agent. Priority: addressTag -> preferredTag -> auto-probe (first reachable, cached 60s).
func ResolveProxyURL ¶
ResolveProxyURL returns the proxy URL to use for forwarding. Priority: per-agent > global default.
func SelectTarget ¶ added in v0.0.13
func SelectTarget(selector app.AgentSelector, requestID string, routeID uint, lookup AgentLookup) (models.Agent, error)
func StableAgentRing ¶ added in v0.0.13
StableAgentRing returns every candidate in the same deterministic order used by SelectTarget. It only compacts, sorts, and rotates agent IDs.
func VerifyForwardTicket ¶ added in v0.0.13
func VerifyForwardTicket(snapshot ForwardAuthSnapshot, raw agentauth.ForwardTicket) (*agentauth.ForwardClaims, error)
func WithIngressMeta ¶ added in v0.0.13
func WithIngressMeta(ctx context.Context, meta IngressMeta) context.Context
Types ¶
type Address ¶
type Address = app.AgentAddress
func ParseAddresses ¶
ParseAddresses parses the JSON http_addresses field.
type AgentLookup ¶ added in v0.0.13
type BeforeWriteError ¶ added in v0.0.13
BeforeWriteError is emitted only by dial and TLS stages that complete before http.Transport receives a connection capable of writing the request.
func (*BeforeWriteError) Error ¶ added in v0.0.13
func (e *BeforeWriteError) Error() string
func (*BeforeWriteError) Unwrap ¶ added in v0.0.13
func (e *BeforeWriteError) Unwrap() error
type DirectCircuitTransition ¶ added in v0.0.13
type DirectForwarder ¶ added in v0.0.13
type DirectForwarder struct {
// contains filtered or unexported fields
}
func NewDirectForwarder ¶ added in v0.0.13
func NewDirectForwarder(opts DirectForwarderOptions) *DirectForwarder
func (*DirectForwarder) Cancel ¶ added in v0.0.13
func (f *DirectForwarder) Cancel()
func (*DirectForwarder) Close ¶ added in v0.0.13
func (f *DirectForwarder) Close(ctx context.Context) error
func (*DirectForwarder) Done ¶ added in v0.0.13
func (f *DirectForwarder) Done() <-chan struct{}
func (*DirectForwarder) Forward ¶ added in v0.0.13
func (f *DirectForwarder) Forward(ctx context.Context, req DirectRequest, dst http.ResponseWriter) DirectOutcome
func (*DirectForwarder) ResetCircuit ¶ added in v0.0.13
func (f *DirectForwarder) ResetCircuit(targetAgentID, addressFingerprint string)
func (*DirectForwarder) ResourceCount ¶ added in v0.0.13
func (f *DirectForwarder) ResourceCount() int
type DirectForwarderOptions ¶ added in v0.0.13
type DirectForwarderOptions struct {
TransportLimit int
CircuitStateLimit int
CircuitFailureThreshold int
CircuitOpenDuration time.Duration
ResponseHeaderTimeout time.Duration
TLSHandshakeTimeout time.Duration
DialContext func(context.Context, string, string) (net.Conn, error)
TLSClientConfig *tls.Config
Now func() time.Time
OnCircuitTransition func(DirectCircuitTransition)
}
type DirectOutcome ¶ added in v0.0.13
type DirectOutcome struct {
ResponseStarted bool
Commit tunnel.CommitState
Stage string
Code string
Err error
}
func ExecuteDirectTransport ¶ added in v0.0.13
func ExecuteDirectTransport( ctx context.Context, direct DirectRequestForwarder, req DirectTransportRequest, dst http.ResponseWriter, ) DirectOutcome
func ExecuteRelayTransport ¶ added in v0.0.13
func ExecuteRelayTransport( ctx context.Context, link RelayLink, req RelayTransportRequest, dst http.ResponseWriter, ) DirectOutcome
type DirectRequest ¶ added in v0.0.13
type DirectRequest struct {
TargetAgentID string
RouteID uint
Hop uint8
AddressFingerprint string
TargetURL *url.URL
ProxyURL *url.URL
Request *http.Request
Body ReplayBody
ForwardTicket agentauth.ForwardTicket
Attempt *attemptwire.AttemptProxyMeta
}
type DirectRequestForwarder ¶ added in v0.0.13
type DirectRequestForwarder interface {
Forward(context.Context, DirectRequest, http.ResponseWriter) DirectOutcome
}
type DirectTargetSnapshot ¶ added in v0.0.13
type DirectTransportRequest ¶ added in v0.0.13
type DirectTransportRequest struct {
TargetAgentID string
RouteID uint
Hop uint8
PreparedTarget PreparedDirectTarget
Request *http.Request
Body ReplayBody
ForwardTicket agentauth.ForwardTicket
Attempt *attemptwire.AttemptProxyMeta
}
type ForwardAuthSnapshot ¶ added in v0.0.13
func (ForwardAuthSnapshot) SupportsForwardTickets ¶ added in v0.0.13
func (s ForwardAuthSnapshot) SupportsForwardTickets() bool
type IngressMeta ¶ added in v0.0.13
type IngressMeta struct {
Kind string
SourceAgentID string
RouteID uint
StreamID tunnel.StreamID
Hop uint8
Attempt *attemptproxy.AttemptProxyMeta
}
func IngressMetaFromContext ¶ added in v0.0.13
func IngressMetaFromContext(ctx context.Context) (IngressMeta, bool)
type PreparedDirectTarget ¶ added in v0.0.13
func PrepareDirectTarget ¶ added in v0.0.13
func PrepareDirectTarget(snapshot DirectTargetSnapshot) (PreparedDirectTarget, error)
type RelayRequest ¶ added in v0.0.13
type RelayRequest = app.RelayRequest
type RelayStream ¶ added in v0.0.13
type RelayStream = app.RelayStream
type RelayTransportRequest ¶ added in v0.0.13
type RelayTransportRequest struct {
Purpose tunnel.StreamPurpose
TargetAgentID string
RouteID uint
RequestID string
Request *http.Request
Body ReplayBody
Attempt *attemptwire.AttemptProxyMeta
}
type ReplayBody ¶ added in v0.0.13
type ReplayBody interface {
Size() int64
Open() (io.ReadCloser, error)
Bytes(limit int64) ([]byte, error)
Close() error
}
ReplayBody is the request-owned body contract consumed by DirectForwarder.
type TargetSelectionError ¶ added in v0.0.13
type TargetSelectionError struct {
// contains filtered or unexported fields
}
func (*TargetSelectionError) Error ¶ added in v0.0.13
func (e *TargetSelectionError) Error() string
func (*TargetSelectionError) SelectionCode ¶ added in v0.0.13
func (e *TargetSelectionError) SelectionCode() string
Click to show internal directories.
Click to hide internal directories.