eaa

package
v0.0.0-...-316aa0a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2021 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAndSetCACertPool

func CreateAndSetCACertPool(caFile string) (*x509.CertPool, error)

CreateAndSetCACertPool creates and set CA cert pool

func DeregisterApplication

func DeregisterApplication(w http.ResponseWriter, r *http.Request)

DeregisterApplication implements https API

func GetNotifications

func GetNotifications(w http.ResponseWriter, r *http.Request)

GetNotifications implements https API

func GetServices

func GetServices(w http.ResponseWriter, r *http.Request)

GetServices implements https API

func GetSubscriptions

func GetSubscriptions(w http.ResponseWriter, r *http.Request)

GetSubscriptions implements https API

func NewAuthRouter

func NewAuthRouter(eaaCtx *eaaContext) *mux.Router

NewAuthRouter initializes EAA Auth router

func NewEaaRouter

func NewEaaRouter(eaaCtx *eaaContext) *mux.Router

NewEaaRouter initializes EAA router

func PushNotificationToSubscribers

func PushNotificationToSubscribers(w http.ResponseWriter, r *http.Request)

PushNotificationToSubscribers implements https API

func RegisterApplication

func RegisterApplication(w http.ResponseWriter, r *http.Request)

RegisterApplication implements https API

func RequestCredentials

func RequestCredentials(w http.ResponseWriter, r *http.Request)

RequestCredentials handles PKI for an application

func Run

func Run(parentCtx context.Context, cfgPath string) error

Run start EAA

func RunServer

func RunServer(parentCtx context.Context, eaaCtx *eaaContext) error

RunServer starts Edge Application Agent server listening on port read from config file

func SignCSR

func SignCSR(csrPEM string, eaaCtx *eaaContext) (*x509.Certificate, error)

SignCSR signs a "PEM-encoded" signing request.

func SubscribeNamespaceNotifications

func SubscribeNamespaceNotifications(w http.ResponseWriter, r *http.Request)

SubscribeNamespaceNotifications implements https API

func SubscribeServiceNotifications

func SubscribeServiceNotifications(w http.ResponseWriter, r *http.Request)

SubscribeServiceNotifications implements https API

func UnsubscribeAllNotifications

func UnsubscribeAllNotifications(w http.ResponseWriter, r *http.Request)

UnsubscribeAllNotifications implements https API

func UnsubscribeNamespaceNotifications

func UnsubscribeNamespaceNotifications(w http.ResponseWriter, r *http.Request)

UnsubscribeNamespaceNotifications implements https API

func UnsubscribeServiceNotifications

func UnsubscribeServiceNotifications(w http.ResponseWriter, r *http.Request)

UnsubscribeServiceNotifications implements https API

Types

type AuthCredentials

type AuthCredentials struct {
	ID          string   `json:"id,omitempty"`
	Certificate string   `json:"certificate,omitempty"`
	CaChain     []string `json:"ca_chain,omitempty"`
	CaPool      []string `json:"ca_pool,omitempty"`
}

AuthCredentials defines a response for a request to obtain authentication credentials. These credentials may be used to further communicate with endpoint(s) that are protected by a form of authentication.

Any strings that are annotated as "PEM-encoded" implies that encoding format is used, with any newlines indicated with `\n` characters. Most languages provide encoders that correctly marshal this out. For more information, see the RFC here: https://tools.ietf.org/html/rfc7468

type AuthIdentity

type AuthIdentity struct {
	Csr string `json:"csr,omitempty"`
}

AuthIdentity defines a request to obtain authentication credentials. These credentials would be used to further communicate with endpoint(s) that are protected by a form of authentication.

Any strings that are annotated as "PEM-encoded" implies that encoding format is used, with any newlines indicated with `\n` characters. Most languages provide encoders that correctly marshal this out. For more information, see the RFC here: https://tools.ietf.org/html/rfc7468

type CertKeyPair

type CertKeyPair struct {
	// contains filtered or unexported fields
}

CertKeyPair manages digital certificates.

func InitEaaCert

func InitEaaCert(certInfo CertsInfo) (*CertKeyPair, error)

InitEaaCert generates cartificate for server signed by CA

func InitRootCA

func InitRootCA(certInfo CertsInfo) (*CertKeyPair, error)

InitRootCA creates a RootCA by loading the CA certificate and key from the certificates paths. If they do not exist or the certificate was not signed with the key, a new certificate and key will generated.

type Certs

type Certs struct {
	// contains filtered or unexported fields
}

Certs stores certs and keys for root ca and eaa

type CertsInfo

