Documentation
¶
Overview ¶
Package proxy provides HTTP proxying for plugin routes. It handles routing HTTP requests to plugin gRPC handlers, including capability-based routing, rate limiting, and streaming support.
Index ¶
- type HTTPProxy
- func (p *HTTPProxy) GetCapabilityRegistry() *registry.CapabilityRegistry
- func (p *HTTPProxy) GetRouteRegistry() *registry.RouteRegistry
- func (p *HTTPProxy) HandleCapabilityRoute(capability string) gin.HandlerFunc
- func (p *HTTPProxy) HandlePluginRoute(c *gin.Context)
- func (p *HTTPProxy) InitFromPlugins(ctx context.Context, plugins []*types.Instance) error
- func (p *HTTPProxy) RegisterCapabilityRoutes(router *gin.RouterGroup)
- func (p *HTTPProxy) Stop()
- func (p *HTTPProxy) UnregisterPlugin(pluginID string)
- type PluginLookup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPProxy ¶
type HTTPProxy struct {
// contains filtered or unexported fields
}
HTTPProxy handles proxying HTTP requests to plugin gRPC handlers.
func NewHTTPProxy ¶
func NewHTTPProxy( pluginLookup PluginLookup, routeRegistry *registry.RouteRegistry, capabilityRegistry *registry.CapabilityRegistry, rateLimiter *registry.RouteRateLimiter, logger *slog.Logger, ) *HTTPProxy
NewHTTPProxy creates a new HTTP proxy for plugin routes.
func (*HTTPProxy) GetCapabilityRegistry ¶
func (p *HTTPProxy) GetCapabilityRegistry() *registry.CapabilityRegistry
GetCapabilityRegistry returns the capability registry.
func (*HTTPProxy) GetRouteRegistry ¶
func (p *HTTPProxy) GetRouteRegistry() *registry.RouteRegistry
GetRouteRegistry returns the route registry.
func (*HTTPProxy) HandleCapabilityRoute ¶
func (p *HTTPProxy) HandleCapabilityRoute(capability string) gin.HandlerFunc
HandleCapabilityRoute returns a handler for capability-aliased routes. For example, /api/search is aliased to the "search" capability.
func (*HTTPProxy) HandlePluginRoute ¶
HandlePluginRoute handles requests to /api/plugins/:plugin_id/*path. It routes the request to the appropriate plugin's HandleHTTP or HandleHTTPStream.
func (*HTTPProxy) InitFromPlugins ¶
InitFromPlugins initializes route and capability registries from loaded plugins. Call this after all plugins are loaded.
func (*HTTPProxy) RegisterCapabilityRoutes ¶
func (p *HTTPProxy) RegisterCapabilityRoutes(router *gin.RouterGroup)
RegisterCapabilityRoutes registers all capability alias routes on the router. Call this after loading plugins to set up stable URLs like /api/search. Routes are registered dynamically based on plugins that declare alias_path in their routes. The router should already have authentication middleware applied.
func (*HTTPProxy) UnregisterPlugin ¶
UnregisterPlugin removes routes and capabilities for a plugin.