You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.3 KiB
32 lines
1.3 KiB
using Connected.Configuration;
|
|
using Connected.Net.Endpoints;
|
|
|
|
namespace Connected.Net.Server;
|
|
|
|
/// <summary>
|
|
/// Contains information about the currently active endpoint server. There is only one endpoint server at one point in the environment.
|
|
/// In the case of a single instance environment the <see cref="EndpointServerDescriptor"/> points to this instance.
|
|
/// </summary>
|
|
internal class EndpointServerDescriptor
|
|
{
|
|
/// <summary>
|
|
/// Create a new instance of the <see cref="EndpointServerDescriptor"/>
|
|
/// </summary>
|
|
/// <param name="endpoint">The currently server. Could be null if there are no endpoints defined.</param>
|
|
/// <param name="configurationService"></param>
|
|
public EndpointServerDescriptor(IEndpoint? endpoint, IConfigurationService configurationService)
|
|
{
|
|
Endpoint = endpoint;
|
|
IsRemote = Endpoint is not null && !string.Equals(configurationService.Endpoint.Address, Endpoint.Address, StringComparison.OrdinalIgnoreCase);
|
|
}
|
|
/// <summary>
|
|
/// The Endpoint information about the server. This could point to this instance or can be null which also means
|
|
/// this instance is an <see cref="EndpointServerDescriptor"/>.
|
|
/// </summary>
|
|
public IEndpoint? Endpoint { get; }
|
|
/// <summary>
|
|
/// Returns <code>true</code> if the Endpoint server is not this instance.
|
|
/// </summary>
|
|
public bool IsRemote { get; }
|
|
}
|