type CertsInfo struct {
	CaRootKeyPath  string `json:"CaRootKeyPath"`
	CaRootPath     string `json:"CaRootPath"`
	ServerCertPath string `json:"ServerCertPath"`
	ServerKeyPath  string `json:"ServerKeyPath"`
	CommonName     string `json:"CommonName"`
}

CertsInfo describes paths for certs used in configuration

type Config

type Config struct {
	TLSEndpoint        string        `json:"TlsEndpoint"`
	OpenEndpoint       string        `json:"OpenEndpoint"`
	ValidationEndpoint string        `json:"ValidationEndpoint"`
	HeartbeatInterval  util.Duration `json:"HeartbeatInterval"`
	Certs              CertsInfo     `json:"Certs"`
}

Config describes EAA JSON config file

type ConsumerConnection

type ConsumerConnection struct {
	// contains filtered or unexported fields
}

ConsumerConnection stores websocket connection of a consumer

type ConsumerSubscription

type ConsumerSubscription struct {
	// contains filtered or unexported fields
}

ConsumerSubscription stores namespace notification subscribers and a map of services and their subscribers

type NotificationDescriptor

type NotificationDescriptor struct {
	// Name of notification
	Name string `json:"name,omitempty"`
	// Version of notification
	Version string `json:"version,omitempty"`
	// Human readable description of notification
	Description string `json:"description,omitempty"`
}

NotificationDescriptor describes a type used in EAA API

type NotificationFromProducer

type NotificationFromProducer struct {
	// Name of notification
	Name string `json:"name,omitempty"`
	// Version of notification
	Version string `json:"version,omitempty"`
	// The payload can be any JSON object with a name
	// and version-specific schema.
	Payload json.RawMessage `json:"payload,omitempty"`
}

NotificationFromProducer describes a type used in EAA API

type NotificationSubscriptions

type NotificationSubscriptions map[UniqueNotif]*ConsumerSubscription

NotificationSubscriptions is a map of a namespace notification struct to the consumer subscription struct

type NotificationToConsumer

type NotificationToConsumer struct {
	// Name of notification
	Name string `json:"name,omitempty"`
	// Version of notification
	Version string `json:"version,omitempty"`
	// The payload can be any JSON object with a name
	// and version-specific schema.
	Payload json.RawMessage `json:"payload,omitempty"`
	// URN of the producer
	URN URN `json:"producer,omitempty"`
}

NotificationToConsumer describes a type used in EAA API

type Route

type Route struct {
	Name        string
	Method      string
	Pattern     string
	HandlerFunc http.HandlerFunc
}

Route describes traffic routing

type Routes

type Routes []Route

Routes represents a routing table

type Service

type Service struct {
	URN           *URN                     `json:"urn,omitempty"`
	Description   string                   `json:"description,omitempty"`
	EndpointURI   string                   `json:"endpoint_uri,omitempty"`
	Status        string                   `json:"status,omitempty"`
	Notifications []NotificationDescriptor `json:"notifications,omitempty"`
	Info          json.RawMessage          `json:"info,omitempty"`
}

Service JSON struct

type ServiceList

type ServiceList struct {
	Services []Service `json:"services,omitempty"`
}

ServiceList JSON struct

type SubscriberIds

type SubscriberIds []string

SubscriberIds stores subscriber ids as a slice of strings

func (*SubscriberIds) RemoveSubscriber

func (sI *SubscriberIds) RemoveSubscriber(commonName string) bool

RemoveSubscriber delete consumer ID from subscribers list

type Subscription

type Subscription struct {

	// The name of the producer app. The unique ID is optional for
	// subscribing and if not given will subscribe to any producer in the
	// namespace.
	URN *URN `json:"urn,omitempty"`

	// The list of all notification types registered by all producers in
	// this namespace.
	Notifications []NotificationDescriptor `json:"notifications,omitempty"`
}

Subscription describes a type used in EAA API

type SubscriptionList

type SubscriptionList struct {
	Subscriptions []Subscription `json:"subscriptions,omitempty"`
}

SubscriptionList JSON struct

type URN

type URN struct {

	// The per-namespace unique portion of the URN that when appended to
	// the namespace with a separator forms the complete URN.
	ID string `json:"id,omitempty"`

	// The non-unique portion of the URN that identifies the class excluding
	// a trailing separator.
	Namespace string `json:"namespace,omitempty"`
}

URN describes a type used in EAA API

func CommonNameStringToURN

func CommonNameStringToURN(commonName string) (URN, error)

CommonNameStringToURN parses a common name string to a URN struct

type UniqueNotif

type UniqueNotif struct {
	// contains filtered or unexported fields
}

UniqueNotif stores information about unique notification. It is used as a key in NotificationSubscriptions map

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL