1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
|
# Configuration
The application is designed to be highly configurable, but to also come 'out of the box' with sensible defaults.
The defaults that have been chosen should cover the vast majority of users, but deployments on low spec hardware (such as a single board computer, or a shared system) should monitor resource usage and adjust as necessary.
Credentials (username and password) for the Soulseek network are the only required configuration, but it is advised to also change the credentials for the web UI.
# Sources
The application supports several different configuration sources in order to make it easy for users to deploy the application in a variety of situations.
The configuration options used by the application are derived from the values specified by each of the sources, with sources higher in the heirarchy overwriting (or sometimes adding to) configuration specified lower in the heirarchy. The heirarchy is:
```
Default Values < Environment Variables < YAML Configuraiton File < Command Line Arguments
```
Some options can be specified as lists. In these cases, care should be taken when combining configuration from multiple sources, as the way the .NET framework overlays configuration from different sources is additive, but it also overwrites, meaning that if a list of `one;two;three` is defined in an environment variable for an option, and the YAML configuration specifies a list of `foo` and `bar`, the resulting configuration will be a list containing `foo, bar, three`.
## Default Values
Default values for each option (unless the default is `null`) are specified in `Options.cs`. Upon startup these values are copied into the configuration first.
## Environment Variables
Environment variables are loaded after defaults. Each environment variable name is prefixed with `SLSKD_` (this prefix is omitted for the remainder of this documentation).
Environment variables are ideal for use cases involving Docker where remote configuration will be disabled, and where configuration is not expected to change often.
Some options are backed by arrays or lists and allow multiple options to be set via a single environment variable. To achieve this, separate each list item by a semicolon `;` in the value:
```
SLSKD_SOME_OPTION=1;2;3
```
## YAML Configuration File
Configuration is loaded from the YAML file located at `<application directory>/slskd.yml` after environment variables. The location can be changed by specifying the path in the `CONFIG` environment variable or `--config` command line argument.
The application watches for changes in the YAML file and will reload configuration when they are detected. Options will be updated in real time and transmitted to the web UI. If a server reconnect or application restart is required for changes to fully take effect, a flag will be set indicating so.
The YAML file can be read and written at run time via API calls, or can be edited on disk.
If no such configuraiton file exists at startup, the example file `/config/slskd.example.yml` is copied to this location for convenience.
YAML configuration should be used in most cases.
## Command Line Arguments
Command line arguments are loaded last, override all other configuration options, and are immutable at run time.
Command line arguments are useful for security options, such as remote configuration, HTTPS JWT secret and certificate. Choosing this source for sensitive options can prevent a remote attacker from gaining full control over the application.
Some options are backed by arrays or lists and allow multiple options to be set via command line. To achieve this, repeat the command line argument:
```
--some-option 1 --some-option 2 --some-option 3
```
# Remote Configuration
The application contains APIs for retrieving and updating the YAML configuration file. By default, this option is disabled. Applications that will be run within untrusted networks, especially those where the application is internet-facing, should consider the risks of enabling this option.
If an attacker were to gain access to the application and retrieve the YAML file, any secrets contained within it will be exposed.
|Command Line|Environment Variable|Description|
|----|-----|-----------|
|`--remote-configuration`|`REMOTE_CONFIGURATION`|Determines whether remote configuration of options is allowed|
#### **YAML**
```yaml
remote_configuration: false
```
# Application Directory Configuration
The application directory configuration option determines the location of the YAML file, the default locations of the download and incomplete directories, and the location of application working data, such as logs and SQLite databases.
Because the location of the YAML file is derived from this value, it can't be specified within the YAML file and must instead be specified with the `APP_DIR` environment variable or `--app-dir` command line argument.
If no value is specified, the location defaults to either `~/.local/share/slskd` (on Linux and macOS) or `%localappdata%/slskd` (on Windows).
Within the official Docker image, this value is set to `/app`.
# Other Directory Configuration
## Incomplete and Downloads
By default, incomplete and downloaded files are saved in `APP_DIR/incomplete` and `APP_DIR/downloads`, respectively. The application will create these directories on startup if they don't exist.
Alternative locations can be specified for each directory. Directories must exist and must be writable by the application; the application will not attempt create them.
|Command Line|Environment Variable|Description|
|----|-----|-----------|
|`-o\|--downloads`|`DOWNLOADS_DIR`|The path where downloaded files are saved|
|`--incomplete`|`INCOMPLETE_DIR`|The path where incomplete downloads are saved|
#### **YAML**
```yaml
directories:
incomplete: ~
downloads: ~
```
## Shares
Any number of shared directories can be configured.
Paths must be absolute, meaning they must begin with `/`, `X:\`, or `\\`, depending on the system. Relative paths, such as `~/directory` or `../directory`, and root paths (e.g. an entire drive, mount or network share) are not supported.
Shares can be excluded by prefixing them with `-` or `!`. This is useful in situations where sharing a subdirectory of a share isn't desired, for example, if a user wanted to share their entire music library, but not their personal recordings:
```yaml
directories:
shared:
- 'D:\Music'
- '!D:\Music\Personal Recordings`
```
Shares can be aliased to improve privacy (for example, if a username is present in the path). A share alias can be specified by prefixing the share with the alias in square brackets, for example:
```yaml
directories:
shared:
- '[Music]\users\John Doe\Music'
```
To a remote user, any files within the aliased path will appear as though they are shared from a directory named as the alias.
Aliases:
* Must be unique
* Must be at least 1 character in length
* Must not contain path separators (`\` or `/`)
|Command Line|Environment Variable|Description|
|----|-----|-----------|
|`-s\|--shared`|`SHARED_DIR`|The list of paths to shared files|
#### **YAML**
```yaml
directories:
shared:
- ~
```
# Soulseek Configuration
The Soulseek configuration determines how slskd will interact with the Soulseek network and underlying [Soulseek.NET](https://github.com/jpdillingham/Soulseek.NET) library.
## Username and Password
The credentials used to log in to the Soulseek network.
Changing either of these values requires the server connection to be reset.
The password field is not included when serializing options to Json or YAML to avoid inadvertently exposing the value.
|Command Line|Environment Variable|Description|
|----|-----|-----------|
|`--slsk-username`|`SLSK_USERNAME`|The username for the Soulseek network|
|`--slsk-password`|`SLSK_PASSWORD`|The password for the Soulseek network|
#### **YAML**
```yaml
soulseek:
username: <username>
password: <password>
```
## Distributed Network
Options for the Soulseek distributed network, which is how search requests are delivered.
The distributed network should only be disabled if no files are being shared.
Child connections should generally only be disabled on low spec systems or situations where network bandwidth is scarce. Received search requests are re-broadcast to each child connection, and incoming requests are numerous. Consider increasing the child limit from the default of 25 on systems with CPU and memory headroom.
Changing these values may require the server connection to be reset, depending on the current state.
|Command Line|Environment Variable|Description|
|----|-----|-----------|
|`--slsk-no-dnet`|`SLSK_NO_DNET`|Determines whether the distributed network is disabled. If disabled, the client will not obtain a parent or any child connections, and will not receive distributed search requests.|
|`--slsk-dnet-no-children`|`SLSK_DNET_NO_CHILDREN`|Determines whether to disallow distributed children|
|`--slsk-dnet-children`|`SLSK_DNET_CHILDREN`|The maximum number of distributed children to accept|
#### **YAML**
```yaml
soulseek:
distributed_network:
disabled: false
disable_children: false
child_limit: 25
```
## Listen Port
The port on which the application listens for incoming connections.
As with any other Soulseek client, properly configuring the listen port and port forwarding ensures full connectivity with other clients, including those who have not properly configured a listening port.
Symptoms of a misconfigured listen port include poor search results and inability to browse or retrieve user information for some users.
|Command Line|Environment Variable|Description|
|----|-----|-----------|
|`--slsk-listen-port`|`SLSK_LISTEN_PORT`|The port on which to listen for incoming connections|
#### **YAML**
```yaml
soulseek:
listen_port: 50000
```
## Connection Options
### Timeouts
Timeout options control how long the application waits for connections to connect, and how long connections can be inactive before they are disconnected.
Higher connect timeout values will help ensure that operations (browse, download requests, etc) are successful the first time, but also decrease responsiveness of commands that will ultimately fail.
Inactivity timeouts help the application determine when a distributed parent connection has stopped sending data, and when connections that have delivered search results (and are unlikely to be used further) from remaining open longer than needed. Reducing this timeout can help on low spec systems if port exhaustion is a concern, but may result in the application "hunting" for a distributed parent connection needlessly.
|Command Line|Environment Variable|Description|
|----|-----|-----------|
|`--slsk-connection-timeout`|`SLSK_CONNECTION_TIMEOUT`|The connection timeout value, in milliseconds|
|`--slsk-inactivity-timeout`|`SLSK_INACTIVITY_TIMEOUT`|The connection inactivity value, in milliseconds|
#### **YAML**
```yaml
soulseek:
connection:
timeout:
connect: 10000
inactivity: 15000
```
### Buffers
Buffer options control the internal buffer the application uses to batch socket reads and writes. Actual socket buffer sizes are controlled by the OS (.NET is not great in this department currently, and the behavior of these is not consistent cross-platform).
Larger buffer sizes can improve performance, especially for file transfers, but result in increased memory usage.
The transfer buffer size is used for file transfers (both read and write), and the read and write buffer sizes are used for all other connection types. The transfer buffer size is directly correlated with transfer speed; setting this value much lower than the default will result in slow uploads (which may be a good thing for low spec hardware).
The write queue option is the hard limit for the number of concurrent writes for a connection. This generally only applies to distributed child connections, and prevents a memory leak if the application continues to try and send data after a connection has gone "bad". This value can be set as low as 5 if memory is a constraint, though the default has been tested extensively and should be good for most scenarios, including low spec.
|Command Line|Environment Variable|Description|
|----|-----|-----------|
|`--slsk-read-buffer`|`SLSK_READ_BUFFER`|The connection read buffer size, in bytes|
|`--slsk-write-buffer`|`SLSK_WRITE_BUFFER`|The connection write buffer size, in bytes|
|`--slsk-transfer-buffer`|`SLSK_TRANSFER_BUFFER`|The read/write buffer size for transfers, in bytes|
|`--slsk-write-queue`|`SLSK_WRITE_QUEUE`|The connection write buffer size, in bytes|
#### **YAML**
```yaml
soulseek:
connection:
buffer:
read: 16384
write: 16384
transfer: 262144
write_queue: 250
```
### Proxy
Connections can optionally use a SOCKS5 proxy, with or without username and password authentication.
If the proxy is enabled, an address and port must also be specified.
|Command Line|Environment Variable|Description|
|----|-----|-----------|
|`--slsk-proxy`|`SLSK_PROXY`|Determines whether a proxy is to be used|
|`--slsk-proxy-address`|`SLSK_PROXY_ADDRESS`|The proxy address|
|`--slsk-proxy-port`|`SLSK_PROXY_PORT`|The proxy port|
|`--slsk-proxy-username`|`SLSK_PROXY_USERNAME`|The proxy username, if applicable|
|`--slsk-proxy-password`|`SLSK_PROXY_PASSWORD`|The proxy password, if applicable|
#### **YAML**
```yaml
soulseek:
connection:
proxy:
enabled: false
address: ~
port: ~
username: ~
password: ~
```
## Diagnostic Level
The diagnostic level option is passed to the Soulseek.NET configuration, and determines the level of detail at which the library produces diagnostic messages. This should generally be left set to `Info` or `Warning`, but can be set to `Debug` if more verbose logging is desired.
|Command Line|Environment Variable|Description|
|----|-----|-----------|
|`--slsk-diag-level`|`SLSK_DIAG_LEVEL`|The minimum diagnostic level (None, Warning, Info, Debug)|
#### **YAML**
```yaml
soulseek:
diagnostic_level: Info
```
# Web Configuration
## Basic
The default HTTP listen port is 5000, typical for a .NET application, but can be anything between 1 and 65535.
The url base option allows the application to operate behind a reverse proxy. Setting a base of "slskd" would make the web UI accessible at `http://<host>:<port>/slskd`.
The content path can be used to force the application to serve static web content from a location other than the default (`wwwroot`). The application is designed such that the web UI is decoupled from the rest of the application, and can be swapped for another.
Logging of HTTP requests is disabled by default.
|Command Line|Environment Variable|Description|
|----|-----|-----------|
|`-l\|--http-port`|`HTTP_PORT`|The HTTP listen port|
|`--url-base`|`URL_BASE`|The base url for web requests|
|`--content-path`|`CONTENT_PATH`|The path to static web content|
|`--http-logging`|`HTTP_LOGGING`|Determines whether HTTP requests are to be logged|
#### **YAML**
```yaml
web:
port: 5000
url_base: /
content_path: wwwroot
logging: false
```
## HTTPS
The default HTTPS port is 5001, which again is typical for a .NET application, but can be anything between 1 and 65535.
By default, the application generates a new, self-signed X509 certificate at each startup. If for whatever reason a self-signed certificate isn't sufficient, or if the certificate needs to be shared among systems or applications, a certificate `.pfx` and password can be defined.
The application can produce a self-signed `.pfx` file and random password using the `--generate-cert` command.
|Command Line|Environment Variable|Description|
|----|-----|-----------|
|`-L\|--https-port`|`HTTPS_PORT`|The HTTPS listen port|
|`-f\|--force-https`|`HTTPS_FORCE`|Determines whether HTTP requests are to be redirected to HTTPS|
|`--https-cert-pfx`|`HTTPS_CERT_PFX`|The path to the X509 certificate .pfx file|
|`--https-cert-password`|`HTTPS_CERT_PASSWORD`|The password for the X509 certificate|
#### **YAML**
```yaml
web:
https:
port: 5001
force: false
certificate:
pfx: ~
password: ~
```
## Authentication
Authentication for the web UI (and underlying API) is enabled by default, and the default username and password are both `slskd`. Changing both the username and password during initial configuration are highly recommended.
By default, a random JWT secret key is generated at each start. This is convenient and secure, but it means that restarting the application will invalidate any issued JWTs, causing users to have to sign in again. To avoid this supply a custom secret at least 16 characters in length. Note that the secret can be used to generate valid JWTs for the application, so keep this value secret.
The JWT TTL option determines how long issued JWTs are valid, defaulting to 7 days.
|Command Line|Environment Variable|Description|
|----|-----|-----------|
|`-X\|--no-auth`|`NO_AUTH`|Determines whether authentication is to be disabled|
|`-u\|--username`|`USERNAME`|The username for the web UI|
|`-p\|--password`|`PASSWORD`|The password for the web UI|
|`--jwt-key`|`JWT_KEY`|The secret key used to sign JWTs|
|`--jwt-ttl`|`JWT_TTL`|The TTL (duration) of JWTs, in milliseconds|
#### **YAML**
```yaml
web:
authentication:
disabled: false
username: slskd
password: slskd
jwt:
key: ~
ttl: 604800000
```
# Filters
A number of filters can be configured to control various aspects of how the application interacts with the Soulseek network.
The share filters can be used to prevent certain types of files from being shared. This option is an array that can take any number of filters. Filters must be a valid regular expression; a few examples are included below and in the example configuration included with the application, but the list is empty by default.
|Command Line|Environment Variable|Description|
|----|-----|-----------|
|`--share-filter`|`SHARE_FILTER`|A list of regular expressions used to filter files from shares|
#### **YAML**
```yaml
filters:
share:
- \.ini$
- Thumbs.db$
- \.DS_Store$
```
# Integrations
## FTP
Files can be uploaded to a remote FTP server upon completion. Files are uploaded to the server and remote path specified using the directory and filename with which they were downloaded; the FTP will match the layout of the local disk.
Uploads are attempted up to the maximum configured retry count, and then discarded.
|Command Line|Environment Variable|Description|
|----|-----|-----------|
|`--ftp`|`FTP`|Determines whether FTP integration is enabled|
|`--ftp-address`|`FTP_ADDRESS`|The FTP address|
|`--ftp-port`|`FTP_PORT`|The FTP port|
|`--ftp-username`|`FTP_USERNAME`|The FTP username|
|`--ftp-password`|`FTP_PASSWORD`|The FTP password|
|`--ftp-remote-path`|`FTP_REMOTE_PATH`|The remote path for uploads|
|`--ftp-encryption-mode`|`FTP_ENCRYPTION_MODE`|The FTP encryption mode (none, implicit, explicit, auto)|
|`--ftp-ignore-certificate-errors`|`FTP_IGNORE_CERTIFICATE_ERRORS`|Determines whether to ignore FTP certificate errors|
|`--ftp-overwrite-existing`|`FTP_OVERWRITE_EXISTING`|Determines whether existing files should be overwritten|
|`--ftp-connection-timeout`|`FTP_CONNECTION_TIMEOUT`|The connection timeout value, in milliseconds|
|`--ftp-retry-attempts`|`FTP_RETRY_ATTEMPTS`|The number of times failing uploads will be retried|
#### **YAML**
```yaml
integration:
ftp:
enabled: false
address: ~
port: ~
username: ~
password: ~
remote_path: /
encryption_mode: auto
ignore_certificate_errors: false
overwrite_existing: true
connection_timeout: 5000
retry_attempts: 3
```
## Pushbullet
Pushbullet notifications can be sent when a private message is sent, or when the current user's username is mentioned in a chat room. Notifications are prefixed with a user-definable string to differentiate these notifications from others.
A Pushbullet account must be created, and users must create an API key within the Pushbullet application and configure it through options. Complete documentation for the Pushbullet API, including the latest instructions for obtaining an API key or "Access Token" can be found [here](https://docs.pushbullet.com/).
The Pushbullet integration is one-way, meaning the application has no way of knowing whether a user is active or receiving notifications. To prevent an inappropriate number of notifications from being sent, for example, if a user is carrying on an active conversation, a "cooldown" option is provided to ensure that notifications are sent only after the cooldown has expired. By default, this is every 15 minutes.
Notification API calls are made up to the maximum configured retry count, and then discarded.
|Command Line|Environment Variable|Description|
|----|-----|-----------|
|`--pushbullet`|`PUSHBULLET`|Determines whether Pushbullet integration is enabled|
|`--pushbullet-token`|`PUSHBULLET_TOKEN`|The Pushbullet API access token|
|`--pushbullet-prefix`|`PUSHBULLET_PREFIX`|The prefix for notification titles|
|`--pushbullet-notify-on-pm`|`PUSHBULLET_NOTIFY_ON_PRIVATE_MESSAGE`|Determines whether to send a notification when a private message is received|
|`--pushbullet-notify-on-room-mention`|`PUSHBULLET_NOTIFY_ON_ROOM_MENTION`|Determines whether to send a notification when the current user's name is mentioned in a chat room|
|`--pushbullet-retry-attempts`|`PUSHBULLET_RETRY_ATTEMPTS`|The number of times failing API calls will be retried|
|`--pushbullet-cooldown`|`PUSHBULLET_COOLDOWN_TIME`|The cooldown time for notifications, in milliseconds|
#### **YAML**
```yaml
integration:
pushbullet:
enabled: false
access_token: ~
notification_prefix: "From slskd:"
notify_on_private_message: true
notify_on_room_mention: true
retry_attempts: 3
cooldown_time: 900000
```
# Other Configuration
## Instance Name
The instance name uniquely identifies the running instance of the application. This is primarily useful for structured logging in cases where multiple instances are logging to the same remote source.
|Command Line|Environment Variable|Description|
|----|-----|-----------|
|`-i\|--instance-name`|`INSTANCE_NAME`|The unique name for the running instance|
#### **YAML**
```yaml
instance_name: default
```
## Loggers
The application logs to disk (`/logs` in the application directory) by default. Logs can optionally be forwarded to external services, and the targets can be expanded to any service supported by a [Serilog Sink](https://github.com/serilog/serilog/wiki/Provided-Sinks). Support for targets are added on an as-needed basis, and within reason.
The current list of available targets is:
|Command Line|Environment Variable|Description|
|----|-----|-----------|
|`--loki`|`LOKI`|The URL to a Grafana Loki instance|
#### **YAML**
```yaml
logger:
loki: ~
```
## Features
Several features have been added that aid in the development, debugging and operation of the application, but are generally not of much use to most users.
The application can publish Prometheus metrics to `/metrics` using [prometheus-net](https://github.com/prometheus-net/prometheus-net). This is especially useful for anyone attempting to tune performance characteristics.
The application can publish a Swagger (OpenAPI) definition and host SwaggerUI at `/swagger` using [Swashbuckle](https://github.com/domaindrivendev/Swashbuckle.AspNetCore). This is useful for anyone developing against the application API and/or creating a new web interface.
|Command Line|Environment Variable|Description|
|----|-----|-----------|
|`--prometheus`|`PROMETHEUS`|Determines whether Prometheus metrics are published to `/metrics`|
|`--swagger`|`SWAGGER`|Determines whether Swagger (OpenAPI) definitions and UI should be available at `/swagger`|
#### **YAML**
```yaml
feature:
prometheus: false
swagger: false
```
## Development Flags
A number of additional feature flags are provided to change the runtime behavior of the application, which is useful during development. Available feature flags are:
|Flag|Environment Variable|Description|
|----|-----|-----------|
|`-d\|--debug`|`DEBUG`|Run the application in debug mode. Produces verbose log output.|
|`-n\|--no-logo`|`NO_LOGO`|Don't show the application logo on startup|
|`-x\|--no-start`|`NO_START`|Bootstrap the application, but don't start|
|`--no-connect`|`NO_CONNECT`|Start the application, but don't connect to the server|
|`--no-share-scan`|`NO_SHARE_SCAN`|Don't perform a scan of shared directories on startup|
|`--no-version-check`|`NO_VERSION_CHECK`|Don't perform a version check on startup|
# Commands
The application can be run in "command mode", causing it to execute a command and then quit immediately. Available commands are:
|Command|Description|
|-------|-----------|
|`-v\|--version`|Display the current application version|
|`-h\|--help`|Display available command-line arguments|
|`-e\|--envars`|Display available environment variables|
|`-g\|--generate-cert`|Generate an X509 certificate and password for HTTPS|
|