public List <IpAddressRange> GetAllIps(bool includeIpUsedByClient) { List <IpAddressRange> result = new List <IpAddressRange>(); // Custom { string list = Engine.Instance.Storage.Get("netlock.allowed_ips"); List <string> ips = Utils.CommaStringToListString(list); foreach (string ip in ips) { string ip2 = ip.Trim(); int posComment = ip2.IndexOf("#"); if (posComment != -1) { ip2 = ip2.Substring(0, posComment).Trim(); } if (ip2 == "") { continue; } AddToIpsList(result, new IpAddressRange(ip2), true); } } // Routes Out { string routes = Engine.Instance.Storage.Get("routes.custom"); string[] routes2 = routes.Split(';'); foreach (string route in routes2) { string[] routeEntries = route.Split(','); if (routeEntries.Length < 2) { continue; } string ip = routeEntries[0]; string action = routeEntries[1]; if (action == "out") { AddToIpsList(result, new IpAddressRange(ip), true); } } } if (includeIpUsedByClient) { // Providers foreach (Provider provider in Engine.Instance.ProvidersManager.Providers) { List <IpAddressRange> list = provider.GetNetworkLockAllowedIps(); foreach (IpAddressRange ip in list) { AddToIpsList(result, ip, false); } } // Servers lock (Engine.Instance.Servers) { Dictionary <string, ServerInfo> servers = new Dictionary <string, ServerInfo>(Engine.Instance.Servers); foreach (ServerInfo infoServer in servers.Values) { AddToIpsList(result, infoServer.IpEntry, false); if (infoServer.IpEntry2.Trim() != "") { AddToIpsList(result, infoServer.IpEntry2, false); } } } } return(result); }