adapter

package
v0.0.0-...-77199df Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ADAPTER_CMD_SHOW = iota
	ADAPTER_CMD_STATUS
)
View Source
const (
	DELTA_TIMESTAMP_LEN  = 2
	UDP_BUFFER_SIZE      = 1 << 16
	ICMP_TYPE_CODE       = 2
	ICMP_ID_SEQ          = 4
	ICMP_REST            = 28
	IPV6_ADDR_LEN        = 16
	COMPRESS_HEADER_SIZE = 21 // VERSION(1) + SEQ(8) + TIMESAMP(8) + IF_MAC(4)

)
View Source
const (
	ANALYZER_TRIDENT      = 0xffffff00 // 压缩报文来自analyzer上的trident
	ANALYZER_TRIDNET_MASK = 0xff       // 压缩报文来自analyzer上的trident时的掩码
)
View Source
const (
	TRIDENT_TIMEOUT = 2 * time.Second

	BATCH_SIZE = 128

	TRIDENT_DISPATCHER_MAX = 16
)
View Source
const (
	QUEUE_BATCH_SIZE = 1024
)

Variables

This section is empty.

Functions

func CommmandGetResult

func CommmandGetResult(moduleId debug.ModuleId, operate uint16, output interface{}) bool

func RegisterCommand

func RegisterCommand(moduleId debug.ModuleId) *cobra.Command

Types

type Decoded

type Decoded struct {
	IpID uint16
	// contains filtered or unexported fields
}

type PacketCounter

type PacketCounter struct {
	RxPackets uint64 `statsd:"rx_packets"`
	RxDropped uint64 `statsd:"rx_dropped"` // 当前SEQ减去上次的SEQ
	RxErrors  uint64 `statsd:"rx_errors"`  // 当前SEQ小于上次的SEQ时+1,包乱序并且超出了CACHE_SIZE
	RxInvalid uint64 `statsd:"rx_invalid"` // 错误的包

	TxPackets uint64 `statsd:"tx_packets"`
}

type SequentialDecoder

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

func NewSequentialDecoder

func NewSequentialDecoder(data []byte) *SequentialDecoder

func (*SequentialDecoder) DecodeHeader

func (d *SequentialDecoder) DecodeHeader(frameSize uint16) (bool, uint16)

func (*SequentialDecoder) Field

func (d *SequentialDecoder) Field(len int) []byte

func (*SequentialDecoder) NextPacket

func (d *SequentialDecoder) NextPacket(meta *MetaPacket) bool

func (*SequentialDecoder) Seq

func (d *SequentialDecoder) Seq() uint64

func (*SequentialDecoder) Skip

func (d *SequentialDecoder) Skip(len int)

func (*SequentialDecoder) U16

func (d *SequentialDecoder) U16() uint16

func (*SequentialDecoder) U32

func (d *SequentialDecoder) U32() uint32

func (*SequentialDecoder) U64

func (d *SequentialDecoder) U64() uint64

func (*SequentialDecoder) U8

func (d *SequentialDecoder) U8() uint8

type TridentAdapter

type TridentAdapter struct {
	io.Closer
	utils.Closable
	// contains filtered or unexported fields
}

func NewTridentAdapter

func NewTridentAdapter(in queue.QueueReader, queues []queue.QueueWriter, cacheSize uint32) *TridentAdapter

func (*TridentAdapter) Close

func (a *TridentAdapter) Close() error

io.Closer()

func (*TridentAdapter) GetCounter

func (a *TridentAdapter) GetCounter() interface{}

func (*TridentAdapter) GetInstances

func (a *TridentAdapter) GetInstances() []*tridentInstance

func (*TridentAdapter) GetStatsCounter

func (a *TridentAdapter) GetStatsCounter() interface{}

func (*TridentAdapter) RecvCommand

func (c *TridentAdapter) RecvCommand(conn *net.UDPConn, remote *net.UDPAddr, operate uint16, arg *bytes.Buffer)

func (*TridentAdapter) Start

func (a *TridentAdapter) Start() error

type TridentKey

type TridentKey = uint32

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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