예제 #1
0
        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())}"));
        }
예제 #2
0
        bool IsLocalOrMulticast(string ipAddr, LocalNetworkPrefix localNetworkPrefix)
        {
            var scope = LanRulesHelper.GetAddressScope(ipAddr, localNetworkPrefix);

            return(scope != AddressScope.RemoteAddress);
        }