aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2023-11-19 11:14:19 -0600
committerGitHub <noreply@github.com>2023-11-19 11:14:19 -0600
commit215c7d8607b2e60256e984108372fcebd6457546 (patch)
tree698e7f51ac7505ceceb5da9aa475d6d559a1565d
parent6280ab0533d8aeff9767ae48af7f01ef483b9b14 (diff)
parentbc835a977728b1cafcee41a94440c17c397f3f3a (diff)
downloadslskd-215c7d8607b2e60256e984108372fcebd6457546.tar.gz
Merge pull request #1001 from slskd/address
Add options for the Soulseek server address and port
-rw-r--r--config/slskd.example.yml2
-rw-r--r--docs/config.md16
-rw-r--r--src/slskd/Application.cs8
-rw-r--r--src/slskd/Core/API/Controllers/ServerController.cs8
-rw-r--r--src/slskd/Core/ConnectionWatchdog.cs9
-rw-r--r--src/slskd/Core/Options.cs19
6 files changed, 59 insertions, 3 deletions
diff --git a/config/slskd.example.yml b/config/slskd.example.yml
index f8fe7b83..db9a9a38 100644
--- a/config/slskd.example.yml
+++ b/config/slskd.example.yml
@@ -136,6 +136,8 @@
# feature:
# swagger: false
# soulseek:
+# address: vps.slsknet.org
+# port: 2271
# username: ~
# password: ~
# description: |
diff --git a/docs/config.md b/docs/config.md
index 7f0394ca..37de6c41 100644
--- a/docs/config.md
+++ b/docs/config.md
@@ -433,6 +433,22 @@ groups:
The Soulseek configuration determines how slskd interacts with the Soulseek network and underlying [Soulseek.NET](https://github.com/jpdillingham/Soulseek.NET) library.
+## Server Connection
+
+By default the application connects to `vps.slsknet.org` on port `2271`. This should work for nearly everyone, but it is possible to override both defaults if necessary.
+
+| Command-Line | Environment Variable | Description |
+| ---------------- | ---------------------| -----------------------------------|
+| `--slsk-address` | `SLSKD_SLSK_ADDRESS` | The address of the Soulseek server |
+| `--slsk-port` | `SLSKD_SLSK_PORT` | The port of the Soulseek server |
+
+#### **YAML**
+```yaml
+soulseek:
+ address: vps.slsknet.org
+ port: 2271
+```
+
## Username and Password
Credentials to log in to the Soulseek network.
diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs
index aca75418..b6d11914 100644
--- a/src/slskd/Application.cs
+++ b/src/slskd/Application.cs
@@ -438,7 +438,13 @@ namespace slskd
}
else
{
- await Client.ConnectAsync(OptionsAtStartup.Soulseek.Username, OptionsAtStartup.Soulseek.Password).ConfigureAwait(false);
+ var opt = OptionsAtStartup.Soulseek;
+
+ await Client.ConnectAsync(
+ address: opt.Address,
+ port: opt.Port,
+ username: opt.Username,
+ password: opt.Password).ConfigureAwait(false);
}
}
}
diff --git a/src/slskd/Core/API/Controllers/ServerController.cs b/src/slskd/Core/API/Controllers/ServerController.cs
index 983fd0a0..0caded00 100644
--- a/src/slskd/Core/API/Controllers/ServerController.cs
+++ b/src/slskd/Core/API/Controllers/ServerController.cs
@@ -67,7 +67,13 @@ namespace slskd.Core.API
if (!Client.State.HasFlag(SoulseekClientStates.Connected))
{
- await Client.ConnectAsync(OptionsSnapshot.Value.Soulseek.Username, OptionsSnapshot.Value.Soulseek.Password);
+ var opt = OptionsSnapshot.Value.Soulseek;
+
+ await Client.ConnectAsync(
+ address: opt.Address,
+ port: opt.Port,
+ username: opt.Username,
+ password: opt.Password);
}
return Ok();
diff --git a/src/slskd/Core/ConnectionWatchdog.cs b/src/slskd/Core/ConnectionWatchdog.cs
index 6a48c0e4..19e2d47c 100644
--- a/src/slskd/Core/ConnectionWatchdog.cs
+++ b/src/slskd/Core/ConnectionWatchdog.cs
@@ -165,7 +165,14 @@ namespace slskd
// reconnect with the latest configuration values we have for username and password, instead of the
// options that were captured at startup. if a user has updated these values prior to the disconnect,
// the changes will take effect now.
- await Client.ConnectAsync(Options.CurrentValue.Soulseek.Username, Options.CurrentValue.Soulseek.Password);
+ var opt = Options.CurrentValue.Soulseek;
+
+ await Client.ConnectAsync(
+ address: opt.Address,
+ port: opt.Port,
+ username: opt.Username,
+ password: opt.Password);
+
break;
}
catch (Exception ex)
diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs
index 62334742..1d4742da 100644
--- a/src/slskd/Core/Options.cs
+++ b/src/slskd/Core/Options.cs
@@ -1249,6 +1249,25 @@ namespace slskd
public class SoulseekOptions
{
/// <summary>
+ /// Gets the address of the Soulseek server.
+ /// </summary>
+ [Argument(default, "slsk-address")]
+ [EnvironmentVariable("SLSK_ADDRESS")]
+ [Description("address of the Soulseek server")]
+ [RequiresReconnect]
+ public string Address { get; init; } = "vps.slsknet.org";
+
+ /// <summary>
+ /// Gets the port of the Soulseek server.
+ /// </summary>
+ [Argument(default, "slsk-port")]
+ [EnvironmentVariable("SLSK_PORT")]
+ [Description("port of the Soulseek server")]
+ [RequiresReconnect]
+ [Range(1024, 65535)]
+ public int Port { get; init; } = 2271;
+
+ /// <summary>
/// Gets the username for the Soulseek network.
/// </summary>
[Argument(default, "slsk-username")]