Documentation ¶
Overview ¶
Package http contains structures and repositories to create, store, and manage HTTP based Agent listeners
Index ¶
- func DefaultOptions() map[string]string
- func GetJWT(agentID uuid.UUID, lifetime time.Duration, key []byte) (string, error)
- type Listener
- func (l *Listener) Addr() string
- func (l *Listener) Authenticate(id uuid.UUID, data interface{}) (messages.Base, error)
- func (l *Listener) Authenticator() authenticators.Authenticator
- func (l *Listener) ConfiguredOptions() map[string]string
- func (l *Listener) Construct(msg messages.Base, key []byte) (data []byte, err error)
- func (l *Listener) Deconstruct(data, key []byte) (messages.Base, error)
- func (l *Listener) Description() string
- func (l *Listener) ID() uuid.UUID
- func (l *Listener) Name() string
- func (l *Listener) Options() map[string]string
- func (l *Listener) PSK() string
- func (l *Listener) Protocol() int
- func (l *Listener) Server() *servers.ServerInterface
- func (l *Listener) SetOption(option string, value string) error
- func (l *Listener) Status() string
- func (l *Listener) String() string
- func (l *Listener) Transformers() []transformer.Transformer
- type Repository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultOptions ¶
DefaultOptions returns a map of configurable listener options that will subsequently be passed to the NewHTTPListener function
Types ¶
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener is an aggregate structure that implements the Listener interface used to listen for and handle Agent message traffic
func NewHTTPListener ¶
func NewHTTPListener(server servers.ServerInterface, options map[string]string) (listener Listener, err error)
NewHTTPListener is a factory that creates and returns a Listener aggregate that implements the Listener interface The HTTP listener requires an instantiated server object to send/receive messages with Agents
func (*Listener) Authenticate ¶
Authenticate takes data coming into the listener from an agent and passes it to the listener's configured authenticator to authenticate the agent. Once an agent is authenticated, this function will no longer be used.
func (*Listener) Authenticator ¶
func (l *Listener) Authenticator() authenticators.Authenticator
Authenticator returns the authenticator the listener is configured to use
func (*Listener) ConfiguredOptions ¶
ConfiguredOptions returns the server's current configuration for options that can be set by the user
func (*Listener) Construct ¶
Construct takes in a messages.Base structure that is ready to be sent to an agent and runs all the data transforms on it to encode and encrypt it. If an empty key is passed in, then the listener's interface encryption key will be used.
func (*Listener) Deconstruct ¶
Deconstruct takes in data that an agent sent to the listener and runs all the listener's transforms on it until a messages.Base structure is returned. The key is used for decryption transforms. If an empty key is passed in, then the listener's interface encryption key will be used.
func (*Listener) Description ¶
Description returns the listener's description
func (*Listener) Options ¶
Options returns the original map of options passed into the NewHTTPListener function
func (*Listener) PSK ¶
PSK returns the listener's pre-shared key used for encrypting & decrypting agent messages
func (*Listener) Protocol ¶
Protocol returns a constant from the listeners package that represents the protocol type of this listener
func (*Listener) Server ¶
func (l *Listener) Server() *servers.ServerInterface
Server returns the listener's embedded server structure
func (*Listener) Status ¶
Status returns the status of the embedded server's state (e.g., running or stopped)
func (*Listener) Transformers ¶
func (l *Listener) Transformers() []transformer.Transformer
Transformers returns a list of transforms the lister is configured to use
type Repository ¶
type Repository interface { Add(listener Listener) error Exists(name string) bool List() func(string) []string Listeners() []Listener ListenerByID(id uuid.UUID) (Listener, error) ListenerByName(name string) (Listener, error) RemoveByID(id uuid.UUID) error SetOption(id uuid.UUID, option, value string) error }
Repository is an interface to store and manage HTTP listeners