     i = new ipv6.v6.Address(ip)
   else
     i = new ipv6.v4.Address(ip)
+    subnetMask = 96 + i.subnetMask
+    ip = '::ffff:' + i.toV6Group() + "/" + subnetMask
+    i = new ipv6.v6.Address(ip)
 
 ipToInt = (ip) ->
   i = address(ip)

if require.main == module
  main()

# export these for testing
exports.compareIps = compareIps
exports.isIpInRange = isIpInRange
exports.isIpInAnyRange = isIpInAnyRange

  require path

getStatusLength = (edit, name, template) ->
  # https://support.twitter.com/articles/78124-posting-links-in-a-tweet
  fakeUrl = 'http://t.co/BzHLWr31Ce'
  status = Mustache.render template, name: name, url: fakeUrl, page: edit.page
