server

package
v0.0.0-...-6149065 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2024 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Overview

Package server exports kubearmor logs

Package server exports kubearmor logs

Package server exports kubearmor logs

Index

Constants

This section is empty.

Variables

View Source
var AlertBufferChannel chan *pb.Alert

AlertBufferChannel store incoming data from msg stream in buffer

View Source
var AlertLock *sync.RWMutex

AlertLock Lock

View Source
var AlertStructs map[string]AlertStruct

AlertStructs Map

View Source
var ClientList map[string]int

ClientList Map

View Source
var ClientListLock *sync.RWMutex

ClientListLock Lock

View Source
var LogBufferChannel chan *pb.Log

LogBufferChannel store incoming data from log stream in buffer

View Source
var LogLock *sync.RWMutex

LogLock Lock

View Source
var LogStructs map[string]LogStruct

LogStructs Map

View Source
var MsgBufferChannel chan *pb.Message

MsgBufferChannel store incoming data from Alert stream in buffer

View Source
var MsgLock *sync.RWMutex

MsgLock Lock

View Source
var MsgStructs map[string]MsgStruct

MsgStructs Map

View Source
var Running bool

Running flag

Functions

func DeleteClientEntry

func DeleteClientEntry(nodeIP string)

DeleteClientEntry removes nodeIP from ClientList

Types

type AlertStruct

type AlertStruct struct {
	Filter    string
	Broadcast chan *pb.Alert
}

AlertStruct Structure

type K8sHandler

type K8sHandler struct {
	K8sClient   *kubernetes.Clientset
	HTTPClient  *http.Client
	WatchClient *http.Client

	K8sToken string
	K8sHost  string
	K8sPort  string
}

K8sHandler Structure

var K8s *K8sHandler

K8s Handler

func NewK8sHandler

func NewK8sHandler() *K8sHandler

NewK8sHandler Function

func (*K8sHandler) DoRequest

func (kh *K8sHandler) DoRequest(cmd string, data interface{}, path string) ([]byte, error)

DoRequest Function

func (*K8sHandler) InitInclusterAPIClient

func (kh *K8sHandler) InitInclusterAPIClient() bool

InitInclusterAPIClient Function

func (*K8sHandler) InitK8sClient

func (kh *K8sHandler) InitK8sClient() bool

InitK8sClient Function

func (*K8sHandler) InitLocalAPIClient

func (kh *K8sHandler) InitLocalAPIClient() bool

InitLocalAPIClient Function

func (*K8sHandler) WatchKubeArmorPods

func (kh *K8sHandler) WatchKubeArmorPods(ctx context.Context, wg *sync.WaitGroup, ipsChan chan string)

type LogClient

type LogClient struct {
	// flag
	Running bool

	// Server
	Server string

	// messages
	MsgStream pb.LogService_WatchMessagesClient

	// alerts
	AlertStream pb.LogService_WatchAlertsClient

	// logs
	LogStream pb.LogService_WatchLogsClient

	// wait group
	WgServer *errgroup.Group

	Context context.Context
	// contains filtered or unexported fields
}

LogClient Structure

func NewClient

func NewClient(server string) *LogClient

NewClient Function

func (*LogClient) DestroyClient

func (lc *LogClient) DestroyClient() error

DestroyClient Function

func (*LogClient) DoHealthCheck

func (lc *LogClient) DoHealthCheck() bool

DoHealthCheck Function

func (*LogClient) WatchAlerts

func (lc *LogClient) WatchAlerts(wg *sync.WaitGroup, stop chan struct{}, errCh chan error)

WatchAlerts Function

func (*LogClient) WatchLogs

func (lc *LogClient) WatchLogs(wg *sync.WaitGroup, stop chan struct{}, errCh chan error)

WatchLogs Function

func (*LogClient) WatchMessages

func (lc *LogClient) WatchMessages(wg *sync.WaitGroup, stop chan struct{}, errCh chan error)

WatchMessages Function

type LogService

type LogService struct {
}

LogService Structure

func (*LogService) HealthCheck

func (ls *LogService) HealthCheck(ctx context.Context, nonce *pb.NonceMessage) (*pb.ReplyMessage, error)

HealthCheck Function

func (*LogService) WatchAlerts

func (ls *LogService) WatchAlerts(req *pb.RequestMessage, svr pb.LogService_WatchAlertsServer) error

WatchAlerts Function

func (*LogService) WatchLogs

WatchLogs Function

func (*LogService) WatchMessages

func (ls *LogService) WatchMessages(req *pb.RequestMessage, svr pb.LogService_WatchMessagesServer) error

WatchMessages Function

type LogStruct

type LogStruct struct {
	Filter    string
	Broadcast chan *pb.Log
}

LogStruct Structure

type MsgStruct

type MsgStruct struct {
	Filter    string
	Broadcast chan *pb.Message
}

MsgStruct Structure

type RelayServer

type RelayServer struct {
	// port
	Port string

	// gRPC listener
	Listener net.Listener

	// log server
	LogServer *grpc.Server

	// wait group
	WgServer sync.WaitGroup

	// ELK adapter
	ELKClient *elasticsearch.ElasticsearchClient
}

RelayServer Structure

func NewRelayServer

func NewRelayServer(port string) *RelayServer

NewRelayServer Function

func (*RelayServer) AddAlertFromBuffChan

func (rs *RelayServer) AddAlertFromBuffChan()

AddAlertFromBuffChan Adds Alert from AlertBufferChannel into AlertStructs

func (*RelayServer) AddLogFromBuffChan

func (rs *RelayServer) AddLogFromBuffChan()

AddLogFromBuffChan Adds Log from LogBufferChannel into LogStructs

func (*RelayServer) AddMsgFromBuffChan

func (rs *RelayServer) AddMsgFromBuffChan()

AddMsgFromBuffChan Adds Msg from MsgBufferChannel into MsgStructs

func (*RelayServer) DestroyRelayServer

func (rs *RelayServer) DestroyRelayServer() error

DestroyRelayServer Function

func (*RelayServer) GetFeedsFromNodes

func (rs *RelayServer) GetFeedsFromNodes()

GetFeedsFromNodes Function

func (*RelayServer) ServeLogFeeds

func (rs *RelayServer) ServeLogFeeds()

ServeLogFeeds Function

Jump to

Keyboard shortcuts

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