traffic

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Identification

func Identification(b []byte, way Way) string

Identification @Description: @param b @param way @return string

func IdentificationV2

func IdentificationV2(b []byte, way Way) string

IdentificationV2 @Description: In Default -> |protocol|src,src_port(tcp or udp)|dst,dst_port(tcp or udp)|

Out        -> |protocol|dst,dst_port(tcp or udp)|src,src_port(tcp or udp)|

@param b @param way @return string

Types

type BPSLimiter

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

BPSLimiter @Description:

func NewBPSLimiterFP

func NewBPSLimiterFP(bandwidth int, mtu int) BPSLimiter

NewBPSLimiterFP @Description: @param bandwidth @param mtu @return BPSLimiter

func (*BPSLimiter) Close

func (l *BPSLimiter) Close()

Close @Description: @receiver l

func (*BPSLimiter) Init

func (l *BPSLimiter) Init() bool

Init @Description: @receiver l @return bool

func (*BPSLimiter) Process

func (l *BPSLimiter) Process(raw []byte) []byte

Process @Description: @receiver l @param raw @return []byte

type BlockDecryptFP

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

BlockDecryptFP @Description:

func NewBlockDecryptFP

func NewBlockDecryptFP(crypt kcp.BlockCrypt) *BlockDecryptFP

NewBlockDecryptFP @Description: @param key @return fp @return err

func (*BlockDecryptFP) Close

func (e *BlockDecryptFP) Close()

Close @Description: @receiver e

func (*BlockDecryptFP) Init

func (e *BlockDecryptFP) Init() bool

Init @Description: @receiver e @return bool

func (*BlockDecryptFP) Process

func (e *BlockDecryptFP) Process(raw []byte) []byte

Process @Description: @receiver e @param raw @return []byte

type BlockEncryptFP

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

BlockEncryptFP @Description:

func NewBlockEncryptFP

func NewBlockEncryptFP(crypt kcp.BlockCrypt) *BlockEncryptFP

NewBlockEncryptFP @Description: @param key @return fp @return err

func (*BlockEncryptFP) Close

func (e *BlockEncryptFP) Close()

Close @Description: @receiver e

func (*BlockEncryptFP) Init

func (e *BlockEncryptFP) Init() bool

Init @Description: @receiver e @return bool

func (*BlockEncryptFP) Process

func (e *BlockEncryptFP) Process(raw []byte) []byte

Process @Description: @receiver e @param raw @return []byte

type FlowLimitFP

type FlowLimitFP struct {
	Flow  uint64 //起始点
	Limit uint64 //限制
	// contains filtered or unexported fields
}

FlowLimitFP @Description:

func NewFlowLimitFP

func NewFlowLimitFP(counter *FlowStatisticsFP, flow, limit uint64, kick func()) FlowLimitFP

NewFlowLimitFP @Description: @return *FlowLimitFP

func (*FlowLimitFP) Close

func (f *FlowLimitFP) Close()

Close @Description: @receiver f

func (*FlowLimitFP) Init

func (f *FlowLimitFP) Init() bool

Init @Description: @receiver f @return bool

func (*FlowLimitFP) Process

func (f *FlowLimitFP) Process(raw []byte) []byte

Process @Description: @receiver f @param raw @return []byte

type FlowProcessor

type FlowProcessor interface {
	//
	// Init
	// @Description: init processor
	//
	Init() bool
	//
	// Process
	// @Description: do process method
	// @param raw
	// @return []byte
	//
	Process(raw []byte) []byte
	//
	// Close
	// @Description:
	//
	Close()
}

FlowProcessor @Description: flow data processor interface

type FlowProcessors

type FlowProcessors struct {
	Name string
	// contains filtered or unexported fields
}

FlowProcessors @Description: processors

func NewFlowProcessor

func NewFlowProcessor() *FlowProcessors

NewFlowProcessor @Description: @return *FlowProcessors

func (FlowProcessors) Close

func (fp FlowProcessors) Close()

Close @Description: @receiver fp

func (*FlowProcessors) Delete

func (fp *FlowProcessors) Delete(name string)

Delete @Description: @receiver fp @param name

func (*FlowProcessors) GetByName

func (fp *FlowProcessors) GetByName(name string) *ProcessorNode

GetByName @Description: @receiver fp @param name @return *ProcessorNode

func (FlowProcessors) List

func (fp FlowProcessors) List() []string

List @Description: @receiver fp @return []string

func (FlowProcessors) Process

func (fp FlowProcessors) Process(bytes []byte) []byte

Process @Description: start process data by using processor positively @receiver fp

func (FlowProcessors) ProcessReverse

func (fp FlowProcessors) ProcessReverse(bytes []byte) []byte

ProcessReverse @Description: start process data by using processor reversely @receiver fp

func (*FlowProcessors) Register

func (fp *FlowProcessors) Register(processor FlowProcessor, name string)

Register @Description: register for data processor @receiver fp @param processor

type FlowStatisticsFP

type FlowStatisticsFP struct {
	Name            string
	Flow            uint64
	FlowStamp       uint64
	FlowCommitStamp uint64
	FlowSpeed       uint64
	Packet          uint64
	PacketStamp     uint64
	PacketSpeed     uint64
	RecordGap       int
	Print           bool
	// contains filtered or unexported fields
}

FlowStatisticsFP @Description:

func (*FlowStatisticsFP) Close

func (fp *FlowStatisticsFP) Close()

Close @Description: @receiver fp

func (*FlowStatisticsFP) Commit

func (fp *FlowStatisticsFP) Commit() uint64

Commit @Description: @receiver fp @return uint64

func (*FlowStatisticsFP) Dump

