diff options
| author | JP Dillingham <jpdillingham@gmail.com> | 2023-01-08 13:29:32 -0600 |
|---|---|---|
| committer | JP Dillingham <jpdillingham@gmail.com> | 2023-01-08 13:29:32 -0600 |
| commit | 9bb9c17312742adb65b37fe84bd64e7267defcd8 (patch) | |
| tree | e7be04bc495ab9a80f746d36db536083945f508e | |
| parent | ef7112e8ed423041f1f0f15343c856bae73e3e38 (diff) | |
| download | slskd-9bb9c17312742adb65b37fe84bd64e7267defcd8.tar.gz | |
finish relay docs
| -rw-r--r-- | docs/relay.md | 77 |
1 files changed, 69 insertions, 8 deletions
diff --git a/docs/relay.md b/docs/relay.md index 89f5bb3c..04e5915f 100644 --- a/docs/relay.md +++ b/docs/relay.md @@ -72,17 +72,19 @@ For this example we'll use `9tWy5c3NrmekKVWLQXBztz0hY7rNGlj1tGMfvHKmU1q` for the ### Controller -Next, we'll configure the controller. We'll enable the Relay, set this instance's mode to `controller`, and configure a single agent named `example_agent`. We'll accept connections from within our home network, which uses IP addresses in the 192.168.1.x range. +Next, we'll configure the controller. We'll enable the Relay, set this instance's mode to `controller`, and configure a single agent named `example`. We'll accept connections from within our home network, which uses IP addresses in the 192.168.1.x range. We'll also need to create an API key, which we'll allow to be used from anywhere. We'll give the key the role `readwrite`, which is required for agents. +Here's the entire `slskd.yml` file; feel free to copy and paste it over the contents of your file if you're following along (just replace the Soulseek credentials with your own): + ```yaml instance_name: controller relay: enabled: true mode: controller agents: - example_agent: + example: secret: BgI04SuVtsAYipxPHDpdxJsnVoPEeq4tKJeorWxr3Pj cidr: 192.168.1.0/24 web: @@ -92,9 +94,12 @@ web: key: 9tWy5c3NrmekKVWLQXBztz0hY7rNGlj1tGMfvHKmU1q role: readwrite cidr: 192.168.1.0/24 +soulseek: + username: <your username> + password: <your password> ``` -We'll start the agent, which is running on a machine with IP address 192.168.1.25. We should see the following logs (among many others): +We'll start the controller instance, which, in my case, is running on a machine with IP address `192.168.1.241`. We should see the following logs (among many others): ``` [16:15:48 INF] Running in Controller relay mode. Listening for incoming Agent connections. @@ -108,21 +113,77 @@ The controller is running on a machine with IP address 192.168.1.53, and we want We'll copy the API key and secret from the controller config, and lastly, we want the agent to receive the files downloaded by the controller, so we'll set `downloads` to `true`. +Agents must also set their instance name to the corresponding agent name in the controller. We configured `example` above, so this instance needs to be named `example`, as well. + +To demonstrate how file relays work, I've created a file `foo.txt` in `~/Music/test`, and I'll configure that directory as a share (`/home/kubuntu/Music` in my case). + +The entire `slskd.yml` file is below if you'd like to copy/paste it. Be sure to update the controller's address to the IP address of the machine the controller is working on. + ```yaml -instance_name: example_agent +instance_name: example relay: enabled: true mode: agent controller: - address: https://192.168.1.25:5001 + address: https://192.168.1.241:5001 ignore_certificate_errors: true api_key: 9tWy5c3NrmekKVWLQXBztz0hY7rNGlj1tGMfvHKmU1q secret: BgI04SuVtsAYipxPHDpdxJsnVoPEeq4tKJeorWxr3Pj downloads: true +shares: + directories: + - /home/kubuntu/Music ``` -We'll start the agent and confirm that it connects to the controller and uploads its shares: +We'll start the agent and confirm that it connects to the controller and uploads its shares (only pertinent logs shown): -```bash -<todo: paste here> ``` +[18:50:08 INF] Running in Agent relay mode; not connecting to the Soulseek server. +[18:50:08 INF] Attempting to connect to the relay controller https://192.168.1.241:5001 +[18:50:09 INF] Relay controller connection established. Awaiting authentication... +[18:50:09 INF] Authenticated. Uploading shares... +[18:50:09 INF] Beginning upload of shares (48.0 KB) +[18:50:10 INF] Upload of shares succeeded (48.0 KB in 136ms) +[18:50:10 INF] Shares uploaded. Ready to upload files. +``` + +The controller should show logs similar to the following: + +``` +[19:09:30 INF] Agent connection GyBMnXHfdomNzR2FEzT68Q from 192.168.1.250 established. Sending authentication challenge GU7pSFTG60skUtqM24FfB2WiUnWsC1LxYagBsz7edcp... +[19:09:30 INF] Agent connection GyBMnXHfdomNzR2FEzT68Q from 192.168.1.250 authenticated as agent example +[19:09:31 INF] Agent example (connection GyBMnXHfdomNzR2FEzT68Q) from 192.168.1.250 requested share upload token f81eb299-1a86-4f72-a77c-922d3f73106f +[19:09:31 INF] Handling share upload (f81eb299-1a86-4f72-a77c-922d3f73106f) from a caller claiming to be agent example +[19:09:31 INF] Agent example authenticated for token f81eb299-1a86-4f72-a77c-922d3f73106f. Beginning download of shares to /tmp/slskd/share_example_h0ycner1.svm.db +[19:09:31 INF] Download of shares from example (f81eb299-1a86-4f72-a77c-922d3f73106f) complete (48.0 KB in 2ms) +[19:09:31 INF] Loading shares from agent example +[19:09:31 INF] Warming browse response cache... +[19:09:31 INF] Shares from agent example ready. +[19:09:31 INF] Browse response cached successfully in 25ms +``` + +We're now ready to relay files! + +### Testing + +From another machine running a different Soulseek client, download the `foo.txt` file we shared as a test. The controller should show logs similar to the following: + +``` +[19:19:34 INF] Resolved Music\test\foo.txt to physical file /home/kubuntu/Music/test/foo.txt on host 'example' +[19:19:35 INF] Requested file Music\test\foo.txt from Agent example with ID 09e76dde-c4fa-4c50-8c25-d92a26b52102. Waiting for incoming connection. +[19:19:35 INF] Handling file upload of Music\test\foo.txt (09e76dde-c4fa-4c50-8c25-d92a26b52102) from a caller claiming to be agent example +[19:19:35 INF] Agent example authenticated for token 09e76dde-c4fa-4c50-8c25-d92a26b52102. Forwarding file stream for Music\test\foo.txt +[19:19:35 INF] Agent example provided file stream for file Music\test\foo.txt with ID 09e76dde-c4fa-4c50-8c25-d92a26b52102 +[19:19:35 INF] File upload of Music\test\foo.txt (09e76dde-c4fa-4c50-8c25-d92a26b52102) from agent example complete +``` + +And the agent should show: + +``` +[19:19:34 INF] Relay controller requested file info for Music\test\foo.txt with ID 468a42b3-e0ce-4562-850a-75dea2fd5701 +[19:19:35 INF] Relay controller requested file Music\test\foo.txt with ID 09e76dde-c4fa-4c50-8c25-d92a26b52102 +[19:19:35 INF] Beginning upload of file Music\test\foo.txt with ID 09e76dde-c4fa-4c50-8c25-d92a26b52102 +[19:19:35 INF] Upload of file Music\test\foo.txt with ID 09e76dde-c4fa-4c50-8c25-d92a26b52102 succeeded. +``` + +If the download completes and you see logs in the controller and agent that look similar to what's shown here, everything is working!
\ No newline at end of file |
