Documentation ¶
Index ¶
- func HandleHeartbeatAck(heartbeatAck *nraySchema.HeartbeatAck) (bool, bool)
- func HandleRegisteredNode(registeredNode *nraySchema.RegisteredNode) (string, time.Duration, *viper.Viper)
- func InitGlobalServerConfig(config *viper.Viper) error
- func RunNode(args NodeCmdArgs)
- func SendMessage(sock mangos.Socket, message *nraySchema.NrayServerMessage)
- func Start()
- type GlobalConfig
- type Job
- type JobState
- type Node
- type NodeCmdArgs
- type Pool
- func (p *Pool) AddJobToJobArea(job *Job)
- func (p *Pool) GetJobForNode(nodeID string) *Job
- func (p *Pool) GetNumberOfAllJobs() int
- func (p *Pool) GetNumberOfWaitingJobs() int
- func (p *Pool) IsJobGenerationDone() bool
- func (p *Pool) NodeHasOpenJobs(nodeID string) bool
- func (p *Pool) NodesEmpty() bool
- func (p *Pool) ResumeAllNodes()
- func (p *Pool) ResumeNode(nodeID string)
- func (p *Pool) SetJobGenerationDone()
- func (p *Pool) SetTargetCount(targetCount uint64)
- func (p *Pool) StopAllNodes()
- func (p *Pool) StopNode(nodeID string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleHeartbeatAck ¶
func HandleHeartbeatAck(heartbeatAck *nraySchema.HeartbeatAck) (bool, bool)
HandleHeartbeatAck unpacks the message and returns the values
func HandleRegisteredNode ¶
func HandleRegisteredNode(registeredNode *nraySchema.RegisteredNode) (string, time.Duration, *viper.Viper)
HandleRegisteredNode extracts the assigned scanner ID as well as the clock offset
func InitGlobalServerConfig ¶
InitGlobalServerConfig initializes the GlobalConfig from the values provided by viper
func RunNode ¶
func RunNode(args NodeCmdArgs)
RunNode is called by the main function of the node binary and gets everything up and running
func SendMessage ¶
func SendMessage(sock mangos.Socket, message *nraySchema.NrayServerMessage)
SendMessage takes a socket and a servermessage that is going to be sent on the socket
Types ¶
type GlobalConfig ¶
type GlobalConfig struct { ListenPorts []uint32 ListenHost string TLSConfig *tls.Config Pools []*Pool EventHandlers []events.EventHandler }
GlobalConfig holds configuration settings that are relevant for the operation of the core
var CurrentConfig GlobalConfig
CurrentConfig is the initialized struct containing the configuration
func (GlobalConfig) CloseEventHandlers ¶
func (gc GlobalConfig) CloseEventHandlers()
CloseEventHandlers calls Close() on all registered event handlers
func (GlobalConfig) LogEvents ¶
func (gc GlobalConfig) LogEvents(events []*nraySchema.Event)
LogEvents sends a slice of events to all registered event handlers
type Job ¶
type Job struct {
// contains filtered or unexported fields
}
Job keeps the state regarding work items
type Node ¶
type Node struct { ID string Name string MetaInfo string LastHeartbeat time.Time CurrentWork *targetgeneration.AnyTargets // contains filtered or unexported fields }
Node represents relevant information about a node
type NodeCmdArgs ¶
type NodeCmdArgs struct { Server string Port string Debug bool PreferredPool int32 NodeName string UseTLS bool TLSIgnoreServerCertificate bool TLSCACertPath string TLSClientKeyPath string TLSClientCertPath string TLSServerSAN string }
NodeCmdArgs holds user data that is passed on to scanner node
type Pool ¶
type Pool struct { TargetChan <-chan targetgeneration.AnyTargets CountTargets uint64 CountWorkDone uint64 // contains filtered or unexported fields }
Pool is a container that contains nodes and work those nodes have still to do
func (*Pool) AddJobToJobArea ¶
AddJobToJobArea adds a new job to this pool's job queue
func (*Pool) GetJobForNode ¶
GetJobForNode returns the next job for a given node ID
func (*Pool) GetNumberOfAllJobs ¶
GetNumberOfAllJobs returns the length of the JobArea. If it is 0, we can likely stop all nodes and the server
func (*Pool) GetNumberOfWaitingJobs ¶
GetNumberOfWaitingJobs returns how many jobs are currently open
func (*Pool) IsJobGenerationDone ¶
IsJobGenerationDone queries the flag indicating that all jobs were generated
func (*Pool) NodeHasOpenJobs ¶
NodeHasOpenJobs returns true if the node did not finish all of its jobs, false otherwise
func (*Pool) NodesEmpty ¶
NodesEmpty returns true if there are no nodes left in the pool
func (*Pool) ResumeAllNodes ¶
func (p *Pool) ResumeAllNodes()
ResumeAllNodes resumes all nodes in this pool
func (*Pool) ResumeNode ¶
ResumeNode resumes a single node identified by its ID
func (*Pool) SetJobGenerationDone ¶
func (p *Pool) SetJobGenerationDone()
SetJobGenerationDone sets the flag that job generation is done
func (*Pool) SetTargetCount ¶ added in v1.1.0
SetTargetCount is goroutine safe for setting the target count
func (*Pool) StopAllNodes ¶
func (p *Pool) StopAllNodes()
StopAllNodes pauses all nodes in this pool