presets

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultPresets

func DefaultPresets() map[string]Preset

DefaultPresets returns the built-in presets

Types

type Preset

type Preset struct {
	Name                string           `yaml:"name"`
	Type                PresetType       `yaml:"type"`
	PacketSize          RangeInt         `yaml:"packet_size"`           // Packet size in bytes
	PacketsPerSecond    RangeInt         `yaml:"packets_per_sec"`       // PPS rate
	UploadDownloadRatio float64          `yaml:"upload_download_ratio"` // e.g. 0.5 for 1:2
	SessionDuration     RangeDuration    `yaml:"session_duration"`      // Time before switching
	Patterns            []TrafficPattern `yaml:"patterns,omitempty"`    // Specific traffic patterns
}

Preset defines a complete behavior profile for mimicking a service

func DetectPreset

func DetectPreset(domain string) (Preset, error)

DetectPreset attempts to guess the best preset based on the domain name

type PresetType

type PresetType string

PresetType defines the category of the preset

const (
	TypeSocial    PresetType = "social"
	TypeVideo     PresetType = "video"
	TypeMessenger PresetType = "messenger"
	TypeWeb       PresetType = "web"
)

type RangeDuration

type RangeDuration struct {
	Min time.Duration `yaml:"min"`
	Max time.Duration `yaml:"max"`
}

RangeDuration represents a min-max duration range

type RangeInt

type RangeInt struct {
	Min int `yaml:"min"`
	Max int `yaml:"max"`
}

RangeInt represents a min-max integer range

func (RangeInt) String

func (r RangeInt) String() string

type TrafficPattern

type TrafficPattern struct {
	Type     string        `yaml:"type"`     // e.g., "burst", "constant", "idle"
	Duration RangeDuration `yaml:"duration"` // How long this pattern lasts
	Interval RangeDuration `yaml:"interval"` // Time between repetitions
}

TrafficPattern defines a specific behavior within a preset (e.g., "burst")

Jump to

Keyboard shortcuts

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