types

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel string
const (
	DefaultChannel Channel = "main"
	ChannelHarpoon Channel = "harpoon"
)

func NormalizeChannel

func NormalizeChannel(channel string) (Channel, error)

NormalizeChannel validates the provided channel and returns DefaultChannel when empty.

func (Channel) Canonical

func (c Channel) Canonical() Channel

Canonical returns the canonical channel name form used for routing lookups. It lowercases and trims surrounding whitespace.

func (Channel) String

func (c Channel) String() string

String returns the channel name as a string.

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.

func (RequestID) String

func (r RequestID) String() string

String returns the string form of the polled request identifier.

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 TunnelID

type TunnelID string

TunnelID identifies a specific tunnel client instance.

func (TunnelID) String

func (t TunnelID) String() string

String returns the string form of the tunnel identifier.

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.

Jump to

Keyboard shortcuts

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