agent

package
v0.0.0-...-ae71bc6 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TcpProtoNum = 6
	UdpProtoNum = 17
)
View Source
const IpsAssuredBit = 2

Variables

View Source
var TCPStateStrings = [...]string{"TCP_ESTABLISHED", "TCP_SYN_SENT", "TCP_SYN_RECV", "TCP_FIN_WAIT1", "TCP_FIN_WAIT2", "TCP_TIME_WAIT", "TCP_CLOSE", "TCP_CLOSE_WAIT", "TCP_LAST_ACK", "TCP_LISTEN", "TCP_CLOSING"}

Functions

func GetCache

func GetCache(w http.ResponseWriter, _ *http.Request)

GetCache returns entire cache

func GetConnections

func GetConnections(w http.ResponseWriter, _ *http.Request)

GetConnections return conntrack counts in prometheus format

func GetHost

func GetHost(ip string) hosts.Host

Get returns Host for a given IP

func SetCache

func SetCache(_ http.ResponseWriter, r *http.Request)

SetCache sets the entire cache

func SetRoutes

func SetRoutes(httpService *chi.Mux)

SetRoutes is used to set the routes

func UpdateConntrackEntries

func UpdateConntrackEntries(nodeName string) error

UpdateConntrackEntries build the conntrack counts cache from conntrack table

Types

type ConntrackCount

type ConntrackCount struct {
	Node            string     `json:"node"`
	Count           int        `json:"count"`
	OriginSrc       hosts.Host `json:"originSrc"`
	SourceIP        string     `json:"sourceIP"`
	OriginDst       hosts.Host `json:"originDst"`
	DestinationIP   string     `json:"destinationIP"`
	DestinationPort uint16     `json:"destinationPort"`
	ReplySrc        hosts.Host `json:"replySrc"`
	ReplyDst        hosts.Host `json:"replyDst"`

	State      string `json:"state"`
	ReplyState string `json:"repState"`
	Transport  string `json:"transport"`
}

ConntrackCount count of conntrack entries with same tags

type ConntrackUpdater

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

ConntrackUpdater controller for updating conntrack counts (cache)

func NewConntrackUpdater

func NewConntrackUpdater(nodeName string, periodSeconds int, wg *sync.WaitGroup) ConntrackUpdater

NewConntrackUpdater new ConntrackUpdater

func (*ConntrackUpdater) StartConntrackUpdater

func (c *ConntrackUpdater) StartConntrackUpdater()

StartConntrackUpdater start ConntrackUpdater

func (*ConntrackUpdater) StopConntrackUpdater

func (c *ConntrackUpdater) StopConntrackUpdater()

StopConntrackUpdater stop ConntrackUpdater

type HostCache

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

func NewHostCache

func NewHostCache() *HostCache

type HostCacheUpdater

type HostCacheUpdater struct {
	NodeName     string
	RegistryURL  string
	UpdatePeriod int
	// contains filtered or unexported fields
}

HostCacheUpdater builds and serves host cache

func NewHostCacheUpdater

func NewHostCacheUpdater(nodeName string, registryURL string, updatePeriod int, wg *sync.WaitGroup) HostCacheUpdater

NewHostCacheUpdater create new HostCacheUpdater

func (*HostCacheUpdater) StartHostCacheUpdater

func (c *HostCacheUpdater) StartHostCacheUpdater()

StartHostCacheUpdater HostCacheUpdater

func (*HostCacheUpdater) StopHostCacheUpdater

func (c *HostCacheUpdater) StopHostCacheUpdater()

StopHostCacheUpdater stopCh

type Server

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

Server http server wrapper

func NewServer

func NewServer(addr string, wg *sync.WaitGroup) *Server

NewServer new server

func (*Server) StartServer

func (s *Server) StartServer()

StartServer start server

func (*Server) StopServer

func (s *Server) StopServer()

StopServer stop server

Jump to

Keyboard shortcuts

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