internal

package
v0.0.0-...-644e962 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCurrentTrafficsFile

func GetCurrentTrafficsFile(base string) string

func ListTrafficsFiles

func ListTrafficsFiles(dir string, base string) ([]string, error)

Types

type TrafficsReporter

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

TrafficsReporter 流量采集器 因性能考虑,统计流量可能会少量丢失,并且流量产生的时间可能不精确

func NewTrafficsReporter

func NewTrafficsReporter(interval time.Duration, filePath string) (*TrafficsReporter, error)

func (*TrafficsReporter) Close

func (c *TrafficsReporter) Close() error

func (*TrafficsReporter) Report

func (c *TrafficsReporter) Report(identifier string, bytes int64) error

Report 上报采集到的流量

type TrafficsScanner

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

func NewTrafficsScanner

func NewTrafficsScanner(filePath string) (*TrafficsScanner, error)

func (*TrafficsScanner) Scan

func (s *TrafficsScanner) Scan(ctx context.Context, f func(time time.Time, identifier string, bytes int64)) error

Scan 扫描数据

func (*TrafficsScanner) Tail

func (s *TrafficsScanner) Tail(ctx context.Context, f func(time time.Time, identifier string, bytes int64)) error

Tail 扫描数据,不支持日志轮询场景(即文件被重命名归档,然后创建一个新文件用于使用)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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