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 APIOpen
- type Address
- type AgentLookup
- type AttemptStream
- type AttemptStreamOpener
- type AttemptStreamRequest
- type AttemptTransportOutcome
- type DirectAttemptStreamOpener
- type DirectAttemptStreamReservation
- type DirectAttemptTransport
- type DirectAttemptTransportBuilder
- 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) AttemptTransportOutcome
- func (f *DirectForwarder) ResetCircuit(targetAgentID, addressFingerprint string)
- func (f *DirectForwarder) ResourceCount() int
- type DirectForwarderOptions
- type DirectHTTPAPIStreamOpener
- type DirectHTTPAPIStreamReservation
- type DirectHTTPAPITransport
- type DirectHTTPAPITransportBuilder
- type DirectPathDisabledEvent
- type DirectPathDisabledReason
- type DirectPathDisabledRecorder
- type DirectProbeStreamOpener
- type DirectRequest
- type DirectRequestForwarder
- type DirectSessionTarget
- type DirectTargetSnapshot
- type DirectTransportIdentity
- type DirectTransportRequest
- type DirectWebSocketAPIStreamOpener
- type ForwardAuthSnapshot
- type HTTPAPIStream
- type HTTPAPIStreamOpener
- type IngressMeta
- type ProbePolicy
- type ProbeStream
- type ProbeStreamOpener
- type ProbeStreamRequest
- type RelayLink
- type RelayTransportRequest
- type TargetSelectionError
Constants ¶
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" CodeRelayNotReady = "relay_not_ready" CodeRelayCommitUncertain = "relay_commit_uncertain" CodeRelayResponseInterrupted = "relay_response_interrupted" CodeRequestCancelled = "request_cancelled" CodeRequestDeadline = "request_deadline" )
const ( IngressKindDirectTunnel = "direct_tunnel" IngressKindRelayTunnel = "relay_tunnel" )
const ( ProbeRespectBusinessPolicy = app.ProbeRespectBusinessPolicy ProbeBypassBusinessPolicy = app.ProbeBypassBusinessPolicy )
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 AttemptStream ¶ added in v0.0.14
type AttemptStream = app.AttemptStream
type AttemptStreamOpener ¶ added in v0.0.14
type AttemptStreamOpener = app.AttemptStreamOpener
type AttemptStreamRequest ¶ added in v0.0.14
type AttemptStreamRequest = app.AttemptStreamRequest
type AttemptTransportOutcome ¶ added in v0.0.14
type AttemptTransportOutcome struct {
ResponseStarted bool
Commit tunnel.CommitState
Stage string
Code string
AttemptResult *attemptwire.AttemptProxyResult
Err error
// contains filtered or unexported fields
}
func ExecuteDirectTransport ¶ added in v0.0.13
func ExecuteDirectTransport( ctx context.Context, direct DirectRequestForwarder, req DirectTransportRequest, dst http.ResponseWriter, ) AttemptTransportOutcome
func ExecuteRelayTransport ¶ added in v0.0.13
func ExecuteRelayTransport( ctx context.Context, link AttemptStreamOpener, req RelayTransportRequest, dst http.ResponseWriter, ) AttemptTransportOutcome
type DirectAttemptStreamOpener ¶ added in v0.0.14
type DirectAttemptStreamOpener interface {
OpenAttemptStream(
context.Context,
DirectSessionTarget,
app.AttemptStreamRequest,
) (app.AttemptStream, error)
}
DirectAttemptStreamOpener opens an attempt stream to a frozen direct target.
type DirectAttemptStreamReservation ¶ added in v0.0.14
type DirectAttemptStreamReservation interface {
TransportIdentity() DirectTransportIdentity
AddressFingerprint() string
OpenAttemptStream(context.Context, app.AttemptStreamRequest) (app.AttemptStream, error)
Release()
}
DirectAttemptStreamReservation owns one acquired session admission. Its actual transport may differ from the built transport when a replacement falls back to a still-healthy prior session. Release is idempotent.
type DirectAttemptTransport ¶ added in v0.0.14
type DirectAttemptTransport interface {
TransportIdentity() DirectTransportIdentity
AcquireAttemptStream(context.Context) (DirectAttemptStreamReservation, error)
}
DirectAttemptTransport freezes the pool inputs used by one Direct attempt. Building it performs local validation only. AcquireAttemptStream owns session admission and dialing; the returned reservation opens the attempt stream.
type DirectAttemptTransportBuilder ¶ added in v0.0.14
type DirectAttemptTransportBuilder interface {
BuildDirectAttemptTransport(context.Context, DirectSessionTarget) (DirectAttemptTransport, error)
}
DirectAttemptTransportBuilder builds a frozen transport for a Direct target.
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) AttemptTransportOutcome
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 {
Transports DirectAttemptTransportBuilder
CircuitStateLimit int
CircuitFailureThreshold int
CircuitOpenDuration time.Duration
Now func() time.Time
OnCircuitTransition func(DirectCircuitTransition)
}
type DirectHTTPAPIStreamOpener ¶ added in v0.0.16
type DirectHTTPAPIStreamOpener interface {
OpenHTTPAPIStream(
context.Context,
DirectSessionTarget,
app.APIOpen,
) (app.HTTPAPIStream, error)
}
DirectHTTPAPIStreamOpener opens a Generic API stream to a frozen direct target.
type DirectHTTPAPIStreamReservation ¶ added in v0.0.16
type DirectHTTPAPIStreamReservation interface {
TransportIdentity() DirectTransportIdentity
AddressFingerprint() string
OpenHTTPAPIStream(context.Context, app.APIOpen) (app.HTTPAPIStream, error)
Release()
}
DirectHTTPAPIStreamReservation owns one acquired session admission for a Generic API stream. Release is idempotent.
type DirectHTTPAPITransport ¶ added in v0.0.16
type DirectHTTPAPITransport interface {
TransportIdentity() DirectTransportIdentity
AcquireHTTPAPIStream(context.Context) (DirectHTTPAPIStreamReservation, error)
}
DirectHTTPAPITransport freezes the pool inputs used by one Generic API stream.
type DirectHTTPAPITransportBuilder ¶ added in v0.0.16
type DirectHTTPAPITransportBuilder interface {
BuildDirectHTTPAPITransport(context.Context, DirectSessionTarget) (DirectHTTPAPITransport, error)
}
type DirectPathDisabledEvent ¶ added in v0.0.14
type DirectPathDisabledEvent struct {
SourceAgentID string
TargetAgentID string
Reason DirectPathDisabledReason
}
type DirectPathDisabledReason ¶ added in v0.0.14
type DirectPathDisabledReason string
const ( DirectPathDisabledSourceOutbound DirectPathDisabledReason = "source_direct_outbound_disabled" DirectPathDisabledTargetInbound DirectPathDisabledReason = "target_direct_inbound_disabled" )
type DirectPathDisabledRecorder ¶ added in v0.0.14
type DirectPathDisabledRecorder interface {
RecordDirectPathDisabled(DirectPathDisabledEvent)
}
type DirectProbeStreamOpener ¶ added in v0.0.14
type DirectProbeStreamOpener interface {
OpenProbeStream(
context.Context,
DirectSessionTarget,
app.ProbeStreamRequest,
) (app.ProbeStream, error)
}
DirectProbeStreamOpener opens a connectivity probe stream to a frozen direct target.
type DirectRequest ¶ added in v0.0.13
type DirectRequest struct {
Target DirectSessionTarget
RouteID uint
RequestID string
Hop uint8
Request *http.Request
Body app.ReplayBody
Attempt attemptwire.AttemptProxyMeta
}
DirectRequest carries only what the tunnel attempt stream needs. The frozen target owns the address; credentials belong to the session pool.
type DirectRequestForwarder ¶ added in v0.0.13
type DirectRequestForwarder interface {
Forward(context.Context, DirectRequest, http.ResponseWriter) AttemptTransportOutcome
}
type DirectSessionTarget ¶ added in v0.0.14
type DirectSessionTarget struct {
TargetAgentID string
AddressFingerprint string
WebSocketURL *url.URL
ProxyURL *url.URL
}
DirectSessionTarget is the frozen address of a direct peer. Callers resolve and freeze the address once; the pool never re-selects an address internally. WebSocketURL and ProxyURL are already validated by the resolver. The pool treats them as opaque, only ever emitting the sanitized endpoint in errors.
func PrepareDirectTarget ¶ added in v0.0.13
func PrepareDirectTarget(snapshot DirectTargetSnapshot) (DirectSessionTarget, error)
PrepareDirectTarget resolves and freezes the direct peer address once. The returned target holds the canonical http/https base URL; the session pool and dialer adapt it to ws/wss at the dial boundary.
type DirectTargetSnapshot ¶ added in v0.0.13
type DirectTransportIdentity ¶ added in v0.0.14
type DirectTransportIdentity [32]byte
DirectTransportIdentity is an opaque fingerprint of the peer address, effective proxy, and credential generation. It is safe to use as a circuit key because it never contains their raw values.
type DirectTransportRequest ¶ added in v0.0.13
type DirectTransportRequest struct {
TargetAgentID string
RouteID uint
RequestID string
Hop uint8
PreparedTarget DirectSessionTarget
Request *http.Request
Body app.ReplayBody
Attempt attemptwire.AttemptProxyMeta
}
type DirectWebSocketAPIStreamOpener ¶ added in v0.0.16
type DirectWebSocketAPIStreamOpener interface {
OpenWebSocketAPIStream(
context.Context,
DirectSessionTarget,
app.WebSocketOpen,
) (app.WebSocketAPIStream, error)
}
DirectWebSocketAPIStreamOpener opens one Generic API WebSocket stream to a frozen direct target. Implementations must not retry or choose another path.
type ForwardAuthSnapshot ¶ added in v0.0.13
func (ForwardAuthSnapshot) SupportsForwardTickets ¶ added in v0.0.13
func (s ForwardAuthSnapshot) SupportsForwardTickets() bool
type HTTPAPIStream ¶ added in v0.0.16
type HTTPAPIStream = app.HTTPAPIStream
type HTTPAPIStreamOpener ¶ added in v0.0.16
type HTTPAPIStreamOpener = app.HTTPAPIStreamOpener
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 ProbePolicy ¶ added in v0.0.14
type ProbePolicy = app.ProbePolicy
type ProbeStream ¶ added in v0.0.14
type ProbeStream = app.ProbeStream
type ProbeStreamOpener ¶ added in v0.0.14
type ProbeStreamOpener = app.ProbeStreamOpener
type ProbeStreamRequest ¶ added in v0.0.14
type ProbeStreamRequest = app.ProbeStreamRequest
type RelayTransportRequest ¶ added in v0.0.13
type RelayTransportRequest struct {
TargetAgentID string
RouteID uint
RequestID string
Request *http.Request
Body app.ReplayBody
Attempt *attemptwire.AttemptProxyMeta
}
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