client

package
v0.1.0-alpha.7 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: MulanPSL-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package client 实现 Pulse UDP 客户端。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, c Config) error

Run 执行一次完整测试(阻塞至结束)。

func RunClientUDPStats

func RunClientUDPStats(
	w io.Writer,
	tick time.Duration,
	testStart time.Time,
	mainDur time.Duration,
	ulPPS, dlPPS int64,
	dlSpacingNs int64,
	bucket *statwindow.SumBucket,
)

RunClientUDPStats 在主测试时长内按 tick 打印 iperf3 UDP 风格 [SUM] 行;DL 入站抖动与丢包。

func TestAutoGeneratedTestID_ErrorHandling

func TestAutoGeneratedTestID_ErrorHandling(t *testing.T)

测试 autoGeneratedTestID 函数的错误处理

func TestAutoGeneratedTestID_Format

func TestAutoGeneratedTestID_Format(t *testing.T)

测试 autoGeneratedTestID 函数的格式

func TestResolveClientOutputPaths_BoundaryCases

func TestResolveClientOutputPaths_BoundaryCases(t *testing.T)

测试 resolveClientOutputPaths 函数的边界情况

func TestResolveClientOutputPaths_DefaultOutputRoot

func TestResolveClientOutputPaths_DefaultOutputRoot(t *testing.T)

测试 resolveClientOutputPaths 函数的默认输出目录

func TestResolveClientOutputPaths_DirectoryCreation

func TestResolveClientOutputPaths_DirectoryCreation(t *testing.T)

测试 resolveClientOutputPaths 函数的目录创建

func TestSendULAndRecvDL

func TestSendULAndRecvDL(t *testing.T)

测试 sendUL 和 recvDL 函数的集成测试

Types

type Config

type Config struct {
	ServerAddr     string
	SourceAddr     string // 源地址(可选,默认使用系统默认地址)
	Size           int
	ULBandwidth    string
	DLBandwidth    string
	Duration       time.Duration
	SampleInterval time.Duration
	GracePeriod    time.Duration
	TimeDeltaNs    int64
	TestID         string // 为空时 Run 内自动生成 YYYYMMDDTHHmmss_xxxxxx(与 20260306T201103 同类 + 下划线六位 hex 随机)
	// OutputRoot 输出根目录;其下创建 {TestID}/,写入 client.csv 与 config.json。空字符串在 Run 内按 "results" 处理。
	OutputRoot string
	Logger     *slog.Logger
	// StatsInterval 周期打印间隔(iperf3 UDP 风格表);<=0 关闭。与 SampleInterval(merge 分桶)独立。
	StatsInterval time.Duration
	// StatsWriter 周期表输出目标;StatsInterval>0 且为 nil 时使用 os.Stdout。
	StatsWriter io.Writer
}

Config 客户端一次测试参数。

Source Files

  • client.go
  • client_test_config.go
  • client_test_integration.go
  • udp_stats.go

Jump to

Keyboard shortcuts

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