Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
9aaa701
Feature: Ping Monitor TCP check (TCP ping)
Nov 29, 2026
46d3191
Docs: Ping Monitor TCP check
Nov 29, 2026
5688d22
Ping Monitor: fixes from the code review
Nov 29, 2026
22c875f
Ping Monitor / Port Scanner: a host from the history gets its last pr…
Nov 29, 2026
9882ffe
Docs: host history restores protocol / port (Ping Monitor) and ports …
Nov 29, 2026
cd368f4
Ping Monitor / Port Scanner: fixes from the second code review
Nov 29, 2026
437a1fe
Docs: Ping Monitor ICMP and TCP in the intro / info block, shorter, f…
Nov 29, 2026
5d5f833
Run command: protocol of the Ping Monitor below the input
Nov 29, 2026
e60e009
Ping Monitor / Port Scanner: fixes from the third code review
Nov 29, 2026
c8b0901
Ping Monitor: fixes from the fourth code review
Nov 29, 2026
4fae3f5
Ping Monitor: fixes from the fifth code review
Nov 29, 2026
cc50bad
Merge branch 'main' of https://github.com/BornToBeRoot/NETworkManager…
BornToBeRoot Nov 29, 2026
550f203
Docs: Changelog: PR link for the Ping Monitor TCP check and the Port …
Nov 29, 2026
3ddb874
Ping Monitor: Group dialog: Ping Monitor below the Port Scanner
Nov 29, 2026
9d26f4e
Port Scanner: A new tab starts with the last scanned ports
Nov 29, 2026
3ae41c2
Ping Monitor: Profile / group dialog: Port indented below the protoco…
Nov 29, 2026
43acaa4
Docs: Changelog: Shorter entries for the next release
Nov 29, 2026
5cd6e4c
Port Scanner / Ping Monitor: fixes from the final code review
Nov 29, 2026
1b66c31
Merge branch 'main' into feature/ping-monitor-tcp
Nov 29, 2026
2486bf1
Docs: Conventions: Helpers of the TCP check, shorter changelog entries
Nov 29, 2026
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
15 changes: 12 additions & 3 deletions .claude/skills/feature-review/references/conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ Reference: `PortScannerViewModel`, `IPScannerViewModel`.
- Inputs are added to a history (`ListHelper.Modify`, limited by
`GlobalStaticConfiguration.General_HistoryListEntries`). An editable `ComboBox` also selects a history entry that
matches the typed text: extra values restored from the history (e.g. ports of a host) are only applied when the entry
was picked from the list (click, or arrow keys + `Enter`), not on `SelectionChanged` alone.
was picked from the list (click, or arrow keys + `Enter`; `ComboBoxPickHelper.OnItemPicked`), not on `SelectionChanged`
alone. Reference: Ping Monitor (protocol + port), Port Scanner (ports) with `HostHistoryOptions`.
- Very large inputs (e.g. a `/16`) need a confirmation above a threshold and are refused above a limit, with a message,
instead of freezing the application (reference: Ping Monitor, 256 / 4,096 hosts).
- Continuous actions (Ping Monitor, auto refresh, live widgets) run as async loops, not one blocked thread per item. A
Expand Down Expand Up @@ -270,11 +271,19 @@ Duplicated code often re-implements one of these. A refactoring proposal should
adds a new helper. Check the class for the exact methods.

