# Configuration reference TurkeyDPI can read configuration from a TOML or JSON file (selected by file extension). Unknown keys are rejected rather than silently ignored. Generate a starting file with: ```bash turkeydpi gen-config > turkeydpi.toml turkeydpi validate turkeydpi.toml ``` Validation rules: - `limits.max_flows`, `limits.max_queue_size`, `limits.max_memory_mb` must be `> 0`. - `transforms.fragment.min_size` must be `> 0`. - `transforms.fragment.max_size` must be `>= min_size`. - `transforms.jitter.max_ms` must not exceed `limits.max_jitter_ms`. - Every rule must have a non-empty `name` and at least one transform. ## Sections ### global | Key | Type | Default | Description | | --- | --- | --- | --- | | `enabled` | bool | `true` | Master switch. | | `enable_fragmentation` | bool | `true` | Enable fragment transform. | | `enable_jitter` | bool | `false` | Enable jitter transform. | | `log_level` | string | `"info"` | Log level. | | `json_logging` | bool | `false` | Emit JSON logs. | ### rules A list of rules. Each rule has a `name`, `enabled`, `priority`, `match_criteria`, and `transforms`. `transforms` is a list of one or more of: `fragment`, `resegment`, `jitter`. `match_criteria` supports: | Key | Type | Description | | --- | --- | --- | | `dst_ip` | list of strings | Destination IP or CIDR ranges. | | `src_ip` | list of strings | Source IP or CIDR ranges. | | `dst_ports` | list of ints | Destination TCP/UDP ports. | | `src_ports` | list of ints | Source ports. | | `protocols` | list of strings | `tcp`, `udp`, or `icmp`. | | `domains` | list of strings | Hostnames to match. | | `process` | string | Process name (platform-dependent). | ### limits | Key | Type | Default | Description | | --- | --- | --- | --- | | `max_flows` | int | `10000` | Maximum tracked flows. | | `max_queue_size` | int | `1000` | Maximum queue size. | | `max_memory_mb` | int | `128` | Memory budget. | | `max_jitter_ms` | int | `500` | Jitter safety ceiling. | | `flow_timeout_secs` | int | `120` | Flow idle timeout. | | `log_rate_limit` | int | `100` | Log rate limit. | ### transforms.fragment | Key | Type | Default | Description | | --- | --- | --- | --- | | `min_size` | int | `1` | Minimum fragment size. | | `max_size` | int | `40` | Maximum fragment size. | | `split_at_offset` | int or null | `null` | Optional fixed split offset. | | `randomize` | bool | `true` | Randomize split sizes. | ### transforms.resegment | Key | Type | Default | Description | | --- | --- | --- | --- | | `segment_size` | int | `16` | Segment size. | | `max_segments` | int | `8` | Maximum segments. | ### transforms.jitter | Key | Type | Default | Description | | --- | --- | --- | --- | | `min_ms` | int | `0` | Minimum delay in ms. | | `max_ms` | int | `50` | Maximum delay in ms. | ## Example See [config.example.toml](assets/config.example.toml).