Overview
TurkeyDPI uses TOML configuration files for advanced customization. While ISP presets work for most users, configuration files give you fine-grained control over bypass behavior.Generating a Configuration File
The easiest way to start is by generating an example configuration:- TOML
- JSON
- Stdout
Configuration Structure
A TurkeyDPI configuration file has five main sections:Global Section
Top-level configuration and master switches.enabled
enabled
Type:
booleanDefault: trueDescription: Master switch for the entire engine. Set to false to disable all processing.enable_fragmentation
enable_fragmentation
Type:
booleanDefault: trueDescription: Global toggle for packet fragmentation. When false, no fragmentation occurs regardless of rules.enable_jitter
enable_jitter
Type:
booleanDefault: falseDescription: Enable timing jitter (delays) between fragments. Useful against DPI systems that buffer packets.enable_padding
enable_padding
Type:
booleanDefault: trueDescription: Enable random padding to packets. Makes traffic analysis harder.enable_header_normalization
enable_header_normalization
Type:
booleanDefault: trueDescription: Normalize packet headers (randomize IP ID, etc.) to evade fingerprinting.log_level
log_level
Type:
stringDefault: "info"Options: "trace", "debug", "info", "warn", "error"Description: Logging verbosity level.json_logging
json_logging
Type:
booleanDefault: falseDescription: Output logs in JSON format for machine parsing.Rules Section
Rules define which traffic to transform and how. Rules are evaluated in priority order (highest first).Basic Rule Structure
Rule Fields
name
name
Type:
stringRequired: YesDescription: Human-readable rule identifier.enabled
enabled
Type:
booleanDefault: trueDescription: Enable or disable this rule.priority
priority
Type:
integerDefault: 0Description: Rule priority. Higher numbers are evaluated first.transforms
transforms
Type:
array of stringsRequired: YesOptions: "fragment", "resegment", "padding", "jitter", "decoy"Description: List of transforms to apply when this rule matches.overrides
overrides
Type:
table (key-value pairs)Optional: YesDescription: Per-rule parameter overrides.Match Criteria
Rules match traffic based on these criteria:dst_ports
dst_ports
Type: Example - Multiple ports:
array of integersDescription: Match packets to these destination ports.protocols
protocols
Type:
array of stringsOptions: "tcp", "udp"Description: Match specific protocols.dst_ip
dst_ip
Type:
array of stringsDescription: Match packets to specific IP addresses or CIDR ranges.Example Rules
Limits Section
Resource and safety limits prevent abuse and crashes.max_flows
max_flows
Type:
integerDefault: 10000Description: Maximum concurrent flows (connections) to track.max_queue_size
max_queue_size
Type:
integerDefault: 1000Description: Maximum packets in processing queue.max_memory_mb
max_memory_mb
Type:
integerDefault: 128Description: Maximum memory usage in megabytes.max_jitter_ms
max_jitter_ms
Type:
integerDefault: 500Description: Maximum jitter delay in milliseconds.flow_timeout_secs
flow_timeout_secs
Type:
integerDefault: 120Description: Idle timeout for flows in seconds.log_rate_limit
log_rate_limit
Type:
integerDefault: 100Description: Maximum log messages per second.Transforms Section
Parameters for each transform type.Fragment Transform
Splits packets into smaller fragments.Parameters
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
min_size | integer | 1 | Minimum fragment size in bytes |
max_size | integer | 40 | Maximum fragment size in bytes |
split_at_offset | integer or null | null | Fixed split offset (null = dynamic) |
randomize | boolean | true | Randomize fragment sizes |
Resegment Transform
Resegments TCP streams into different sizes.Parameters
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
segment_size | integer | 16 | Target segment size in bytes |
max_segments | integer | 8 | Maximum segments per packet |
Padding Transform
Adds random padding to packets.Parameters
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
min_bytes | integer | 0 | Minimum padding bytes |
max_bytes | integer | 64 | Maximum padding bytes |
fill_byte | integer or null | null | Fill byte (null = random) |
Jitter Transform
Adds timing delays between fragments.Parameters
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
min_ms | integer | 0 | Minimum delay in milliseconds |
max_ms | integer | 50 | Maximum delay in milliseconds |
Header Transform
Modifies packet headers.Parameters
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
normalize_ttl | boolean | false | Set fixed TTL value |
ttl_value | integer | 64 | TTL value if normalized |
normalize_window | boolean | false | Set fixed TCP window size |
randomize_ip_id | boolean | true | Randomize IP ID field |
Decoy Transform
Sends fake packets with low TTL.Parameters
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
send_before | boolean | false | Send decoy before real packet |
send_after | boolean | false | Send decoy after real packet |
ttl | integer | 1 | TTL for decoy packets |
probability | float | 0.0 | Probability of sending decoys (0.0-1.0) |
Complete Example
Here’s a complete configuration file combining all sections:Using Configuration Files
Reloading Configuration
You can reload configuration without restarting:Configuration reloading applies changes to new connections. Existing connections continue using old settings until they close.
Common Configurations
Minimal Latency
Optimized for speed (works on Türk Telekom):Maximum Bypass
Aggressive configuration for difficult networks:DNS Only
Protect DNS queries without affecting other traffic:Troubleshooting
Configuration validation fails
Error: “Configuration error: …”-
Check TOML syntax:
-
Check for typos:
Common mistakes:
enable = trueinstead ofenabled = trueport = [443]instead ofdst_ports = [443]- Missing quotes:
protocols = [tcp]instead ofprotocols = ["tcp"]
-
Use generated config as base:
Compare with your config.
Rules not matching
If your rules don’t seem to work:- Check rule priority: Higher priority rules are evaluated first.
-
Enable debug logging:
Look for “Rule matched” messages.
-
Simplify match criteria:
Start with just port matching:
Performance issues
If TurkeyDPI is slow:-
Reduce fragment size:
-
Disable jitter:
-
Reduce logging:
Next Steps
Basic Usage
Return to basic CLI usage
ISP Presets
Learn about built-in presets