Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Decided to answer my own question so people can benefit. If it can be improved, please do!</p> <p>I used the <a href="https://github.com/lduchosal/ipnetwork" rel="noreferrer">IPNetwork library</a> and it worked out fantastically! Below is the code I used:</p> <pre><code>using System.Net; public static class RedirectHelpers { public static bool IpIsWithinBoliviaRange(string ip) { IPAddress incomingIp = IPAddress.Parse(ip); foreach (var subnet in Bolivia_Ip_Range) { IPNetwork network = IPNetwork.Parse(subnet); if (IPNetwork.Contains(network, incomingIp)) return true; } return false; } private static List&lt;string&gt; Bolivia_Ip_Range = new List&lt;string&gt;() { "12.144.86.0/23", "31.201.1.176/30", "46.36.198.101/32", "46.36.198.102/31", "46.36.198.104/31", "46.136.172.0/24", "63.65.11.0/24", "63.65.12.0/25", "63.65.12.128/26", "63.65.12.192/27", "63.65.12.224/28", "63.65.12.240/29", "63.65.12.248/30", "63.65.12.252/31", "63.65.12.254/32", "65.173.56.0/21", "67.23.241.179/32", "67.23.241.180/30", "67.23.241.184/29", "67.23.241.192/30", "67.23.241.196/31", "67.23.241.198/32", "72.32.164.56/29", "72.46.244.32/28", "74.91.16.48/29", "74.91.16.208/29", "74.91.20.48/28", "74.91.20.64/29", "74.112.134.120/29", "74.112.135.104/29", "74.205.37.16/29", "78.24.205.32/28", "98.129.27.88/29", "98.129.91.40/29", "166.114.0.0/16", "167.157.0.0/16", "174.143.165.80/29", "186.0.156.0/22", "186.2.0.0/17", "186.27.0.0/17", "190.0.248.0/21", "190.3.184.0/21", "166.114.0.0/16", "167.157.0.0/16", "186.2.0.0/18", "190.11.64.0/20", "190.11.80.0/20", "190.103.64.0/20", "190.104.0.0/19", "190.107.32.0/20", "190.129.0.0/17", "190.181.0.0/18", "190.186.0.0/18", "190.186.64.0/18", "190.186.128.0/18", "200.7.160.0/20", "200.58.64.0/20", "200.58.80.0/20", "200.58.160.0/20", "200.58.176.0/20", "200.75.160.0/20", "200.85.128.0/20", "200.87.0.0/17", "200.87.128.0/17", "200.105.128.0/19", "200.105.160.0/19", "200.105.192.0/19", "200.112.192.0/20", "200.119.192.0/20", "200.119.208.0/20", "201.222.64.0/19", "201.222.96.0/19" }; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload