Documentation
¶
Index ¶
- Constants
- type HTTPRequest
- type HTTPResponse
- type Manager
- func (m *Manager) Handler() http.Handler
- func (m *Manager) NonStream(ctx context.Context, provider string, req *HTTPRequest) (*HTTPResponse, error)
- func (m *Manager) Path() string
- func (m *Manager) Stop(_ context.Context) error
- func (m *Manager) Stream(ctx context.Context, provider string, req *HTTPRequest) (<-chan StreamEvent, error)
- type Options
- type StreamEvent
Constants ¶
View Source
const ( // MessageTypeHTTPResp identifies a non-streaming HTTP response envelope. MessageTypeHTTPResp = "http_response" // MessageTypeStreamStart marks the beginning of a streaming response. MessageTypeStreamStart = "stream_start" // MessageTypeStreamChunk carries a streaming response chunk. MessageTypeStreamChunk = "stream_chunk" // MessageTypeStreamEnd marks the completion of a streaming response. MessageTypeStreamEnd = "stream_end" // MessageTypeError carries an error response. MessageTypeError = "error" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPRequest ¶
HTTPRequest represents a proxied HTTP request delivered to websocket clients.
type HTTPResponse ¶
HTTPResponse captures the response relayed back from websocket clients.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager exposes a websocket endpoint that proxies Gemini requests to connected clients.
func NewManager ¶
NewManager builds a websocket relay manager with the supplied options.
func (*Manager) Handler ¶
Handler exposes an http.Handler that upgrades connections to websocket sessions.
func (*Manager) NonStream ¶
func (m *Manager) NonStream(ctx context.Context, provider string, req *HTTPRequest) (*HTTPResponse, error)
NonStream executes a non-streaming HTTP request using the websocket provider.
func (*Manager) Stream ¶
func (m *Manager) Stream(ctx context.Context, provider string, req *HTTPRequest) (<-chan StreamEvent, error)
Stream executes a streaming HTTP request and returns channel with stream events.
type Options ¶
type Options struct {
Path string
MaxSessions int // hard cap on concurrent sessions; 0 = 256 default
ProviderFactory func(*http.Request) (string, error)
OnConnected func(string)
OnDisconnected func(string, error)
LogDebugf func(string, ...any)
LogInfof func(string, ...any)
LogWarnf func(string, ...any)
}
Options configures a Manager instance.
Click to show internal directories.
Click to hide internal directories.