From 5f27e0fe10b75440864057f1006cb93ba9eb01cd Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 1 Feb 2026 14:08:29 -0600 Subject: add vpn stuff --- src/slskd/Common/Exceptions/VPNClientException.cs | 60 +++++++++++++++++++++++ src/slskd/Integrations/VPN/IVPNClient.cs | 38 ++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 src/slskd/Common/Exceptions/VPNClientException.cs create mode 100644 src/slskd/Integrations/VPN/IVPNClient.cs (limited to 'src') diff --git a/src/slskd/Common/Exceptions/VPNClientException.cs b/src/slskd/Common/Exceptions/VPNClientException.cs new file mode 100644 index 00000000..d7e505d7 --- /dev/null +++ b/src/slskd/Common/Exceptions/VPNClientException.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) slskd Team. All rights reserved. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published +// by the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see https://www.gnu.org/licenses/. +// + +namespace slskd +{ + using System; + using System.Diagnostics.CodeAnalysis; + + /// + /// Represents errors that originate from slskd logic. + /// + [ExcludeFromCodeCoverage] + public class VPNClientException : Exception + { + /// + /// Initializes a new instance of the class. + /// + public VPNClientException() + : base() + { + } + + /// + /// Initializes a new instance of the class with a specified error message. + /// + /// The message that describes the error. + public VPNClientException(string message) + : base(message) + { + } + + /// + /// Initializes a new instance of the class with a specified error message and a + /// reference to the inner exception that is the cause of this exception. + /// + /// The message that describes the error. + /// + /// The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no + /// inner exception is specified. + /// + public VPNClientException(string message, Exception innerException) + : base(message, innerException) + { + } + } +} \ No newline at end of file diff --git a/src/slskd/Integrations/VPN/IVPNClient.cs b/src/slskd/Integrations/VPN/IVPNClient.cs new file mode 100644 index 00000000..5a111ccd --- /dev/null +++ b/src/slskd/Integrations/VPN/IVPNClient.cs @@ -0,0 +1,38 @@ +// +// Copyright (c) slskd Team. All rights reserved. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published +// by the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see https://www.gnu.org/licenses/. +// + +using System.Threading.Tasks; + +namespace slskd.Integrations.VPN; + +/// +/// A lightweight interface for monitoring the status of a VPN provider. +/// +public interface IVPNClient +{ + /// + /// Fetch the VPN connection status from the provider. + /// + /// A value indicating whether the VPN is connected. + public Task GetConnectionStatusAsync(); + + /// + /// Fetch the forwarded port configured with the provider, if enabled. + /// + /// The forwarded port. + public Task GetForwardedPortAsync(); +} \ No newline at end of file -- cgit v1.2.3