Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move away from defaulting to windows, create OS X support #68

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 28 additions & 17 deletions source/Kangaroo/Queries/NetworkQuerierFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,33 @@ public NetworkQuerierFactory(ILogger logger, IQueryPingResults ping, Func<HttpCl
/// <inheritdoc />
public IQueryNetworkNode CreateQuerier()
{
return RuntimeInformation.IsOSPlatform(OSPlatform.Linux)
? new QueryNetworkNode(
logger: _logger,
ping: _ping,
mac: new LinuxQueryMacAddress(_logger),
host: new QueryHostname(_logger),
http: _clientFactory != null
? new QueryWebServer(_logger, _clientFactory)
: null)
: new QueryNetworkNode(
logger: _logger,
ping: _ping,
mac: new WindowsQueryMacAddress(_logger),
host: new QueryHostname(_logger),
http: _clientFactory != null
? new QueryWebServer(_logger, _clientFactory)
: null);

// Linux || Mac
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
return new QueryNetworkNode(
logger: _logger,
ping: _ping,
mac: new LinuxQueryMacAddress(_logger),
host: new QueryHostname(_logger),
http: _clientFactory != null
? new QueryWebServer(_logger, _clientFactory)
: null);
}

// Windows
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return new QueryNetworkNode(
logger: _logger,
ping: _ping,
mac: new WindowsQueryMacAddress(_logger),
host: new QueryHostname(_logger),
http: _clientFactory != null
? new QueryWebServer(_logger, _clientFactory)
: null);
}

throw new PlatformNotSupportedException();
}
}
Loading