Documentation
¶
Index ¶
- Constants
- Variables
- func DecodeMetadata[T any](payload []byte, dst *T, limit int64) error
- func Encode(frame Frame, limits Limits) ([]byte, error)
- func EncodeMetadata[T any](value T, limit int64) ([]byte, error)
- func EncodeWebSocketClose(code int, reason string) ([]byte, error)
- func FramePayloadLimit(frameType Type, limits Limits) (int64, error)
- func NextSequence(sequence uint32) (uint32, error)
- func TrimRelayURIWhitespace(raw string) string
- func ValidWebSocketRejectionStatus(status int) bool
- func ValidateWebSocketMessageType(messageType int) error
- type Authenticated
- type CommitState
- type Confirmed
- type ConnectionCloseOwner
- type DirectAccepted
- type DirectConfirmed
- type DirectHello
- type DirectReady
- type Frame
- type HandshakeOutcome
- type HandshakeOutcomeOwner
- type Headers
- type Hello
- type Limits
- type Open
- type OpenStreamKind
- type ParsedURI
- type ProbePolicy
- type Ready
- type Reset
- type StreamID
- type Trailers
- type Type
- type WebSocketAccepted
- type WebSocketEvent
- type WebSocketEventKind
- type WebSocketMessageStart
- type WebSocketOpen
- type WebSocketRejection
- type Welcome
- type WindowUpdate
Constants ¶
View Source
const ( ErrorCodeRelayProtocol = "relay_protocol" ErrorCodeUnsupportedProtocolVersion = "unsupported_protocol_version" ErrorCodeRelayOverloaded = "relay_overloaded" ErrorCodeStreamWindowTimeout = "stream_window_timeout" ErrorCodeRequestCancelled = "request_cancelled" ErrorCodeRequestDeadline = "request_deadline" ErrorCodeSessionClosed = "session_closed" ErrorCodeDrainTimeout = "drain_timeout" )
View Source
const ( ProtocolVersion uint8 = 2 HeaderSize = 28 MaxV2PayloadBytes = 64 * 1024 )
View Source
const ( DirectTunnelPath = "/internal/agent/direct-tunnel" MaxMetadataBytes = MaxV2PayloadBytes MaxV2StreamWindowBytes = 8 * 1024 * 1024 MaxV2SessionQueueBytes = 64 * 1024 * 1024 MaxV2ConcurrentStreams = 4096 )
View Source
const ( MaxWebSocketControlPayloadBytes = 125 WebSocketTextMessage = 1 WebSocketBinaryMessage = 2 WebSocketCloseProtocolError = 1002 )
Variables ¶
View Source
var ( ErrShortHeader = errors.New("tunnel: frame header too short") ErrUnsupportedVersion = errors.New("tunnel: unsupported protocol version") ErrUnknownFrameType = errors.New("tunnel: unknown frame type") ErrUnknownFlags = errors.New("tunnel: unknown frame flags") ErrPayloadLengthMismatch = errors.New("tunnel: payload length mismatch") ErrPayloadTooLarge = errors.New("tunnel: frame payload too large") ErrZeroStreamID = errors.New("tunnel: stream ID is zero") ErrSequenceOverflow = errors.New("tunnel: sequence overflow") ErrMetadataTooLarge = errors.New("tunnel: metadata too large") ErrMalformedMetadata = errors.New("tunnel: malformed metadata") ErrInvalidLimits = errors.New("tunnel: invalid limits") ErrNilMetadataDestination = errors.New("tunnel: nil metadata destination") ErrStreamIDGeneration = errors.New("tunnel: stream ID generation failed") )
View Source
var ErrInvalidOpenKind = errors.New("tunnel: invalid open stream kind")
Functions ¶
func EncodeWebSocketClose ¶ added in v0.0.16
func FramePayloadLimit ¶ added in v0.0.14
FramePayloadLimit returns the negotiated payload ceiling for one frame type.
func NextSequence ¶
func TrimRelayURIWhitespace ¶
TrimRelayURIWhitespace removes only the ASCII whitespace accepted around Relay URI input.
func ValidWebSocketRejectionStatus ¶ added in v0.0.16
ValidWebSocketRejectionStatus reports whether an ordinary HTTP response can be the terminal result of a failed WebSocket upgrade.
func ValidateWebSocketMessageType ¶ added in v0.0.16
Types ¶
type Authenticated ¶
type CommitState ¶
type CommitState uint8
const ( PreCommit CommitState = iota CommitUncertain Committed )
type ConnectionCloseOwner ¶
type ConnectionCloseOwner struct {
// contains filtered or unexported fields
}
func NewConnectionCloseOwner ¶
func NewConnectionCloseOwner(close func() error) *ConnectionCloseOwner
func (*ConnectionCloseOwner) Close ¶
func (o *ConnectionCloseOwner) Close() error
type DirectAccepted ¶ added in v0.0.14
type DirectAccepted struct {
SessionGeneration uint64 `json:"session_generation"`
}
type DirectConfirmed ¶ added in v0.0.14
type DirectConfirmed struct {
SessionGeneration uint64 `json:"session_generation"`
}
type DirectHello ¶ added in v0.0.14
type DirectReady ¶ added in v0.0.14
type Frame ¶
type HandshakeOutcome ¶
type HandshakeOutcome uint32
const ( HandshakePending HandshakeOutcome = iota HandshakeSucceeded HandshakeTimedOut HandshakeCanceled HandshakeStopped )
type HandshakeOutcomeOwner ¶
type HandshakeOutcomeOwner struct {
// contains filtered or unexported fields
}
func NewHandshakeOutcomeOwner ¶
func NewHandshakeOutcomeOwner() *HandshakeOutcomeOwner
func (*HandshakeOutcomeOwner) Outcome ¶
func (o *HandshakeOutcomeOwner) Outcome() HandshakeOutcome
func (*HandshakeOutcomeOwner) TryOwn ¶
func (o *HandshakeOutcomeOwner) TryOwn(outcome HandshakeOutcome) bool
type Limits ¶
type Limits struct {
MaxMetadataBytes int64 `json:"max_metadata_bytes"`
MaxDataBytes int64 `json:"max_data_bytes"`
InitialStreamWindow int64 `json:"initial_stream_window"`
MaxQueuedSessionBytes int64 `json:"max_queued_session_bytes"`
MaxConcurrentStreams int `json:"max_concurrent_streams"`
}
func NormalizeV2Limits ¶ added in v0.0.14
func SelectDirectLimits ¶ added in v0.0.14
type Open ¶
type Open struct {
ProbePolicy ProbePolicy `json:"probe_policy,omitempty"`
Method string `json:"method"`
Path string `json:"path"`
Header map[string][]string `json:"header"`
BodyLength int64 `json:"body_length"`
RemainingNanos int64 `json:"remaining_nanos"`
RequestID string `json:"request_id"`
SourceAgentID string `json:"source_agent_id"`
TargetAgentID string `json:"target_agent_id"`
RouteID uint `json:"route_id"`
Hop uint8 `json:"hop"`
ResponseWindow int64 `json:"response_window"`
Attempt *attemptwire.AttemptProxyMeta `json:"attempt,omitempty"`
API *apiattempt.APIAttemptMeta `json:"api,omitempty"`
WebSocket *WebSocketOpen `json:"websocket,omitempty"`
}
func (Open) IsConnectivityProbe ¶
func (Open) StreamKind ¶ added in v0.0.16
func (o Open) StreamKind() (OpenStreamKind, error)
type OpenStreamKind ¶ added in v0.0.16
type OpenStreamKind uint8
const ( OpenStreamProbe OpenStreamKind = iota + 1 OpenStreamAttempt OpenStreamAPI )
type ParsedURI ¶
func ParseRelayURI ¶
type ProbePolicy ¶ added in v0.0.14
type ProbePolicy string
const ( ProbeRespectBusinessPolicy ProbePolicy = "respect_business_policy" ProbeBypassBusinessPolicy ProbePolicy = "bypass_business_policy" )
type Type ¶
type Type uint8
const ( FrameOpen Type = iota + 1 FrameReady FrameCommit FrameCommitted FrameRequestData FrameRequestEnd FrameHeaders FrameResponseData FrameAttemptResult FrameEnd FrameCancel FrameReset FrameWindowUpdate FrameAPIResult FrameWebSocketMessageStart FrameWebSocketMessageData FrameWebSocketMessageEnd FrameWebSocketPing FrameWebSocketPong FrameWebSocketClose )
type WebSocketAccepted ¶ added in v0.0.16
type WebSocketAccepted struct {
RequestWindow int64 `json:"request_window"`
Subprotocol string `json:"subprotocol,omitempty"`
ProviderStatus int `json:"provider_status,omitempty"`
Rejection *WebSocketRejection `json:"rejection,omitempty"`
}
type WebSocketEvent ¶ added in v0.0.16
type WebSocketEvent struct {
Kind WebSocketEventKind
MessageID uint64
Type int
Data []byte
Code int
Reason string
}
func DecodeWebSocketClose ¶ added in v0.0.16
func DecodeWebSocketClose(payload []byte) (WebSocketEvent, error)
type WebSocketEventKind ¶ added in v0.0.16
type WebSocketEventKind uint8
const ( WebSocketMessageStartEvent WebSocketEventKind = iota + 1 WebSocketMessageDataEvent WebSocketMessageEndEvent WebSocketPingEvent WebSocketPongEvent WebSocketCloseEvent )
type WebSocketMessageStart ¶ added in v0.0.16
type WebSocketOpen ¶ added in v0.0.16
type WebSocketOpen struct {
ResponseWindow int64 `json:"response_window"`
}
type WebSocketRejection ¶ added in v0.0.16
type WindowUpdate ¶
type WindowUpdate struct {
Bytes int64 `json:"bytes"`
}
Click to show internal directories.
Click to hide internal directories.