diff --git a/Protocol-Encryption-Configuration.md b/Protocol-Encryption-Configuration.md new file mode 100644 index 0000000..edbe1dc --- /dev/null +++ b/Protocol-Encryption-Configuration.md @@ -0,0 +1,68 @@ +Overview of Commands +-------------------- + +The encryption policy applies separately to handshake and (full) message stream behavior, and applies the same policy to both incoming and outgoing connections. + +| Command | Description | +| :--- | :--- | +| `protocol.encryption` | Returns the current handshake and stream encryption settings. | +| `protocol.encryption.set` | Configures global encryption policies using legacy or unified strings. | +| `protocol.encryption.handshake` | Returns the current handshake encryption settings. | +| `protocol.encryption.stream` | Returns the current handshake encryption settings. | + +--- + +## Configuration Methods + +You can configure encryption in rTorrent using either a **unified command** or by configuring the **handshake and stream behaviors individually**. + +Default is `allow`, which defaults to plaintext while allowing encrypted handshake and message stream + +```libtorrent +protocol.encryption.set = +``` + +*Or with explicit sub-settings:* + +```libtorrent +protocol.encryption.set = handshake_, stream_ +``` + + +#### Available Policies + +* **`deny`**: Disables encryption. +* **`allow`**: Allows encrypted connections if initiated by the peer, but prefers unencrypted. +* **`prefer`**: Attempts to use encryption by default, but falls back to unencrypted if the peer does not support it. +* **`require`**: Forcefully requires encryption. Connections with peers that do not support encryption will be dropped. + +--- + + +## Configuration Examples + +Add these to your `~/.rtorrent.rc` configuration file. + +### Example 1: Standard Encryption (Highly Compatible) + +This configuration prefers encryption for both handshakes and data streams, but will fall back to plaintext to maintain high peer availability. + +```libtorrent +protocol.encryption.set = prefer +``` + +### Example 2: Strict/Forced Encryption + +This configuration completely disables unencrypted traffic. It will block all incoming and outgoing connections that do not support encryption. + +```libtorrent +protocol.encryption.set = require +``` + +### Example 3: Mixed/Asymmetric Setup + +In this setup, you require an encrypted handshake to establish the connection, but allow the actual message stream to fall back to unencrypted if necessary. + +```libtorrent +protocol.encryption.set = handshake_require, stream_prefer +```