func traceDNSResponses(data []byte, m *base.Monitor) {
	var eventRaw model.DNSResponseRaw
	if err := binary.Read(bytes.NewBuffer(data), utils.GetHostByteOrder(), &eventRaw); err != nil {
		netLogger.Errorf("failed to decode received data (DeviceEventRaw): %s\n", err)
		return
	}
	event := model.DNSResponseEvent{
		EventBase: model.EventBase{
			EventMonitorName: m.Name,
			EventType:        model.DNSResponseType,
			Timestamp:        m.Nsp.GetBootTime().Add(time.Duration(eventRaw.TimestampRaw) * time.Nanosecond),
		},
		DNSResponseRaw: &eventRaw,
		SourceMACAddr:  utils.Char6ToEth(eventRaw.SourceMACAddrRaw),
		DestMACAddr:    utils.Char6ToEth(eventRaw.DestMACAddrRaw),
		Domain:         utils.DecodeDNS(eventRaw.DNSResponseSpec.DNSKey.NameRaw),
		QueryTimestamp: m.Nsp.GetBootTime().Add(time.Duration(eventRaw.QueryTimestampRaw) * time.Nanosecond),
	}
	event.ResponseTime = event.Timestamp.Sub(event.QueryTimestamp)
	switch event.NProtocol {
	case kernel.EthPIP:
		event.SourceIP = utils.Uint64ToIPv4(eventRaw.SourceIPRaw[0])
		event.DestIP = utils.Uint64ToIPv4(eventRaw.DestIPRaw[0])
	case kernel.EthPIPV6:
		event.SourceIP = utils.Uint64sToIPv6(eventRaw.SourceIPRaw)
		event.DestIP = utils.Uint64sToIPv6(eventRaw.DestIPRaw)
	}
	switch event.DNSResponseSpec.Type {
	case kernel.ARecord:
		event.ResolvedIP = utils.Uint64ToIPv4(eventRaw.DNSResponseSpec.IPRaw[0])
	case kernel.AAAARecord:
		event.ResolvedIP = utils.Uint64sToIPv6(eventRaw.DNSResponseSpec.IPRaw)
	}
	m.Nsp.DispatchEvent(&event)
}
traceDNSResponses - Traces DNS responses
package tcsched
import (
	"bytes"
	"encoding/binary"
	"fmt"
	"time"
	"github.com/Gui774ume/ebpf"
	"github.com/florianl/go-tc"
	"github.com/sirupsen/logrus"
	"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/base"
	"github.com/Gui774ume/network-security-probe/pkg/utils"
)
var (
	netLogger = logrus.WithField("package", "netdevice")
)
var Monitor = base.Monitor{
	Name: model.NetworkAlertMonitor,
	Probes: []*base.Probe{
		&base.Probe{
			Name:    "NetworkAlert",
			Enabled: true,
			PerfMaps: []*base.PerfMap{
				&base.PerfMap{
					PerfOutputMapName: "net_alerts",
					DataHandler:       traceNetAlerts,
				},
				&base.PerfMap{
					PerfOutputMapName: "dns_queries",
					DataHandler:       traceDNSQueries,
				},
				&base.PerfMap{
					PerfOutputMapName: "dns_responses",
					DataHandler:       traceDNSResponses,
				},
			},
		},
	},
}
func traceNetAlerts(data []byte, m *base.Monitor) {
	var eventRaw model.NetworkAlertRaw
	if err := binary.Read(bytes.NewBuffer(data), utils.GetHostByteOrder(), &eventRaw); err != nil {
		netLogger.Errorf("failed to decode received data (DeviceEventRaw): %s\n", err)
		return
	}
	event := model.NetworkAlertEvent{
		EventBase: model.EventBase{
			EventMonitorName: m.Name,
			EventType:        model.NetworkAlertType,
			Timestamp:        m.Nsp.GetBootTime().Add(time.Duration(eventRaw.TimestampRaw) * time.Nanosecond),
		},
		NetworkAlertRaw: &eventRaw,
		SourceMACAddr:   utils.Char6ToEth(eventRaw.SourceMACAddrRaw),
		DestMACAddr:     utils.Char6ToEth(eventRaw.DestMACAddrRaw),
	}
	switch event.NProtocol {
	case kernel.EthPIP:
		event.SourceIP = utils.Uint64ToIPv4(eventRaw.SourceIPRaw[0])
		event.DestIP = utils.Uint64ToIPv4(eventRaw.DestIPRaw[0])
	case kernel.EthPIPV6:
		event.SourceIP = utils.Uint64sToIPv6(eventRaw.SourceIPRaw)
		event.DestIP = utils.Uint64sToIPv6(eventRaw.DestIPRaw)
	}
	m.Nsp.DispatchEvent(&event)
}
func traceDNSQueries(data []byte, m *base.Monitor) {
	var eventRaw model.DNSQueryRaw
	if err := binary.Read(bytes.NewBuffer(data), utils.GetHostByteOrder(), &eventRaw); err != nil {
		netLogger.Errorf("failed to decode received data (DeviceEventRaw): %s\n", err)
		return
	}
	event := model.DNSQueryEvent{
		EventBase: model.EventBase{
			EventMonitorName: m.Name,
			EventType:        model.DNSQueryType,
			Timestamp:        m.Nsp.GetBootTime().Add(time.Duration(eventRaw.TimestampRaw) * time.Nanosecond),
		},
		DNSQueryRaw:   &eventRaw,
		SourceMACAddr: utils.Char6ToEth(eventRaw.SourceMACAddrRaw),
		DestMACAddr:   utils.Char6ToEth(eventRaw.DestMACAddrRaw),
		Domain:        utils.DecodeDNS(eventRaw.DNSQuerySpec.DNSKey.NameRaw),
	}
	switch event.NProtocol {
	case kernel.EthPIP:
		event.SourceIP = utils.Uint64ToIPv4(eventRaw.SourceIPRaw[0])
		event.DestIP = utils.Uint64ToIPv4(eventRaw.DestIPRaw[0])
	case kernel.EthPIPV6:
		event.SourceIP = utils.Uint64sToIPv6(eventRaw.SourceIPRaw)
		event.DestIP = utils.Uint64sToIPv6(eventRaw.DestIPRaw)
	}
	m.Nsp.DispatchEvent(&event)
}