func (nsp *NetworkSecurityProbe) startProcessors() error {
	nsp.Processors = processor.RegisterProcessors(nsp.Config)
	for _, p := range processor.ProcessorsList {
		if err := p.Start(nsp); err != nil {
			nspLogger.Errorf("failed to start processor \"%s\": %v", p.GetName(), err)
			return err
		}
	}
	nspLogger.Debugf("%v processor(s) started", len(nsp.Processors))
	return nil
}
startProcessors - Starts event processors
package nsp
import (
	"bytes"
	"math/rand"
	"sync"
	"time"
	"unsafe"
	"github.com/DataDog/gopsutil/host"
	"github.com/Gui774ume/ebpf"
	"github.com/pkg/errors"
	"github.com/sirupsen/logrus"
	"k8s.io/client-go/rest"
	"k8s.io/client-go/tools/clientcmd"
	"github.com/Gui774ume/network-security-probe/pkg/config"
	"github.com/Gui774ume/network-security-probe/pkg/k8s/informer"
	"github.com/Gui774ume/network-security-probe/pkg/model"
	"github.com/Gui774ume/network-security-probe/pkg/model/kernel"
	"github.com/Gui774ume/network-security-probe/pkg/monitor"
	"github.com/Gui774ume/network-security-probe/pkg/monitor/tcsched"
	"github.com/Gui774ume/network-security-probe/pkg/probe"
	"github.com/Gui774ume/network-security-probe/pkg/processor"
	"github.com/Gui774ume/network-security-probe/pkg/utils"
)
var (
	nspLogger = logrus.WithField("package", "nsp")
)
type NetworkSecurityProbe struct {
	KubeConfig   *rest.Config
	KubeInformer *informer.SecurityProfileInformer
	Config       *config.NSPConfig
	Collection   *ebpf.Collection
	Processors   map[model.EventType][]model.Processor
	Monitors     []model.Monitor
	TCMonitors   map[int32]model.Monitor
	wg           *sync.WaitGroup
	bootTime     time.Time
	hostNetns    uint64
	Cache        *Cache
}
func (nsp *NetworkSecurityProbe) GetWaitGroup() *sync.WaitGroup {
	return nsp.wg
}
func (nsp *NetworkSecurityProbe) GetConfig() *config.NSPConfig {
	return nsp.Config
}
func (nsp *NetworkSecurityProbe) GetKubeConfig() *rest.Config {
	return nsp.KubeConfig
}
func (nsp *NetworkSecurityProbe) GetCollection() *ebpf.Collection {
	return nsp.Collection
}
func (nsp *NetworkSecurityProbe) GetBootTime() time.Time {
	return nsp.bootTime
}
func (nsp *NetworkSecurityProbe) GetHostNetns() uint64 {
	return nsp.hostNetns
}
func NewWithConfig(config *config.NSPConfig) (*NetworkSecurityProbe, error) {
	var err error
	nsp := NetworkSecurityProbe{
		Config:       config,
		wg:           &sync.WaitGroup{},
		KubeInformer: &informer.SecurityProfileInformer{},
	}
	if config.CLI.KubeConfigPath != "" {
		nsp.KubeConfig, err = clientcmd.BuildConfigFromFlags("", config.CLI.KubeConfigPath)
		if err != nil {
			return nil, err
		}
	} else {
		nsp.KubeConfig, err = rest.InClusterConfig()
		if err != nil {
			return nil, err
		}
	}
	return &nsp, nil
}
func (nsp *NetworkSecurityProbe) Start() error {
	nspLogger.Debugln("network security probe starting ...")
	rand.Seed(time.Now().UnixNano())
	if err := nsp.init(); err != nil {
		return err
	}
	if err := nsp.loadEBPFProgram(); err != nil {
		return err
	}
	if err := nsp.startProcessors(); err != nil {
		return err
	}
	if err := nsp.startMonitors(); err != nil {
		return err
	}
	if err := nsp.KubeInformer.Start(); err != nil {
		return err
	}
	return nil
}
func (nsp *NetworkSecurityProbe) init() error {
	bt, err := host.BootTime()
	if err != nil {
		return err
	}
	nsp.bootTime = time.Unix(int64(bt), 0)
	nsp.hostNetns = utils.GetNetnsFromPid(1)
	if err := nsp.KubeInformer.Init(nsp); err != nil {
		return err
	}
	nsp.Cache = NewCache(nsp.Config, utils.GetNetnsFromPid(1))
	return nil
}
func (nsp *NetworkSecurityProbe) loadEBPFProgram() error {
	buf, err := probe.Asset("probe.o")
	if err != nil {
		return errors.Wrap(err, "couldn't find asset")
	}
	reader := bytes.NewReader(buf)
	collectionSpec, err := ebpf.LoadCollectionSpecFromReader(reader)
	if err != nil {
		return errors.Wrap(err, "couldn't load collection spec")
	}
	nsp.Collection, err = ebpf.NewCollection(collectionSpec)
	if err != nil {
		return errors.Wrap(err, "couldn't load eBPF program")
	}
	nspLogger.Debug("eBPF program loaded")
	requestParser, ok := nsp.Collection.Programs["classifier/dns_request_parser"]
	if !ok {
		return errors.Wrap(err, "dns request parser missing")
	}
	requestFD := requestParser.FD()
	requestKey := kernel.DNSRequestParserKey
	responseParser, ok := nsp.Collection.Programs["classifier/dns_response_parser"]
	if !ok {
		return errors.Wrap(err, "dns response parser missing")
	}
	responseFD := responseParser.FD()
	responseKey := kernel.DNSResponseParserKey
	cidrEntry, ok := nsp.Collection.Programs["classifier/cidr_entry"]
	if !ok {
		return errors.Wrap(err, "cidr entry tailcall missing")
	}
	cidrEntryFD := cidrEntry.FD()
	cidrKey := kernel.CIDREntryProgKey
	dnsProgArray, ok := nsp.Collection.Maps["dns_prog_array"]
	if !ok {
		return errors.Wrap(err, "dns prog array not found")
	}
	if err := dnsProgArray.Put(unsafe.Pointer(&requestKey), unsafe.Pointer(&requestFD)); err != nil {
		return errors.Wrap(err, "couldn't insert dns request parser program")
	}
	if err := dnsProgArray.Put(unsafe.Pointer(&responseKey), unsafe.Pointer(&responseFD)); err != nil {
		return errors.Wrap(err, "couldn't insert dns response parser program")
	}
	if err := dnsProgArray.Put(unsafe.Pointer(&cidrKey), unsafe.Pointer(&cidrEntryFD)); err != nil {
		return errors.Wrap(err, "couldn't insert CIDR entry program")
	}
	return nil
}