aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/slskd.example.yml1
-rw-r--r--src/slskd/Core/Options.cs6
-rw-r--r--src/slskd/Integrations/VPN/Clients/Gluetun.cs26
3 files changed, 31 insertions, 2 deletions
diff --git a/config/slskd.example.yml b/config/slskd.example.yml
index 9be02b85..dcf419c6 100644
--- a/config/slskd.example.yml
+++ b/config/slskd.example.yml
@@ -238,6 +238,7 @@
# polling_interval: 2500
# gluetun:
# url: http://localhost:8000
+# timeout: 1000
# auth: apikey # or basic or none
# api_key: <gluetun API key>
# username: <username if using basic auth>
diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs
index 565cbd4d..08fb1166 100644
--- a/src/slskd/Core/Options.cs
+++ b/src/slskd/Core/Options.cs
@@ -2361,6 +2361,12 @@ namespace slskd
public string Url { get; init; }
/// <summary>
+ /// Gets the timeout for HTTP requests to the Gluetun control server, in milliseconds.
+ /// </summary>
+ [Range(500, 10_000)]
+ public int Timeout { get; init; } = 1000;
+
+ /// <summary>
/// Gets the Gluetun control server authentication method.
/// </summary>
[Enum(typeof(GluetunClientAuthenticationMethod), ignoreCase: true)]
diff --git a/src/slskd/Integrations/VPN/Clients/Gluetun.cs b/src/slskd/Integrations/VPN/Clients/Gluetun.cs
index e9be123f..8c134599 100644
--- a/src/slskd/Integrations/VPN/Clients/Gluetun.cs
+++ b/src/slskd/Integrations/VPN/Clients/Gluetun.cs
@@ -1,4 +1,4 @@
-// <copyright file="GluetunClient.cs" company="slskd Team">
+// <copyright file="Gluetun.cs" company="slskd Team">
// Copyright (c) slskd Team. All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
@@ -28,15 +28,37 @@ using System.Threading.Tasks;
using Serilog;
using static slskd.Options.IntegrationOptions.VpnOptions;
+/// <summary>
+/// Gluetun VPN client authentication methods.
+/// </summary>
public enum GluetunClientAuthenticationMethod
{
+ /// <summary>
+ /// The Gluetun control server allows unauthenticated requests.
+ /// </summary>
None,
+
+ /// <summary>
+ /// The Glueton control server is configured to use HTTP Basic authentication; username and password are required.
+ /// </summary>
Basic,
+
+ /// <summary>
+ /// The Gluetun control server is configured to use API key authentication; apiKey is required.
+ /// </summary>
ApiKey,
}
+/// <summary>
+/// Gluetun VPN client.
+/// </summary>
public class Gluetun : IVPNClient
{
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Gluetun"/> class.
+ /// </summary>
+ /// <param name="httpClientFactory"></param>
+ /// <param name="optionsMonitor"></param>
public Gluetun(IHttpClientFactory httpClientFactory, IOptionsMonitor<Options> optionsMonitor)
{
HttpClientFactory = httpClientFactory;
@@ -56,7 +78,7 @@ public class Gluetun : IVPNClient
{
using var http = HttpClientFactory.CreateClient();
- http.Timeout = TimeSpan.FromMilliseconds(1000);
+ http.Timeout = TimeSpan.FromMilliseconds(Options.Timeout);
if (Options.Auth.Equals(GluetunClientAuthenticationMethod.Basic.ToString(), StringComparison.OrdinalIgnoreCase))
{