func (fp *FlowStatisticsFP) Dump(file string) error

Dump @Description: @receiver fp @param file @return error

func (*FlowStatisticsFP) Init

func (fp *FlowStatisticsFP) Init() bool

Init @Description: @receiver fp

func (*FlowStatisticsFP) LoadFromDump

func (fp *FlowStatisticsFP) LoadFromDump(file string) error

LoadFromDump @Description: @receiver fp @param file @return error

func (*FlowStatisticsFP) Process

func (fp *FlowStatisticsFP) Process(raw []byte) []byte

Process @Description: @receiver fp @param raw @return []byte

type Identifier added in v0.0.4

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

func NewIdentifier added in v0.0.4

func NewIdentifier() *Identifier

func (*Identifier) Dst added in v0.0.7

func (i *Identifier) Dst(b []byte) string

func (*Identifier) Src added in v0.0.7

func (i *Identifier) Src(b []byte) string

func (*Identifier) SymbolIn added in v0.0.4

func (i *Identifier) SymbolIn(b []byte) (id string)

func (*Identifier) SymbolOut added in v0.0.4

func (i *Identifier) SymbolOut(b []byte) (id string)

type LimitedBPSBucket

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

func NewLimitedBPSBucket

func NewLimitedBPSBucket(maxSpeed uint64, mtu int) *LimitedBPSBucket

func (*LimitedBPSBucket) Close

func (l *LimitedBPSBucket) Close()

Close @Description: @receiver l

func (*LimitedBPSBucket) Take

func (l *LimitedBPSBucket) Take(p []byte)

Take @Description: @receiver l

type LimitedPPSBucket

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

LimitedPPSBucket @Description:

func NewLimitedPPSBucket

func NewLimitedPPSBucket(maxSpeed uint64, mtu int) *LimitedPPSBucket

NewLimitedPPSBucket @Description: @return LimitedPPSBucket

func (*LimitedPPSBucket) Close

func (l *LimitedPPSBucket) Close()

Close @Description: @receiver l

func (*LimitedPPSBucket) Take

func (l *LimitedPPSBucket) Take(p []byte)

Take @Description: 从桶中取令牌,如果余量不足以取出则等待 @receiver l

type PPSLimiter

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

PPSLimiter @Description:

func NewPPSLimiterFP

func NewPPSLimiterFP(bandwidth int, mtu int) PPSLimiter

NewPPSLimiterFP @Description: @param bandwidth @param mtu @return *PPSLimiter

func (*PPSLimiter) Close

func (l *PPSLimiter) Close()

Close @Description: @receiver l

func (*PPSLimiter) Init

func (l *PPSLimiter) Init() bool

Init @Description: @receiver PPSLimiter @return bool

func (*PPSLimiter) Process

func (l *PPSLimiter) Process(raw []byte) []byte

Process @Description: @receiver l @param raw @return []byte

type ProcessorNode

type ProcessorNode struct {
	Name      string
	Processor FlowProcessor
	Next      *ProcessorNode
	Last      *ProcessorNode
}

ProcessorNode @Description: processor chain node

type Salsa20DecryptFP

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

Salsa20DecryptFP @Description:

func NewSalsa20DecryptFP

func NewSalsa20DecryptFP(key []byte) (fp *Salsa20DecryptFP, err error)

NewSalsa20DecryptFP @Description: @param key @return fp @return err

func (*Salsa20DecryptFP) Close

func (e *Salsa20DecryptFP) Close()

Close @Description: @receiver e

func (*Salsa20DecryptFP) Init

func (e *Salsa20DecryptFP) Init() bool

Init @Description: @receiver e @return bool

func (*Salsa20DecryptFP) Process

func (e *Salsa20DecryptFP) Process(raw []byte) []byte

Process @Description: @receiver e @param raw @return []byte

type Salsa20EncryptFP

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

Salsa20EncryptFP @Description:

func NewSalsa20EncryptFP

func NewSalsa20EncryptFP(key []byte) (fp *Salsa20EncryptFP, err error)

NewSalsa20EncryptFP @Description: @param key @return fp @return err

func (*Salsa20EncryptFP) Close

func (e *Salsa20EncryptFP) Close()

Close @Description: @receiver e

func (*Salsa20EncryptFP) Init

func (e *Salsa20EncryptFP) Init() bool

Init @Description: @receiver e @return bool

func (*Salsa20EncryptFP) Process

func (e *Salsa20EncryptFP) Process(raw []byte) []byte

Process @Description: @receiver e @param raw @return []byte

type Way

type Way int
const (
	In      Way = 0
	Out     Way = 1
	Default Way = 2
)

type ZSTDCompressFP

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

ZSTDCompressFP @Description:

func (*ZSTDCompressFP) Close

func (c *ZSTDCompressFP) Close()

Close @Description: @receiver c

func (*ZSTDCompressFP) Init

func (c *ZSTDCompressFP) Init() bool

Init @Description: @receiver c @return bool

func (*ZSTDCompressFP) Process

func (c *ZSTDCompressFP) Process(raw []byte) []byte

Process @Description: @receiver c @param raw @return []byte

type ZSTDDecompressFP

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

ZSTDDecompressFP @Description:

func (*ZSTDDecompressFP) Close

func (c *ZSTDDecompressFP) Close()

Close @Description: @receiver c

func (*ZSTDDecompressFP) Init

func (c *ZSTDDecompressFP) Init() bool

Init @Description: @receiver c @return bool

func (*ZSTDDecompressFP) Process

func (c *ZSTDDecompressFP) Process(raw []byte) []byte

Process @Description: @receiver c @param raw @return []byte

Jump to

Keyboard shortcuts

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