Documentation
¶
Overview ¶
Package endpoints provides configuration types and utilities for routing in the firelynx server.
This package defines the domain model for endpoint configurations, which map requests from listeners to applications through routes. It handles validation, protocol buffer conversion, and provides helper methods for accessing routes.
The main types include: - Endpoint: Maps from listener IDs to routes, enabling request routing to apps - EndpointCollection: A slice of Endpoint objects with validation and conversion methods - Routes are defined in the routes sub-package
Thread Safety: The endpoint configuration objects are not thread-safe and should be protected when accessed concurrently. These objects are typically loaded during startup or configuration reload operations, which should be synchronized.
Index ¶
- Variables
- type Endpoint
- type EndpointCollection
- func (ec EndpointCollection) All() iter.Seq[Endpoint]
- func (ec EndpointCollection) FindByID(id string) (Endpoint, bool)
- func (ec EndpointCollection) FindByListenerID(listenerID string) iter.Seq[Endpoint]
- func (ec EndpointCollection) GetIDsForListener(listenerID string) iter.Seq[string]
- func (ec EndpointCollection) GetListenerIDMapping() map[string]string
- func (endpoints EndpointCollection) String() string
- func (endpoints EndpointCollection) ToProto() []*pb.Endpoint
Constants ¶
This section is empty.
Variables ¶
var ( // Validation specific errors ErrEmptyID = errz.ErrEmptyID ErrMissingRequiredField = errz.ErrMissingRequiredField ErrRouteConflict = errz.ErrRouteConflict ErrInvalidRouteType = errz.ErrInvalidRouteType )
Re-export errors for this package
Functions ¶
This section is empty.
Types ¶
type Endpoint ¶
type Endpoint struct {
ID string
ListenerID string // Single listener ID instead of an array
Routes routes.RouteCollection
Middlewares middleware.MiddlewareCollection
}
Endpoint represents a routing configuration for incoming requests
func (*Endpoint) GetStructuredHTTPRoutes ¶
GetStructuredHTTPRoutes returns all HTTP routes for this endpoint in a structured format. It extracts routes with HTTP conditions and returns them as the more type-safe HTTPRoute structure with path, app ID, static data, and merged middleware explicitly defined.
func (*Endpoint) ToTree ¶
func (e *Endpoint) ToTree() *fancy.ComponentTree
ToTree returns a tree visualization of this Endpoint
type EndpointCollection ¶
type EndpointCollection []Endpoint
EndpointCollection is a collection of Endpoint objects
func FromProto ¶
func FromProto(pbEndpoints []*pb.Endpoint) (EndpointCollection, error)
FromProto converts protobuf Endpoint messages to a domain Endpoints collection. If no endpoints are provided, it returns nil. Returns an error if any endpoint validation fails (like missing ID or empty listener ID).
func NewEndpointCollection ¶
func NewEndpointCollection(endpoints ...Endpoint) EndpointCollection
NewEndpointCollection creates a new EndpointCollection with the given endpoints.
func (EndpointCollection) All ¶
func (ec EndpointCollection) All() iter.Seq[Endpoint]
All returns an iterator over all endpoints in the collection.
func (EndpointCollection) FindByID ¶
func (ec EndpointCollection) FindByID(id string) (Endpoint, bool)
FindByID finds an endpoint by ID, returning (Endpoint, bool)
func (EndpointCollection) FindByListenerID ¶
func (ec EndpointCollection) FindByListenerID(listenerID string) iter.Seq[Endpoint]
FindByListenerID returns an iterator over endpoints attached to a specific listener ID.
func (EndpointCollection) GetIDsForListener ¶
func (ec EndpointCollection) GetIDsForListener(listenerID string) iter.Seq[string]
GetIDsForListener returns an iterator over endpoint IDs attached to a listener ID
func (EndpointCollection) GetListenerIDMapping ¶
func (ec EndpointCollection) GetListenerIDMapping() map[string]string
GetListenerIDMapping creates a mapping from endpoint IDs to their listener IDs.
func (EndpointCollection) String ¶
func (endpoints EndpointCollection) String() string
String returns a string representation of the Endpoints collection
func (EndpointCollection) ToProto ¶
func (endpoints EndpointCollection) ToProto() []*pb.Endpoint
ToProto converts an Endpoints collection to a slice of protobuf Endpoints
Directories
¶
| Path | Synopsis |
|---|---|
|
Package middleware provides types and functionality for middleware configuration in the firelynx server.
|
Package middleware provides types and functionality for middleware configuration in the firelynx server. |
|
Package routes provides configuration types and utilities for request routing in the firelynx server.
|
Package routes provides configuration types and utilities for request routing in the firelynx server. |