messaging

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidMessageID = errors.New("invalid or empty message ID")

	ErrInvalidMessageType = errors.New("invalid message type")

	ErrInvalidAction = errors.New("invalid action")

	ErrMissingReplyTo = errors.New("response message missing replyTo field")

	ErrRequestTimeout = errors.New("request timeout")

	ErrNotConnected = errors.New("not connected to agent server")

	ErrAgentNotFound = errors.New("agent not found")
)

Functions

func GenerateMessageID

func GenerateMessageID() string

GenerateMessageID generates a unique message ID

Types

type ErrorDetails

type ErrorDetails struct {
	Code    int            `json:"code,omitempty"`
	Message string         `json:"message"`
	Details map[string]any `json:"details,omitempty"`
}

ErrorDetails provides structured error information

type HTTPTunnelRequest added in v0.7.0

type HTTPTunnelRequest struct {
	// RequestID is a unique identifier for this request (UUID)
	// Used for matching request-response pairs in the WebSocket layer
	RequestID string `json:"requestID"`
	// GatewayRequestID is the request ID from the original HTTP request at the gateway
	// Used for end-to-end request tracing and correlation
	GatewayRequestID string `json:"gatewayRequestID,omitempty"`
	// Target identifies the backend service ("k8s", "monitoring", "logs", etc.)
	Target  string              `json:"target"`
	Method  string              `json:"method"`
	Path    string              `json:"path"`
	Query   string              `json:"query,omitempty"`
	Headers map[string][]string `json:"headers,omitempty"`
	Body    []byte              `json:"body,omitempty"`
}

HTTPTunnelRequest represents an HTTP request to be proxied through the cluster agent This enables proxying raw HTTP requests to Kubernetes API and other services in the data plane

func NewHTTPTunnelRequest added in v0.7.0

func NewHTTPTunnelRequest(target, method, path, query string, headers map[string][]string, body []byte) *HTTPTunnelRequest

type HTTPTunnelResponse added in v0.7.0

type HTTPTunnelResponse struct {
	RequestID  string              `json:"requestID"`
	StatusCode int                 `json:"statusCode"`
	Headers    map[string][]string `json:"headers,omitempty"`
	Body       []byte              `json:"body,omitempty"`
	Error      *ErrorDetails       `json:"error,omitempty"`
}

HTTPTunnelResponse represents an HTTP response from the data plane backend service

func NewHTTPTunnelErrorResponse added in v0.7.0

func NewHTTPTunnelErrorResponse(req *HTTPTunnelRequest, statusCode int, errMsg string) *HTTPTunnelResponse

func NewHTTPTunnelSuccessResponse added in v0.7.0

func NewHTTPTunnelSuccessResponse(req *HTTPTunnelRequest, statusCode int, headers map[string][]string, body []byte) *HTTPTunnelResponse

func (*HTTPTunnelResponse) IsError added in v0.7.0

func (r *HTTPTunnelResponse) IsError() bool

func (*HTTPTunnelResponse) IsSuccess added in v0.7.0

func (r *HTTPTunnelResponse) IsSuccess() bool

type HTTPTunnelStreamChunk added in v0.7.0

type HTTPTunnelStreamChunk struct {
	RequestID string `json:"requestID"`
	Data      []byte `json:"data"`
	StreamID  int    `json:"streamId,omitempty"` // For multiplexed streams (SPDY)
	IsClose   bool   `json:"isClose,omitempty"`  // True when stream ends
}

func NewHTTPTunnelStreamChunk added in v0.7.0

func NewHTTPTunnelStreamChunk(requestID string, data []byte, isClose bool) *HTTPTunnelStreamChunk

type HTTPTunnelStreamInit added in v0.7.0

type HTTPTunnelStreamInit struct {
	RequestID    string              `json:"requestID"`
	Target       string              `json:"target"`
	Method       string              `json:"method"`
	Path         string              `json:"path"`
	Query        string              `json:"query,omitempty"`
	Headers      map[string][]string `json:"headers,omitempty"`
	IsUpgrade    bool                `json:"isUpgrade"`              // True for SPDY/WebSocket upgrades
	UpgradeProto string              `json:"upgradeProto,omitempty"` // "SPDY/3.1", "websocket", etc.
}

func NewHTTPTunnelStreamInit added in v0.7.0

func NewHTTPTunnelStreamInit(target, method, path, query string, headers map[string][]string, isUpgrade bool, upgradeProto string) *HTTPTunnelStreamInit

type HTTPTunnelStreamResponse added in v0.7.0

type HTTPTunnelStreamResponse struct {
	RequestID  string              `json:"requestID"`
	StatusCode int                 `json:"statusCode"`
	Headers    map[string][]string `json:"headers,omitempty"`
	Error      *ErrorDetails       `json:"error,omitempty"`
}

func NewHTTPTunnelStreamErrorResponse added in v0.7.0

func NewHTTPTunnelStreamErrorResponse(req *HTTPTunnelStreamInit, statusCode int, errMsg string) *HTTPTunnelStreamResponse

func NewHTTPTunnelStreamResponse added in v0.7.0

func NewHTTPTunnelStreamResponse(req *HTTPTunnelStreamInit, statusCode int, headers map[string][]string) *HTTPTunnelStreamResponse

Jump to

Keyboard shortcuts

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