api

package module
v0.0.0-...-62bb9e5 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2020 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionAllow = "allow"
	ActionDeny  = "deny"

	RuleSimple = "simple"
	RuleList   = "list"
	RuleRegexp = "regexp"

	RuleOnce    = "once"
	Rule15s     = "15s"
	Rule30s     = "30s"
	Rule5m      = "5m"
	Rule1h      = "1h"
	RuleRestart = "until restart"
	RuleAlways  = "always"

	FilterByPath    = "process.path"
	FilterByCommand = "process.command"
	FilterByUserID  = "user.id"
	FilterByDstIP   = "dest.ip"
	FilterByDstPort = "dest.port"
	FilterByDstHost = "dest.host"
)

rules related constants

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Lock sync.RWMutex
	// contains filtered or unexported fields
}

Client struct groups the API functionality to communicate with the nodes

func NewClient

func NewClient(serverProto, serverPort string) *Client

NewClient setups a new client and starts the server to listen for new nodes.

func (*Client) AddNewNode

func (c *Client) AddNewNode(ctx context.Context, nodeConf *protocol.ClientConfig)

AddNewNode adds a new node to the list of connected nodes.

func (*Client) AddNewRule

func (c *Client) AddNewRule(rule *protocol.Rule)

AddNewRule sends a new rule to the node.

func (*Client) AskRule

func (c *Client) AskRule(con *protocol.Connection) chan *protocol.Rule

AskRule sends the connection details through a channel. A client must consume data on that channel, and send the response via the rulesOutChan channel.

func (*Client) GetLastStats

func (c *Client) GetLastStats() *protocol.Statistics

GetLastStats returns latest stasts from a node.

func (*Client) OpenChannelWithNode

func (c *Client) OpenChannelWithNode(notificationsStream protocol.UI_NotificationsServer)

OpenChannelWithNode updates the node with the streaming channel. This channel is used to send notifications to the nodes (change debug level, stop/start interception, etc).

func (*Client) UpdateStats

func (c *Client) UpdateStats(ctx context.Context, stats *protocol.Statistics)

UpdateStats save latest stats received from a node.

func (*Client) WaitForNodes

func (c *Client) WaitForNodes()

FIXME: remove when nodes implementation is done

func (*Client) WaitForRules

func (c *Client) WaitForRules() chan *protocol.Connection

WaitForRules returns the channel where we listen for new outgoing connections.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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