- Host and port input: `HostRangeHelper` (Models: `CreateListFromInput`, `GetHostCount`, `ResolveAsync` with `!`
exclusions - IP Scanner, Port Scanner, Ping Monitor), `PortRangeHelper` (Utilities), validators in
exclusions - IP Scanner, Port Scanner, Ping Monitor), `PortRangeHelper` (Utilities), `PingMonitorPortProfile` (Models:
one port as `443/tcp`, parse, resolve a port profile, `Encode` / `Decode` of the reference), validators in
`NETworkManager.Validators` (one per input format, used by tool, profile dialog and run command).
- Input drop-downs: `InputSuggestions` (history + profiles of the settings in one grouped list, `Tab` completion, e.g.
`ForPortScannerPorts`, `ForPingMonitorPort`, `ForDNSLookupDNSServers`).
- History: `ListHelper.Modify` (the list), `HostHistoryOptions` (Utilities: `Set` / `Find` / `Prune` the values a host
of the history was last used with; pruned in `SettingsManager.Save`), `ComboBoxPickHelper` (Utilities.WPF: an entry
picked from the list, not typed text).
- Notifications: `NotificationManager` (`FormatChanges`: one notification for several changes, `(+N more)`) with
`NotificationLine` (`JoinText`, `FormatHost`). Reference: Ping Monitor, IP Scanner, Port Scanner.
- Addresses and names: `IPAddressHelper` (compare / sort, private range, scope id), `MACAddressHelper` (format,
compare), `DNSClientHelper` / `DNSClient` (resolve A / AAAA / PTR with the app's DNS settings), `RegexHelper`.
- Lists and texts: `ListHelper.Modify` (history), `PlaceholderHelper` (`{{Name}}` placeholders), `DateTimeHelper`,
- Lists and texts: `PlaceholderHelper` (`{{Name}}` placeholders), `DateTimeHelper`,
`ClipboardHelper`, `DialogHelper` (confirmations, `FormatItemList`).
- WPF: `BindingProxy`, `DataGridHelper`, `SearchTextBoxHelper`, `PermissionToolTipHelper` (Utilities.WPF),
`ObservableRangeCollection` (Controls), converters in `NETworkManager.Converters` (e.g. `PendingToStringConverter`),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System;
using System.Globalization;
using System.Windows.Data;
using NETworkManager.Profiles;
using PingMonitorProfile = NETworkManager.Profiles.Application.PingMonitor;

namespace NETworkManager.Converters;

/// <summary>
/// Converts a <see cref="ProfileInfo" /> to its check in the Ping Monitor ("icmp", "22/tcp", "HTTPS · 443/tcp"),
/// null if the profile and its group don't override the protocol (tooltip of the profile).
/// </summary>
public sealed class PingMonitorProfileCheckConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is not ProfileInfo profile)
return null;

try
{
return PingMonitorProfile.GetCheckText(profile);
}
catch (Exception)
{
// Only a tooltip (e.g. the profile file is being switched)
return null;
}
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
40 changes: 38 additions & 2 deletions Source/NETworkManager.Localization/Resources/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions Source/NETworkManager.Localization/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1586,6 +1586,9 @@ Profile files are not affected!</value>
<data name="EnterValidOID" xml:space="preserve">
<value>Enter a valid OID!</value>
</data>
<data name="EnterValidPortOrPortProfile" xml:space="preserve">
<value>Enter a valid port (1 - 65535) or port profile!</value>
</data>
<data name="EnterValidPortOrPortRange" xml:space="preserve">
<value>Enter a valid port and/or port range (1 - 65535)!</value>
</data>
Expand Down Expand Up @@ -3116,6 +3119,9 @@ Enable profile file encryption in Settings&gt;Profile to store credentials secur
<data name="DeviceDescription" xml:space="preserve">
<value>Device description</value>
</data>
<data name="PortClosed" xml:space="preserve">
<value>Port closed</value>
</data>
<data name="PortDescription" xml:space="preserve">
<value>Port description</value>
</data>
Expand Down Expand Up @@ -5145,6 +5151,9 @@ Do you want to start the scan?</value>
<data name="EnterValidPortsOrPortProfiles" xml:space="preserve">
<value>Enter valid ports, port ranges (1 - 65535) and/or port profiles!</value>
</data>
<data name="ErrorMessage_PingMonitorPortProfileNameInvalid" xml:space="preserve">
<value>The name must not be a port (e.g. 443 or 443/tcp).</value>
</data>
<data name="ErrorMessage_PortProfileNameInvalid" xml:space="preserve">
<value>The name must not contain ";" and must not be a port or port range.</value>
</data>
Expand Down Expand Up @@ -5922,6 +5931,9 @@ Open Windows Settings &gt; Privacy &amp; security &gt; Location and enable acces

Do you want to add the hosts?</value>
</data>
<data name="PingMonitorPortProfileOfProfileNotFoundMessage" xml:space="preserve">
<value>The port profile of this profile or its group was not found, the port saved with the profile or group is used. Port profiles are saved in the settings and the profile or group refers to them by an internal ID - if the profile file was shared from another computer, create the port profile and then select it in the profile or group again (edit it).</value>
</data>
<data name="PingMonitorTooManyHostsMessage" xml:space="preserve">
<value>{0} hosts cannot be monitored at once (maximum {1}). Split the input into smaller ranges.</value>
</data>
Expand Down
21 changes: 19 additions & 2 deletions Source/NETworkManager.Models/Export/ExportManager.PingInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,31 @@ public static partial class ExportManager
new(nameof(PingInfo.Bytes), x => HasPingReply(x.Status) ? x.Bytes : null)
];

