title: Yesod get client Ipv4/Ipv6 address
body: <p>I want to get the user <code>IPv4</code> and/or <code>IPv6</code> to use on <a href="http://hackage.haskell.org/package/geoip2" rel="nofollow noreferrer">GeoIp2</a>.</p>
  
  <p>How to get it?</p>
  
  <p>----- EDIT --------</p>
  
  <p>Like if the user access my site i want to check what is their IP Address once i get that I want to use the <a href="http://hackage.haskell.org/package/geoip2" rel="nofollow noreferrer">GeoIp2</a> to locate them.</p>
  
  <p>the example below has a default IPv4 and IPv6 address:</p>
  
  <pre><code>{-# LANGUAGE OverloadedStrings #-}
  import Data.GeoIP2
  import Data.IP (IP(..))
  
  main = do
    geodb &lt;- openGeoDB "GeoLite2-City.mmdb"
    let ip = IPv4 "23.253.242.70"
    print $ (findGeoData geodb "en" ip :: Maybe GeoResult)
  
    let ip2 = IPv6 "2001:4800:7817:104:be76:4eff:fe04:f608"
    print $ (findGeoData geodb "en" ip2 :: Maybe GeoResult)
  </code></pre>
  
  <p>hope that helps</p>