ncap

package
v0.0.0-...-883742a Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2025 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProcessAoiSyncDelta

func ProcessAoiSyncDelta(data *pb.AoiSyncDelta)

Types

type ByteReader

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

ByteReader 字节读取器,用于处理大端序数据

func NewByteReader

func NewByteReader(buffer []byte, offset ...int) *ByteReader

NewByteReader 创建新的字节读取器

func (*ByteReader) PeekBytes

func (br *ByteReader) PeekBytes(length int) ([]byte, error)

PeekBytes 查看指定长度的字节(不移动偏移)

func (*ByteReader) PeekUInt16BE

func (br *ByteReader) PeekUInt16BE() (uint16, error)

PeekUInt16BE 查看大端序16位无符号整数(不移动偏移)

func (*ByteReader) PeekUInt32BE

func (br *ByteReader) PeekUInt32BE() (uint32, error)

PeekUInt32BE 查看大端序32位无符号整数(不移动偏移)

func (*ByteReader) PeekUInt64BE

func (br *ByteReader) PeekUInt64BE() (uint64, error)

PeekUInt64BE 查看大端序64位无符号整数(不移动偏移)

func (*ByteReader) ReadBytes

func (br *ByteReader) ReadBytes(length int) ([]byte, error)

ReadBytes 读取指定长度的字节

func (*ByteReader) ReadRemaining

func (br *ByteReader) ReadRemaining() []byte

ReadRemaining 读取所有剩余字节

func (*ByteReader) ReadUInt16BE

func (br *ByteReader) ReadUInt16BE() (uint16, error)

ReadUInt16BE 读取大端序16位无符号整数

func (*ByteReader) ReadUInt32BE

func (br *ByteReader) ReadUInt32BE() (uint32, error)

ReadUInt32BE 读取大端序32位无符号整数

func (*ByteReader) ReadUInt64BE

func (br *ByteReader) ReadUInt64BE() (uint64, error)

ReadUInt64BE 读取大端序64位无符号整数

func (*ByteReader) Remaining

func (br *ByteReader) Remaining() int

Remaining 剩余可读字节数

func (*ByteReader) TryPeekUInt32BE

func (br *ByteReader) TryPeekUInt32BE() (uint32, bool)

TryPeekUInt32BE 尝试读取大端序32位无符号整数(不移动偏移)

type CapCore

type CapCore struct{}

CapCore 抓包核心类

func NewCapCore

func NewCapCore() *CapCore

NewCapCore 创建新的抓包核心

func (*CapCore) GetDevice

func (cc *CapCore) GetDevice(deviceName string) (*pcap.Handle, error)

GetDevice 获取网卡设备

func (*CapCore) Start

func (cc *CapCore) Start(deviceName string) error

Start 启动抓包

type CapDevice

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

func NewCapDevice

func NewCapDevice(device *pcap.Handle, deviceName string) *CapDevice

NewCapDevice 创建新的抓包设备

func (*CapDevice) Start

func (cd *CapDevice) Start() error

Start 开始抓包

type InterfaceStats

type InterfaceStats struct {
	Name        string `json:"name"`
	Desc        string `json:"desc"`
	PacketCount int    `json:"packet_count"`
	ByteCount   int64  `json:"byte_count"`
}

func GetActiveNetworkCards

func GetActiveNetworkCards(devices []pcap.Interface, autoCheckTime int) *InterfaceStats

GetActiveNetworkCards 获取当前可能正在使用的网卡

type Queue

type Queue[T any] struct {
	// contains filtered or unexported fields
}

Queue 泛型队列 - 线程安全版本

func NewQueue

func NewQueue[T any]() *Queue[T]

func (*Queue[T]) Clear

func (q *Queue[T]) Clear()

Clear 清空队列(新增方法)

func (*Queue[T]) Dequeue

func (q *Queue[T]) Dequeue() (T, bool)

func (*Queue[T]) Enqueue

func (q *Queue[T]) Enqueue(item T)

func (*Queue[T]) Front

func (q *Queue[T]) Front() (T, bool)

func (*Queue[T]) IsEmpty

func (q *Queue[T]) IsEmpty() bool

func (*Queue[T]) Size

func (q *Queue[T]) Size() int

Jump to

Keyboard shortcuts

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