/// <summary>
/// Exported fields of a TCP check of a <see cref="PingInfo" /> (no TTL / bytes, the port instead).
/// </summary>
private static readonly ExportField<PingInfo>[] PingInfoTCPExportFields =
[
new(nameof(PingInfo.Timestamp), x => x.Timestamp),
new(nameof(PingInfo.IPAddress), x => x.IPAddress),
new(nameof(PingInfo.Hostname), x => x.Hostname, true),
new(nameof(PingInfo.Port), x => x.Port),
new(nameof(PingInfo.Status), x => x.Status),
new(nameof(PingInfo.Time), x => HasPingReply(x.Status) ? x.Time : null)
];

/// <summary>
/// Method to export objects from type <see cref="PingInfo" /> to a file.
/// </summary>
/// <param name="filePath">Path to the export file.</param>
/// <param name="fileType">Allowed <see cref="ExportFileType" /> are CSV, XML or JSON.</param>
/// <param name="collection">Objects as <see cref="IReadOnlyList{PingInfo}" /> to export.</param>
public static void Export(string filePath, ExportFileType fileType, IReadOnlyList<PingInfo> collection)
/// <param name="method">Method of the checks, selects the exported fields (ICMP by default).</param>
public static void Export(string filePath, ExportFileType fileType, IReadOnlyList<PingInfo> collection,
HostMonitorMethod method = HostMonitorMethod.ICMP)
{
Export(filePath, fileType, collection, PingInfoExportFields, ApplicationName.PingMonitor);
Export(filePath, fileType, collection,
method == HostMonitorMethod.TCP ? PingInfoTCPExportFields : PingInfoExportFields,
ApplicationName.PingMonitor);
}
}
17 changes: 17 additions & 0 deletions Source/NETworkManager.Models/Network/HostMonitorMethod.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace NETworkManager.Models.Network;

/// <summary>
/// How a host is checked by the Ping Monitor.
/// </summary>
public enum HostMonitorMethod
{
/// <summary>
/// ICMP echo request (ping).
/// </summary>
ICMP,

/// <summary>
/// TCP connect to a port (TCP ping), e.g. for hosts that block ICMP.
/// </summary>
TCP
}
6 changes: 5 additions & 1 deletion Source/NETworkManager.Models/Network/ICMPHostMonitorProbe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ public async Task<PingInfo> ProbeAsync(CancellationToken cancellationToken)
var pingReply = await ping.SendPingAsync(_ipAddress, _timeout, _buffer, _options, cancellationToken)
.ConfigureAwait(false);

return pingReply.Status == IPStatus.Success
var pingInfo = pingReply.Status == IPStatus.Success
? PingInfo.FromSuccessfulReply(timestamp, pingReply)
: new PingInfo(timestamp, _ipAddress, pingReply.Status);

pingInfo.Method = HostMonitorMethod.ICMP;

