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
	}
	// Prepare event
	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)
	}

	// Dispatch event
	m.Nsp.DispatchEvent(&event)
}
// traceDNSQueries - Traces DNS queries
Traces DNS queries
// traceDNSQueries - Traces DNS queries
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)
}
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 ( " \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 ) }
Traces DNS queries
Traces DNS queries
// Prepare event // Dispatch event