Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultPresets ¶
DefaultPresets returns the built-in optimized presets
func ValidatePreset ¶ added in v0.3.5
ValidatePreset validates a preset configuration
Types ¶
type CustomPresetRegistry ¶ added in v0.3.5
type CustomPresetRegistry struct {
// contains filtered or unexported fields
}
CustomPresetRegistry holds user-defined custom presets
func NewCustomPresetRegistry ¶ added in v0.3.5
func NewCustomPresetRegistry() *CustomPresetRegistry
NewCustomPresetRegistry creates a new custom preset registry
func (*CustomPresetRegistry) AddPreset ¶ added in v0.3.5
func (r *CustomPresetRegistry) AddPreset(name string, preset Preset)
AddPreset adds a custom preset to the registry
func (*CustomPresetRegistry) GetAllPresets ¶ added in v0.3.5
func (r *CustomPresetRegistry) GetAllPresets() map[string]Preset
GetAllPresets returns all custom presets
type Preset ¶
type Preset struct {
Name string `yaml:"name" json:"name"`
Type PresetType `yaml:"type" json:"type"`
PacketSize RangeInt `yaml:"packet_size" json:"packet_size"` // Packet size in bytes
PacketsPerSecond RangeInt `yaml:"packets_per_sec" json:"packets_per_sec"` // PPS rate
UploadDownloadRatio float64 `yaml:"upload_download_ratio" json:"upload_download_ratio"` // e.g. 0.5 for 1:2
SessionDuration RangeDuration `yaml:"session_duration" json:"session_duration"` // Time before switching
Patterns []TrafficPattern `yaml:"patterns,omitempty" json:"patterns,omitempty"` // Specific traffic patterns
}
Preset defines a complete behavior profile for mimicking a service
func DetectPreset ¶
func DetectPreset(domain string, customRegistry *CustomPresetRegistry) Preset
DetectPreset finds the best preset for a domain Priority: 1) Custom presets by domain, 2) Default presets by domain, 3) web_generic
func DetectPresetByService ¶ added in v0.3.5
func DetectPresetByService(serviceName string, customRegistry *CustomPresetRegistry) Preset
DetectPresetByService detects preset by service 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" TypeGaming PresetType = "gaming" TypeVoIP PresetType = "voip" TypeCustom PresetType = "custom" )
type RangeDuration ¶
type RangeDuration struct {
Min time.Duration `yaml:"min" json:"min"`
Max time.Duration `yaml:"max" json:"max"`
}
RangeDuration represents a min-max duration range
func (RangeDuration) String ¶ added in v0.3.5
func (r RangeDuration) String() string
type RangeInt ¶
RangeInt represents a min-max integer range
func GetOptimalPPS ¶ added in v0.3.5
GetOptimalPPS returns optimal packets per second for a given latency
func GetOptimalPacketSize ¶ added in v0.3.5
GetOptimalPacketSize returns optimal packet size for a given bandwidth
type TrafficPattern ¶
type TrafficPattern struct {
Type string `yaml:"type" json:"type"` // e.g., "burst", "constant", "idle"
Duration RangeDuration `yaml:"duration" json:"duration"` // How long this pattern lasts
Interval RangeDuration `yaml:"interval" json:"interval"` // Time between repetitions
}
TrafficPattern defines a specific behavior within a preset (e.g., "burst")