trireme-lib: go.aporeto.io/trireme-lib/controller/internal/enforcer/applicationproxy/serviceregistry Index | Files

package serviceregistry

import "go.aporeto.io/trireme-lib/controller/internal/enforcer/applicationproxy/serviceregistry"

Index

Package Files

serviceregistry.go

type DependentServiceData Uses

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 Uses

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 Uses

type Registry struct {
    sync.Mutex
    // contains filtered or unexported fields
}

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 Uses

func NewServiceRegistry() *Registry

NewServiceRegistry creates and initializes the registry.

func (*Registry) Register Uses

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 Uses

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 Uses

func (r *Registry) RetrieveServiceByID(id string) (*ServiceContext, error)

RetrieveServiceByID retrieves a service by the PU ID. Returns error if not found.

func (*Registry) RetrieveServiceDataByIDAndNetwork Uses

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.

func (*Registry) Unregister Uses

func (r *Registry) Unregister(puID string) error

Unregister unregisters a pu from the registry.

type ServiceContext Uses

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.

Package serviceregistry imports 12 packages (graph) and is imported by 12 packages. Updated 2019-09-21. Refresh now. Tools for package owners.