diff options
| author | JP Dillingham <jp@dillingham.me> | 2022-11-14 21:09:45 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-14 21:09:45 -0600 |
| commit | 3d0af40b9e85ee4dc07665ffdf16449a873a0640 (patch) | |
| tree | 2761ad1c85408c1524be6d4dd6e0e4ee45b77ec7 /src/slskd/Core | |
| parent | 5f2923973dc2fa5b65a602c3f30cf7c5448eda0a (diff) | |
| parent | 75e7d6accd92a07ae13c7eff16893cf577af255b (diff) | |
| download | slskd-3d0af40b9e85ee4dc07665ffdf16449a873a0640.tar.gz | |
Merge pull request #753 from slskd/relay
Rename 'Network' functionality to 'Relay'
Diffstat (limited to 'src/slskd/Core')
| -rw-r--r-- | src/slskd/Core/Options.cs | 36 | ||||
| -rw-r--r-- | src/slskd/Core/State.cs | 12 |
2 files changed, 24 insertions, 24 deletions
diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index a64d5875..3a61e376 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -32,7 +32,7 @@ namespace slskd using slskd.Authentication; using slskd.Configuration; using slskd.Cryptography; - using slskd.Network; + using slskd.Relay; using slskd.Shares; using slskd.Validation; using Soulseek.Diagnostics; @@ -196,10 +196,10 @@ namespace slskd public string ConfigurationFile { get; init; } = Program.DefaultConfigurationFile; /// <summary> - /// Gets network options. + /// Gets relay options. /// </summary> [Validate] - public NetworkOptions Network { get; init; } = new NetworkOptions(); + public RelayOptions Relay { get; init; } = new RelayOptions(); /// <summary> /// Gets directory options. @@ -288,9 +288,9 @@ namespace slskd { var results = new List<ValidationResult>(); - if (InstanceName == "local" && Network.Mode.ToEnum<OperationMode>() == OperationMode.Agent) + if (InstanceName == "local" && Relay.Mode.ToEnum<OperationMode>() == OperationMode.Agent) { - results.Add(new ValidationResult("Instance name must be something other than 'local' when operating in Network Agent mode")); + results.Add(new ValidationResult("Instance name must be something other than 'local' when operating in Relay Agent mode")); } return results; @@ -384,29 +384,29 @@ namespace slskd } /// <summary> - /// Network options. + /// Relay options. /// </summary> - public class NetworkOptions : IValidatableObject + public class RelayOptions : IValidatableObject { /// <summary> /// Gets the application operation mode. /// </summary> - [Argument('m', "network-operation-mode")] - [EnvironmentVariable("NETWORK_OPERATION_MODE")] - [Description("network operation mode; controller, agent")] + [Argument('m', "relay-operation-mode")] + [EnvironmentVariable("RELAY_OPERATION_MODE")] + [Description("relay operation mode; controller, agent")] [RequiresRestart] [Enum(typeof(OperationMode))] - public string Mode { get; init; } = slskd.Network.OperationMode.Controller.ToString().ToLowerInvariant(); + public string Mode { get; init; } = slskd.Relay.OperationMode.Controller.ToString().ToLowerInvariant(); /// <summary> /// Gets the controller configuration. /// </summary> - public NetworkControllerConfigurationOptions Controller { get; init; } = new NetworkControllerConfigurationOptions(); + public RelayControllerConfigurationOptions Controller { get; init; } = new RelayControllerConfigurationOptions(); /// <summary> /// Gets the agent configuration. /// </summary> - public Dictionary<string, NetworkAgentConfigurationOptions> Agents { get; init; } = new(); + public Dictionary<string, RelayAgentConfigurationOptions> Agents { get; init; } = new(); public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) { @@ -414,7 +414,7 @@ namespace slskd var results = new List<ValidationResult>(); var modeResults = new List<ValidationResult>(); - if (mode == slskd.Network.OperationMode.Agent && !Validator.TryValidateObject(Controller, new ValidationContext(Controller), modeResults, validateAllProperties: true)) + if (mode == slskd.Relay.OperationMode.Agent && !Validator.TryValidateObject(Controller, new ValidationContext(Controller), modeResults, validateAllProperties: true)) { results.Add(new CompositeValidationResult("Controller", modeResults)); } @@ -439,9 +439,9 @@ namespace slskd } /// <summary> - /// Network controller configuration options. + /// Relay controller configuration options. /// </summary> - public class NetworkControllerConfigurationOptions + public class RelayControllerConfigurationOptions { /// <summary> /// Gets the controller address. @@ -485,9 +485,9 @@ namespace slskd } /// <summary> - /// Network agent configuration options. + /// Relay agent configuration options. /// </summary> - public class NetworkAgentConfigurationOptions + public class RelayAgentConfigurationOptions { /// <summary> /// Gets the agent secret. diff --git a/src/slskd/Core/State.cs b/src/slskd/Core/State.cs index df670893..76253501 100644 --- a/src/slskd/Core/State.cs +++ b/src/slskd/Core/State.cs @@ -22,7 +22,7 @@ namespace slskd using System.Linq; using System.Net; using System.Text.Json.Serialization; - using slskd.Network; + using slskd.Relay; using slskd.Users; using Soulseek; @@ -35,7 +35,7 @@ namespace slskd public bool PendingReconnect { get; init; } public bool PendingRestart { get; init; } public ServerState Server { get; init; } = new ServerState(); - public NetworkState Network { get; init; } = new NetworkState(); + public RelayState Relay { get; init; } = new RelayState(); public UserState User { get; init; } = new UserState(); public DistributedNetworkState DistributedNetwork { get; init; } = new DistributedNetworkState(); public ShareState Shares { get; init; } = new ShareState(); @@ -65,17 +65,17 @@ namespace slskd public bool IsTransitioning => State.HasFlag(SoulseekClientStates.Connecting) || State.HasFlag(SoulseekClientStates.Disconnecting) || State.HasFlag(SoulseekClientStates.LoggingIn); } - public record NetworkState + public record RelayState { public OperationMode Mode { get; init; } - public NetworkControllerState Controller { get; init; } = new NetworkControllerState(); + public RelayControllerState Controller { get; init; } = new RelayControllerState(); public IReadOnlyCollection<Agent> Agents { get; init; } = Enumerable.Empty<Agent>().ToList().AsReadOnly(); } - public record NetworkControllerState + public record RelayControllerState { public string Address { get; init; } - public NetworkClientState State { get; init; } = NetworkClientState.Disconnected; + public RelayClientState State { get; init; } = RelayClientState.Disconnected; } public record UserState |
