Documentation
¶
Index ¶
- type Channel
- type ControlPlaneRequestID
- type RequestID
- type ResponseType
- type TunnelID
- type TunnelResponse
- func NewJSONRPCNotification(channel Channel, response json.RawMessage, code int, headers http.Header) *TunnelResponse
- func NewNotificationAck(channel Channel, code int, headers http.Header) *TunnelResponse
- func NewOAuthDiscoveryResponse(channel Channel, response json.RawMessage, code int, headers http.Header) *TunnelResponse
- func NewSessionTerminationResponse(channel Channel, code int, headers http.Header) *TunnelResponse
- func NewTunnelResponse(channel Channel, response json.RawMessage, code int, headers http.Header) *TunnelResponse
- type TunnelServiceRequestID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel string
func NormalizeChannel ¶
NormalizeChannel validates the provided channel and returns DefaultChannel when empty.
type ControlPlaneRequestID ¶
type ControlPlaneRequestID string
ControlPlaneRequestID traces a request path through plugin-service/connectors while they communicate with tunnel-service. The ID is echoed back via the X-Request-Id header so clients can correlate failures with server traces.
func NewControlPlaneRequestIDFromHeader ¶
func NewControlPlaneRequestIDFromHeader(h http.Header) (ControlPlaneRequestID, bool)
NewControlPlaneRequestIDFromHeader extracts the request identifier from the provided HTTP headers. The boolean indicates whether the header was present.
func (ControlPlaneRequestID) String ¶
func (r ControlPlaneRequestID) String() string
String returns the string version of the upstream request identifier.
type RequestID ¶
type RequestID string
RequestID identifies a single command request polled from the control plane.
type ResponseType ¶
type ResponseType int
ResponseType enumerates the kinds of responses that can be returned to the control plane.
const ( // ResponseTypeJSONRPCResponse indicates the payload carries a JSON-RPC // response from the MCP server. ResponseTypeJSONRPCResponse ResponseType = iota // ResponseTypeJSONRPCNotification indicates the payload carries a JSON-RPC // notification emitted by the MCP server. ResponseTypeJSONRPCNotification // ResponseTypeNotificationAcknowledgment indicates the payload acknowledges a // notification that produced no JSON-RPC response body. ResponseTypeNotificationAcknowledgment // ResponseTypeOAuthDiscovery indicates the payload contains OAuth discovery // metadata fetched from the MCP server. ResponseTypeOAuthDiscovery // ResponseTypeSessionTermination indicates the payload reports an explicit session close. ResponseTypeSessionTermination )
type TunnelResponse ¶
type TunnelResponse struct {
// contains filtered or unexported fields
}
TunnelResponse bundles the MCP response metadata (status code + headers) with either a JSON-RPC response message or a notification acknowledgement.
func NewJSONRPCNotification ¶
func NewJSONRPCNotification(channel Channel, response json.RawMessage, code int, headers http.Header) *TunnelResponse
NewJSONRPCNotification constructs a TunnelResponse that forwards a JSON-RPC notification payload emitted by the MCP server.
func NewNotificationAck ¶
func NewNotificationAck(channel Channel, code int, headers http.Header) *TunnelResponse
NewNotificationAck constructs a TunnelResponse representing a successful acknowledgement of a JSON-RPC notification (which carries no response body).
func NewOAuthDiscoveryResponse ¶
func NewOAuthDiscoveryResponse(channel Channel, response json.RawMessage, code int, headers http.Header) *TunnelResponse
NewOAuthDiscoveryResponse constructs a TunnelResponse representing OAuth metadata fetched from the MCP server.
func NewSessionTerminationResponse ¶
func NewSessionTerminationResponse(channel Channel, code int, headers http.Header) *TunnelResponse
NewSessionTerminationResponse constructs a TunnelResponse representing explicit session cleanup.
func NewTunnelResponse ¶
func NewTunnelResponse(channel Channel, response json.RawMessage, code int, headers http.Header) *TunnelResponse
NewTunnelResponse constructs a TunnelResponse, defensively copying the provided headers map so callers can mutate their copy without affecting the payload delivered to tunnel-service.
func (*TunnelResponse) Channel ¶
func (t *TunnelResponse) Channel() Channel
Channel returns the channel name to report back to the control plane.
func (*TunnelResponse) Headers ¶
func (t *TunnelResponse) Headers() http.Header
Headers returns a defensive copy of the response headers map.
func (*TunnelResponse) Payload ¶
func (t *TunnelResponse) Payload() json.RawMessage
Payload returns the raw JSON payload for the response.
func (*TunnelResponse) ResponseCode ¶
func (t *TunnelResponse) ResponseCode() int
ResponseCode returns the HTTP status code observed when forwarding the request to the MCP server.
func (*TunnelResponse) Type ¶
func (t *TunnelResponse) Type() ResponseType
Type returns the response type enum.
func (*TunnelResponse) Validate ¶
func (t *TunnelResponse) Validate() error
Validate returns an error if the response is structurally invalid.
type TunnelServiceRequestID ¶
type TunnelServiceRequestID string
TunnelServiceRequestID identifies HTTP requests issued by tunnel-client to tunnel-service (e.g. POST /response). The service returns the identifier in the X-Request-Id header so clients can reference server-side traces.
func NewTunnelServiceRequestIDFromHeader ¶
func NewTunnelServiceRequestIDFromHeader(h http.Header) (TunnelServiceRequestID, bool)
NewTunnelServiceRequestIDFromHeader extracts the tunnel-service request ID from the provided HTTP headers. The boolean indicates whether the header was present.
func (TunnelServiceRequestID) String ¶
func (r TunnelServiceRequestID) String() string
String returns the string value of the tunnel service request identifier.