package module
Version: v0.0.0-...-e52ba1f Latest Latest

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

Go to latest
Published: Aug 8, 2022 License: Apache-2.0 Imports: 9 Imported by: 15




View Source
const (
	TABLE string = "table"
	BODY  string = "body"
View Source
const UnknownNamespace = ""


View Source
var UnknownIp = net.IP{0, 0, 0, 0}
View Source
var UnknownPort uint16 = 0


This section is empty.


type AppStats

type AppStats struct {
	StartTime                   time.Time `json:"-"`
	ProcessedBytes              uint64    `json:"processedBytes"`
	PacketsCount                uint64    `json:"packetsCount"`
	TcpPacketsCount             uint64    `json:"tcpPacketsCount"`
	IgnoredPacketsCount         uint64    `json:"ignoredPacketsCount"`
	ReassembledTcpPayloadsCount uint64    `json:"reassembledTcpPayloadsCount"`
	TlsConnectionsCount         uint64    `json:"tlsConnectionsCount"`
	MatchedPairs                uint64    `json:"matchedPairs"`
	DroppedTcpStreams           uint64    `json:"droppedTcpStreams"`
	LiveTcpStreams              uint64    `json:"liveTcpStreams"`
	IgnoredLastAckCount         uint64    `json:"ignoredLastAckCount"`
	ThrottledPackets            uint64    `json:"throttledPackets"`

func (*AppStats) DecLiveTcpStreams

func (as *AppStats) DecLiveTcpStreams()

func (*AppStats) DumpStats

func (as *AppStats) DumpStats() *AppStats

func (*AppStats) IncDroppedTcpStreams

func (as *AppStats) IncDroppedTcpStreams()

func (*AppStats) IncIgnoredLastAckCount

func (as *AppStats) IncIgnoredLastAckCount()

func (*AppStats) IncIgnoredPacketsCount

func (as *AppStats) IncIgnoredPacketsCount()

func (*AppStats) IncLiveTcpStreams

func (as *AppStats) IncLiveTcpStreams()

func (*AppStats) IncMatchedPairs

func (as *AppStats) IncMatchedPairs()

func (*AppStats) IncPacketsCount

func (as *AppStats) IncPacketsCount() uint64

func (*AppStats) IncReassembledTcpPayloadsCount

func (as *AppStats) IncReassembledTcpPayloadsCount()

func (*AppStats) IncTcpPacketsCount

func (as *AppStats) IncTcpPacketsCount()

func (*AppStats) IncThrottledPackets

func (as *AppStats) IncThrottledPackets()

func (*AppStats) IncTlsConnectionsCount

func (as *AppStats) IncTlsConnectionsCount()

func (*AppStats) SetStartTime

func (as *AppStats) SetStartTime(startTime time.Time)

func (*AppStats) UpdateProcessedBytes

func (as *AppStats) UpdateProcessedBytes(size uint64)

type BaseEntry

type BaseEntry struct {
	Id           string   `json:"id"`
	Protocol     Protocol `json:"proto,omitempty"`
	Capture      Capture  `json:"capture"`
	Summary      string   `json:"summary,omitempty"`
	SummaryQuery string   `json:"summaryQuery,omitempty"`
	Status       int      `json:"status"`
	StatusQuery  string   `json:"statusQuery"`
	Method       string   `json:"method,omitempty"`
	MethodQuery  string   `json:"methodQuery,omitempty"`
	Timestamp    int64    `json:"timestamp,omitempty"`
	Source       *TCP     `json:"src"`
	Destination  *TCP     `json:"dst"`
	IsOutgoing   bool     `json:"isOutgoing,omitempty"`
	Latency      int64    `json:"latency"`

type Capture

type Capture string
const (
	UndefinedCapture Capture = ""
	Pcap             Capture = "pcap"
	Envoy            Capture = "envoy"
	Linkerd          Capture = "linkerd"
	Ebpf             Capture = "ebpf"

type ConnectionInfo

type ConnectionInfo struct {
	ClientIP   string
	ClientPort string
	ServerIP   string
	ServerPort string
	IsOutgoing bool

type CounterPair

type CounterPair struct {
	Request  uint
	Response uint

type Dissector

type Dissector interface {
	GetProtocols() map[string]*Protocol
	Dissect(b *bufio.Reader, reader TcpReader, options *TrafficFilteringOptions) error
	Analyze(item *OutputChannelItem, resolvedSource string, resolvedDestination string, namespace string) *Entry
	Summarize(entry *Entry) *BaseEntry
	Represent(request map[string]interface{}, response map[string]interface{}) (object []byte, err error)
	Macros() map[string]string
	NewResponseRequestMatcher() RequestResponseMatcher

type Emitter

type Emitter interface {
	Emit(item *OutputChannelItem)

type Emitting

type Emitting struct {
	AppStats      *AppStats
	OutputChannel chan *OutputChannelItem

func (*Emitting) Emit

func (e *Emitting) Emit(item *OutputChannelItem)

type Entry

type Entry struct {
	Id           string                 `json:"id"`
	Protocol     ProtocolSummary        `json:"protocol"`
	Capture      Capture                `json:"capture"`
	Source       *TCP                   `json:"src"`
	Destination  *TCP                   `json:"dst"`
	Namespace    string                 `json:"namespace"`
	Outgoing     bool                   `json:"outgoing"`
	Timestamp    int64                  `json:"timestamp"`
	StartTime    time.Time              `json:"startTime"`
	Request      map[string]interface{} `json:"request"`
	Response     map[string]interface{} `json:"response"`
	RequestSize  int                    `json:"requestSize"`
	ResponseSize int                    `json:"responseSize"`
	ElapsedTime  int64                  `json:"elapsedTime"`

type EntryWrapper

type EntryWrapper struct {
	Protocol       Protocol   `json:"protocol"`
	Representation string     `json:"representation"`
	Data           *Entry     `json:"data"`
	Base           *BaseEntry `json:"base"`

type Extension

type Extension struct {
	Protocol  *Protocol
	Path      string
	Dissector Dissector

type GenericMessage

type GenericMessage struct {
	IsRequest   bool        `json:"isRequest"`
	CaptureTime time.Time   `json:"captureTime"`
	CaptureSize int         `json:"captureSize"`
	Payload     interface{} `json:"payload"`

type OutputChannelItem

type OutputChannelItem struct {
	// `Protocol` is modified in later stages of data propagation. Therefore, it's not a pointer.
	Protocol       Protocol
	Capture        Capture
	Timestamp      int64
	ConnectionInfo *ConnectionInfo
	Pair           *RequestResponsePair
	Namespace      string

type Protocol

type Protocol struct {
	LongName        string   `json:"longName"`
	Macro           string   `json:"macro"`
	BackgroundColor string   `json:"backgroundColor"`
	ForegroundColor string   `json:"foregroundColor"`
	FontSize        int8     `json:"fontSize"`
	ReferenceLink   string   `json:"referenceLink"`
	Ports           []string `json:"ports"`
	Priority        uint8    `json:"priority"`

type ProtocolSummary

type ProtocolSummary struct {
	Name         string `json:"name"`
	Version      string `json:"version"`
	Abbreviation string `json:"abbr"`

func GetProtocolSummary

func GetProtocolSummary(inputString string) *ProtocolSummary

func (*ProtocolSummary) ToString

func (protocol *ProtocolSummary) ToString() string

type ReadProgress

type ReadProgress struct {
	// contains filtered or unexported fields

func (*ReadProgress) Current

func (p *ReadProgress) Current() (n int)

func (*ReadProgress) Feed

func (p *ReadProgress) Feed(n int)

func (*ReadProgress) Reset

func (p *ReadProgress) Reset()

type RequestResponseMatcher

type RequestResponseMatcher interface {
	GetMap() *sync.Map
	SetMaxTry(value int)

type RequestResponsePair

type RequestResponsePair struct {
	Request  GenericMessage `json:"request"`
	Response GenericMessage `json:"response"`

type SectionData

type SectionData struct {
	Type     string `json:"type"`
	Title    string `json:"title"`
	Data     string `json:"data"`
	Encoding string `json:"encoding,omitempty"`
	MimeType string `json:"mimeType,omitempty"`
	Selector string `json:"selector,omitempty"`

type SerializableRegexp

type SerializableRegexp struct {

func CompileRegexToSerializableRegexp

func CompileRegexToSerializableRegexp(expr string) (*SerializableRegexp, error)

func (*SerializableRegexp) MarshalText

func (r *SerializableRegexp) MarshalText() ([]byte, error)

MarshalText is used by json.Marshal.

func (*SerializableRegexp) UnmarshalText

func (r *SerializableRegexp) UnmarshalText(text []byte) error

UnmarshalText is by json.Unmarshal.

type TCP

type TCP struct {
	IP   string `json:"ip"`
	Port string `json:"port"`
	Name string `json:"name"`

type TableData

type TableData struct {
	Name     string      `json:"name"`
	Value    interface{} `json:"value"`
	Selector string      `json:"selector"`

type TcpID

type TcpID struct {
	SrcIP   string
	DstIP   string
	SrcPort string
	DstPort string
	Ident   string

type TcpReader

type TcpReader interface {
	Read(p []byte) (int, error)
	GetReqResMatcher() RequestResponseMatcher
	GetIsClient() bool
	GetReadProgress() *ReadProgress
	GetParent() TcpStream
	GetTcpID() *TcpID
	GetCounterPair() *CounterPair
	GetCaptureTime() time.Time
	GetEmitter() Emitter
	GetIsClosed() bool

type TcpReaderDataMsg

type TcpReaderDataMsg interface {
	GetBytes() []byte
	GetTimestamp() time.Time

type TcpStream

type TcpStream interface {
	SetProtocol(protocol *Protocol)
	GetOrigin() Capture
	GetReqResMatchers() []RequestResponseMatcher
	GetIsTapTarget() bool
	GetIsClosed() bool

type TcpStreamMap

type TcpStreamMap interface {
	Range(f func(key, value interface{}) bool)
	Store(key, value interface{})
	Delete(key interface{})
	NextId() int64

type TrafficFilteringOptions

type TrafficFilteringOptions struct {
	IgnoredUserAgents []string

Jump to

Keyboard shortcuts

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