return pingInfo;
}
}
4 changes: 2 additions & 2 deletions Source/NETworkManager.Models/Network/IHostMonitorProbe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ namespace NETworkManager.Models.Network;
/// once per interval, so a probe only has to check the host once.
/// </summary>
/// <remarks>
/// Only ICMP (<see cref="ICMPHostMonitorProbe" />) exists so far. Further methods (e.g. TCP connect, HTTP) are
/// planned; they return the same result type, its status is the <see cref="System.Net.NetworkInformation.IPStatus" />
/// ICMP (<see cref="ICMPHostMonitorProbe" />) and TCP connect (<see cref="TCPHostMonitorProbe" />) exist; HTTP(S) is
/// planned. They return the same result type, its status is the <see cref="System.Net.NetworkInformation.IPStatus" />
/// that matches the outcome (e.g. <c>Success</c>, <c>TimedOut</c>).
/// </remarks>
public interface IHostMonitorProbe
Expand Down
10 changes: 10 additions & 0 deletions Source/NETworkManager.Models/Network/PingInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,16 @@ internal static PingInfo FromSuccessfulReply(DateTime timestamp, PingReply pingR
/// </summary>
public IPStatus Status { get; set; }

/// <summary>
/// Method of the check (Ping Monitor), null for results of other features.
/// </summary>
public HostMonitorMethod? Method { get; set; }

/// <summary>
/// Port of a TCP check (Ping Monitor), null for other methods.
/// </summary>
public int? Port { get; set; }

/// <summary>
/// IP address as an integer.
/// </summary>
Expand Down
33 changes: 26 additions & 7 deletions Source/NETworkManager.Models/Network/PingMonitorHostHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,42 @@ public static class PingMonitorHostHelper
/// group they are added to). Several entries of the input for the same IP address (e.g. different hostnames, see
/// <see cref="HostRangeHelper.ResolveAsync" />) are kept.
/// </summary>
/// <remarks>
/// With further check methods (e.g. TCP, HTTP), the method and its port / URL become part of the key.
/// </remarks>
/// <param name="hosts">Hosts to add.</param>
/// <param name="monitoredIPAddresses">IP addresses already monitored in the group.</param>
/// <returns>Hosts to add and hosts that are already monitored, in the order of <paramref name="hosts" />.</returns>
public static (List<(IPAddress ipAddress, string hostname)> hostsToAdd,
List<(IPAddress ipAddress, string hostname)> alreadyMonitored) SplitAlreadyMonitored(
IEnumerable<(IPAddress ipAddress, string hostname)> hosts, IEnumerable<IPAddress> monitoredIPAddresses)
{
var monitored = monitoredIPAddresses.ToHashSet();
var (hostsToAdd, alreadyMonitored) =
SplitAlreadyMonitored(hosts, [0], monitoredIPAddresses.Select(x => (x, 0)));

var hostsToAdd = new List<(IPAddress ipAddress, string hostname)>();
var alreadyMonitored = new List<(IPAddress ipAddress, string hostname)>();
return (hostsToAdd.Select(x => x.host).ToList(), alreadyMonitored.Select(x => x.host).ToList());
}

/// <summary>
/// Splits the hosts and ports to add (every host with every port, e.g. "Webserver" = 80 and 443 are two hosts
/// per IP address) into the new ones and the ones that are already monitored with the same method in the group
/// (key: IP address and port; port 0 for ICMP). Several entries of the input for the same IP address are kept.
/// </summary>
/// <param name="hosts">Hosts to add.</param>
/// <param name="ports">Ports of the TCP checks, [0] for ICMP.</param>
/// <param name="monitored">IP addresses and ports already monitored with the method in the group.</param>
/// <returns>Hosts and ports to add and already monitored, by host (in the order of <paramref name="hosts" />), then
/// by port (in the order of <paramref name="ports" />).</returns>
public static (List<((IPAddress ipAddress, string hostname) host, int port)> hostsToAdd,
List<((IPAddress ipAddress, string hostname) host, int port)> alreadyMonitored) SplitAlreadyMonitored(
IEnumerable<(IPAddress ipAddress, string hostname)> hosts, IReadOnlyList<int> ports,
IEnumerable<(IPAddress ipAddress, int port)> monitored)
{
var monitoredSet = monitored.ToHashSet();

var hostsToAdd = new List<((IPAddress ipAddress, string hostname) host, int port)>();
var alreadyMonitored = new List<((IPAddress ipAddress, string hostname) host, int port)>();

foreach (var host in hosts)
(monitored.Contains(host.ipAddress) ? alreadyMonitored : hostsToAdd).Add(host);
foreach (var port in ports)
(monitoredSet.Contains((host.ipAddress, port)) ? alreadyMonitored : hostsToAdd).Add((host, port));

return (hostsToAdd, alreadyMonitored);
}
Expand Down
43 changes: 43 additions & 0 deletions Source/NETworkManager.Models/Network/PingMonitorHostHistoryInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using NETworkManager.Utilities;

namespace NETworkManager.Models.Network;

/// <summary>
/// Protocol and port a host of the history of the Ping Monitor was last added with (restored when the host is
/// selected from the history), see <see cref="HostHistoryOptions" />.
/// </summary>
public class PingMonitorHostHistoryInfo : IHostHistoryEntry
{
/// <summary>
/// Creates an empty entry (serializer).
/// </summary>
public PingMonitorHostHistoryInfo()
{
}

/// <summary>
/// Creates an entry.
/// </summary>
/// <param name="host">Host as in the history.</param>
/// <param name="method">Protocol of the checks.</param>
/// <param name="port">Port input of a TCP check as entered ("443", "443/tcp" or a port profile), null for ICMP.</param>
public PingMonitorHostHistoryInfo(string host, HostMonitorMethod method, string port)
{
Host = host;
Method = method;
Port = port;
}

/// <inheritdoc />
public string Host { get; set; }

/// <summary>
/// Protocol of the checks.
/// </summary>
public HostMonitorMethod Method { get; set; }

/// <summary>
/// Port input of a TCP check as entered ("443", "443/tcp" or the name of a port profile), null for ICMP.
/// </summary>
public string Port { get; set; }
}
Loading