public override void Define() { LocalNetworkPrefix localNetworkPrefix = null; IGrouping <AddressScope, AddressMapping> addressClass = null; When() .Match(() => localNetworkPrefix) .Query(() => addressClass, q => q .Match <AddressMapping>() .GroupBy(m => LanRulesHelper.GetAddressScope(m.IpAddr, localNetworkPrefix))); Then() .Do(ctx => ctx.Info($"{addressClass.Key} hosts: {StringUtils.ToString(addressClass.ToArray())}")); }
bool IsLocalOrMulticast(string ipAddr, LocalNetworkPrefix localNetworkPrefix) { var scope = LanRulesHelper.GetAddressScope(ipAddr, localNetworkPrefix); return(scope != AddressScope.RemoteAddress); }