Documentation
¶
Index ¶
- type DependentServiceData
- type PortContext
- type Registry
- func (r *Registry) Register(puID string, pu *policy.PUInfo, puContext *pucontext.PUContext, ...) (*ServiceContext, error)
- func (r *Registry) RetrieveExposedServiceContext(ip net.IP, port int, host string) (*PortContext, error)
- func (r *Registry) RetrieveServiceByID(id string) (*ServiceContext, error)
- func (r *Registry) RetrieveServiceDataByIDAndNetwork(id string, ip net.IP, port int, host string) (*ServiceContext, *DependentServiceData, error)
- func (r *Registry) Unregister(puID string) error
- type ServiceContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DependentServiceData ¶
type DependentServiceData struct { // Used for authorization APICache *urisearch.APICache // Used by the protomux to find the right service type. ServiceType common.ListenerType // ServiceObject is the original service object. ServiceObject *policy.ApplicationService }
DependentServiceData are the data that are held for each service in the dependentServiceCache.
type PortContext ¶
type PortContext struct { ID string Type common.ListenerType Service *policy.ApplicationService Authorizer *auth.Processor PUContext *pucontext.PUContext TargetPort int ClientTrustedRoots *x509.CertPool }
PortContext includes all the needed associations to refer to a service by port. For incoming connections the only available information is the IP/port pair of the original request and we use this to map the connection and request to a port. For network services we have additional state data such as the authorizers. Note that there is one PortContext for every service of every PU.
type Registry ¶
Registry is a service registry. It maintains all the state information and provides a simple API to retrieve the data. The registry always locks and allows multi-threading.
func NewServiceRegistry ¶
func NewServiceRegistry() *Registry
NewServiceRegistry creates and initializes the registry.
func (*Registry) Register ¶
func (r *Registry) Register( puID string, pu *policy.PUInfo, puContext *pucontext.PUContext, secrets secrets.Secrets, ) (*ServiceContext, error)
Register registers a new service with the registry. If the service already exists it updates the service with the new information, otherwise it creates a new service.
func (*Registry) RetrieveExposedServiceContext ¶
func (r *Registry) RetrieveExposedServiceContext(ip net.IP, port int, host string) (*PortContext, error)
RetrieveExposedServiceContext retrieves a service by the provided IP and or port. This is called by the network side of processing to find the context.
func (*Registry) RetrieveServiceByID ¶
func (r *Registry) RetrieveServiceByID(id string) (*ServiceContext, error)
RetrieveServiceByID retrieves a service by the PU ID. Returns error if not found.
func (*Registry) RetrieveServiceDataByIDAndNetwork ¶
func (r *Registry) RetrieveServiceDataByIDAndNetwork(id string, ip net.IP, port int, host string) (*ServiceContext, *DependentServiceData, error)
RetrieveServiceDataByIDAndNetwork will return the service data that match the given PU and the given IP/port information.
type ServiceContext ¶
type ServiceContext struct { PU *policy.PUInfo PUContext *pucontext.PUContext RootCA [][]byte // contains filtered or unexported fields }
ServiceContext includes all the all the service related information for dependent services. It is indexed by the PU ID and a PU can easily retrieve all the state with a simple lookup. Note, that there is one ServiceContext for every PU.