model

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DNSStatusResolved     = "resolved"
	DNSStatusTimeout      = "timeout"
	DNSStatusResponseOnly = "response_only"
)

Variables

This section is empty.

Functions

func DNSResponseCodeString added in v0.3.0

func DNSResponseCodeString(code layers.DNSResponseCode) string

Types

type DNSAnswer added in v0.3.0

type DNSAnswer struct {
	Name  string `json:"name" bigquery:"name"`
	Type  string `json:"type" bigquery:"type"`
	Value string `json:"value" bigquery:"value"`
	TTL   int64  `json:"ttl" bigquery:"ttl"`
}

func ConvertDNSAnswers added in v0.3.0

func ConvertDNSAnswers(answers []layers.DNSResourceRecord) []DNSAnswer

type DNSLog added in v0.3.0

type DNSLog struct {
	ID            uuid.UUID     `json:"id"`
	TransactionID uint16        `json:"tx_id"`
	ClientAddr    net.IP        `json:"client_addr"`
	ClientPort    uint32        `json:"client_port"`
	ServerAddr    net.IP        `json:"server_addr"`
	ServerPort    uint32        `json:"server_port"`
	Questions     []DNSQuestion `json:"questions"`
	ResponseCode  string        `json:"response_code"`
	Answers       []DNSAnswer   `json:"answers"`
	QueryAt       *time.Time    `json:"query_at"`
	ResponseAt    *time.Time    `json:"response_at"`
	Status        string        `json:"status"`
}

type DNSQuestion added in v0.3.0

type DNSQuestion struct {
	Name string `json:"name" bigquery:"name"`
	Type string `json:"type" bigquery:"type"`
}

func ConvertDNSQuestions added in v0.3.0

func ConvertDNSQuestions(questions []layers.DNSQuestion) []DNSQuestion

type Flow

type Flow struct {
	ID       uuid.UUID `bigquery:"id" json:"id"`
	Protocol string    `bigquery:"protocol" json:"protocol"`
	Src      Peer      `bigquery:"src" json:"src"`
	Dst      Peer      `bigquery:"dst" json:"dst"`

	FirstSeenAt time.Time `bigquery:"first_seen_at"`
	LastSeenAt  time.Time `bigquery:"last_seen_at" json:"last_seen_at"`

	SrcStat PeerStat `bigquery:"src_stat" json:"src_stat"`
	DstStat PeerStat `bigquery:"dst_stat" json:"dst_stat"`
	Status  string   `bigquery:"status" json:"status"`
}

func NewFlow

func NewFlow(src, dst Peer, proto string, now time.Time, stat PeerStat) *Flow

func (*Flow) Key

func (x *Flow) Key() FlowKey

func (*Flow) Update

func (x *Flow) Update(src *Peer, now time.Time, stat PeerStat)

type FlowBase

type FlowBase struct {
}

type FlowKey

type FlowKey uint64

func CalcFlowKey

func CalcFlowKey(p1, p2 *Peer, proto string) FlowKey

type Peer

type Peer struct {
	Addr   net.IP           `bigquery:"addr" json:"addr"`
	Port   uint32           `bigquery:"port" json:"port"`
	HWAddr net.HardwareAddr `bigquery:"-" json:"hw_addr,omitempty"`
	Names  []string         `bigquery:"-" json:"names,omitempty"`
}

func (Peer) Equal

func (x Peer) Equal(y *Peer) bool

func (Peer) MarshalJSON added in v0.2.0

func (x Peer) MarshalJSON() ([]byte, error)

func (*Peer) UnmarshalJSON added in v0.2.0

func (x *Peer) UnmarshalJSON(data []byte) error

type PeerStat

type PeerStat struct {
	Bytes   uint64 `bigquery:"bytes" json:"bytes"`
	Packets uint64 `bigquery:"packets" json:"packets"`
}

func (*PeerStat) Add

func (x *PeerStat) Add(y *PeerStat)

type Record

type Record struct {
	FlowLogs []*Flow
	DNSLogs  []*DNSLog
}

type Tick

type Tick int64

Jump to

Keyboard shortcuts

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