flowexport

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: BSD-3-Clause, GPL-3.0 Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Receive

func Receive(ctx context.Context, conn *net.UDPConn, recorder *Recorder) error

Receive uses the same decoder and recorder as passive capture. The caller owns conn.

Types

type Batch

type Batch struct {
	Observations []Observation `json:"observations"`
	Issues       []Issue       `json:"issues"`
}

type Config

type Config struct {
	TemplateTTL  time.Duration
	MaxDomains   int
	MaxTemplates int
	MaxFields    int
}

func DefaultConfig

func DefaultConfig() Config

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

func New

func New(config Config) (*Engine, error)

func (*Engine) Decode

func (e *Engine) Decode(data []byte, envelope Envelope) (Batch, error)

func (*Engine) Health

func (e *Engine) Health() Health

type Envelope

type Envelope struct {
	Exporter      string `json:"exporter"`
	Collector     string `json:"collector"`
	ReceivedNs    int64  `json:"receivedNs,string"`
	PacketOrdinal uint64 `json:"packetOrdinal"`
}

type Event

type Event struct {
	Kind        string       `json:"kind"`
	Observation *Observation `json:"observation,omitempty"`
	Issue       *Issue       `json:"issue,omitempty"`
	Envelope    *Envelope    `json:"envelope,omitempty"`
	Datagram    []byte       `json:"datagram,omitempty"`
	SHA256      string       `json:"sha256,omitempty"`
}

type Field

type Field struct {
	ID                 uint16 `json:"id"`
	Enterprise         uint32 `json:"enterprise,omitempty"`
	EnterpriseProvided bool   `json:"enterpriseProvided,omitempty"`
	Scope              bool   `json:"scope,omitempty"`
	Value              []byte `json:"value"`
}

type Group

type Group struct {
	Key              string   `json:"key"`
	Bytes            uint64   `json:"bytes,string"`
	Packets          uint64   `json:"packets,string"`
	Records          int      `json:"records"`
	Peers            int      `json:"peers"`
	Members          []string `json:"observationIds"`
	MembersTruncated bool     `json:"membersTruncated"`
	// contains filtered or unexported fields
}

type Health

type Health struct {
	Version                 int      `json:"version"`
	Datagrams               uint64   `json:"datagrams"`
	Records                 uint64   `json:"records"`
	Malformed               uint64   `json:"malformed"`
	MissingTemplates        uint64   `json:"missingTemplates"`
	ExpiredTemplates        uint64   `json:"expiredTemplates"`
	SequenceDiscontinuities uint64   `json:"sequenceDiscontinuities"`
	PossibleRestarts        uint64   `json:"possibleRestarts"`
	Duplicates              uint64   `json:"duplicates"`
	StateLimitExceeded      uint64   `json:"stateLimitExceeded"`
	Limitations             []string `json:"limitations"`
}

type Issue

type Issue struct {
	Code       string   `json:"code"`
	Detail     string   `json:"detail"`
	Envelope   Envelope `json:"envelope"`
	TemplateID uint16   `json:"templateId,omitempty"`
}

type Observation

type Observation struct {
	Version            int      `json:"version"`
	ID                 string   `json:"id"`
	Envelope           Envelope `json:"envelope"`
	Format             string   `json:"format"`
	Domain             uint32   `json:"domain"`
	Sequence           uint32   `json:"sequence"`
	TemplateID         uint16   `json:"templateId,omitempty"`
	RecordOrdinal      int      `json:"recordOrdinal"`
	ExportNs           *int64   `json:"exportNs,omitempty,string"`
	StartNs            *int64   `json:"startNs,omitempty,string"`
	EndNs              *int64   `json:"endNs,omitempty,string"`
	TimeBasis          string   `json:"timeBasis"`
	ClockUncertaintyNs int64    `json:"clockUncertaintyNs,string"`
	SrcIP              string   `json:"srcIP"`
	DstIP              string   `json:"dstIP"`
	SrcPort            *uint64  `json:"srcPort,omitempty,string"`
	DstPort            *uint64  `json:"dstPort,omitempty,string"`
	Protocol           *uint64  `json:"protocol,omitempty"`
	TCPFlags           *uint64  `json:"tcpFlags,omitempty"`
	ICMPType           *uint64  `json:"icmpType,omitempty"`
	ICMPCode           *uint64  `json:"icmpCode,omitempty"`
	Ingress            *uint64  `json:"ingress,omitempty,string"`
	Egress             *uint64  `json:"egress,omitempty,string"`
	SrcAS              *uint64  `json:"srcAS,omitempty,string"`
	DstAS              *uint64  `json:"dstAS,omitempty,string"`
	SrcPrefixLength    *uint64  `json:"srcPrefixLength,omitempty"`
	DstPrefixLength    *uint64  `json:"dstPrefixLength,omitempty"`
	NextHop            string   `json:"nextHop,omitempty"`
	Bytes              *uint64  `json:"bytes,omitempty,string"`
	Packets            *uint64  `json:"packets,omitempty,string"`
	CounterSemantics   string   `json:"counterSemantics"`
	Sampling           Sampling `json:"sampling"`
	ActiveTimeout      *uint64  `json:"activeTimeoutSeconds,omitempty"`
	IdleTimeout        *uint64  `json:"idleTimeoutSeconds,omitempty"`
	Fields             []Field  `json:"fields"`
	Limitations        []string `json:"limitations"`
}

type Query

type Query struct {
	StartNs   int64   `json:"startNs,string"`
	EndNs     int64   `json:"endNs,string"`
	TimeBasis string  `json:"timeBasis"`
	Exporter  string  `json:"exporter"`
	Format    string  `json:"format"`
	Domain    *uint32 `json:"domain,omitempty"`
	Host      string  `json:"host,omitempty"`
	Ingress   *uint64 `json:"ingress,omitempty,string"`
	Egress    *uint64 `json:"egress,omitempty,string"`
	NextHop   string  `json:"nextHop,omitempty"`
	GroupBy   string  `json:"groupBy"`
	Limit     int     `json:"limit"`
}

type Recorder

type Recorder struct {
	// contains filtered or unexported fields
}

func NewRecorder

func NewRecorder(directory string, config Config) (*Recorder, error)

func (*Recorder) Close

func (r *Recorder) Close() error

func (*Recorder) Flush

func (r *Recorder) Flush() error

func (*Recorder) Observe

func (r *Recorder) Observe(data []byte, envelope Envelope) error

type RecorderHealth

type RecorderHealth struct {
	Health
	Status        string `json:"status"`
	StorageErrors uint64 `json:"storageErrors"`
	Issues        uint64 `json:"issues"`
	RecordsSHA256 string `json:"recordsSHA256,omitempty"`
}

type Report

type Report struct {
	Version      int            `json:"version"`
	Query        Query          `json:"query"`
	SourceSHA256 string         `json:"sourceSHA256"`
	Health       RecorderHealth `json:"health"`
	Groups       []Group        `json:"groups"`
	TotalGroups  int            `json:"totalGroups"`
	Matched      int            `json:"matchedRecords"`
	Excluded     int            `json:"unquantifiableRecords"`
	Limitations  []string       `json:"limitations"`
}

func ReadReport

func ReadReport(ctx context.Context, path string, query Query) (Report, error)

type Sampling

type Sampling struct {
	Status    string `json:"status"`
	Interval  uint64 `json:"interval,string"`
	Algorithm uint64 `json:"algorithm"`
	Scope     string `json:"scope"`
}

Jump to

Keyboard shortcuts

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