Making WordPress.org


Ignore:
Timestamp:
05/19/2017 06:53:29 PM (9 years ago)
Author:
iandunn
Message:

Events: Support IPv6 address geolocation.

See #2823
Props coreymckrill

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/events/1.0/tests/test-index.php

    r5497 r5501  
    719719
    720720                /*
    721                  * Only the IP is given
     721                 * Only the IPv4 address is given
     722                 *
     723                 * See https://awebanalysis.com/en/ipv4-directory/
    722724                 */
    723725                'ip-africa' => array(
    … …  
    786788                        ),
    787789                ),
     790
     791                /*
     792                 * Only an IPv6 address is given
     793                 *
     794                 * See https://www.google.com/intl/en/ipv6/statistics.html#tab=per-country-ipv6-adoption&tab=per-country-ipv6-adoption
     795                 * See https://awebanalysis.com/en/ipv6-directory/
     796                 * See https://www.google.com/search?q=australia+site%3Ahttps%3A%2F%2Fawebanalysis.com%2Fen%2Fipv6-directory%2F
     797                 */
     798                'ipv6-africa' => array(
     799                        'input'    => array( 'ip' => '2c0f:f8f0:ffff:ffff:ffff:ffff:ffff:ffff' ),
     800                        'expected' => array(
     801                                'description' => 'harare',
     802                                'latitude'    => '-17.829',
     803                                'longitude'   => '31.054',
     804                                'country'     => 'ZW',
     805                                'internal'    => true,
     806                        ),
     807                ),
     808
     809                'ipv6-asia-anonymized' => array(
     810                        'input'    => array( 'ip' => '2405:200:1000::' ),
     811                        'expected' => array(
     812                                'description' => 'mumbai',
     813                                'latitude'    => '19.014',
     814                                'longitude'   => '72.848',
     815                                'country'     => 'IN',
     816                                'internal'    => true,
     817                        ),
     818                ),
     819
     820                'ipv6-europe-anonymized' => array(
     821                        'input'    => array( 'ip' => '2a02:578:1000::' ),
     822                        'expected' => array(
     823                                'description' => 'sint-niklaas',
     824                                'latitude'    => '51.165',
     825                                'longitude'   => '4.144',
     826                                'country'     => 'BE',
     827                                'internal'    => true,
     828                        ),
     829                ),
     830
     831                'ipv6-north-america-anonymized' => array(
     832                        'input'    => array( 'ip' => '2605:a600::' ),
     833                        'expected' => array(
     834                                'description' => 'mountain view',
     835                                'latitude'    => '37.386',
     836                                'longitude'   => '-122.084',
     837                                'country'     => 'US',
     838                                'internal'    => true,
     839                        ),
     840                ),
     841
     842                'ipv6-oceania-collapsed-prefix' => array(
     843                        'input'    => array( 'ip' => '::ffff:0190:c500' ),
     844                        'expected' => array(
     845                                'description' => 'quedjinup',
     846                                'latitude'    => '-33.634',
     847                                'longitude'   => '115.084',
     848                                'country'     => 'AU',
     849                                'internal'    => true,
     850                        ),
     851                ),
     852
     853                'ipv6-south-america' => array(
     854                        'input'    => array( 'ip' => '2001:1388:6643:2736:10f1:897c:428c:1b3b' ),
     855                        'expected' => array(
     856                                'description' => 'ayacucho',
     857                                'latitude'    => '-13.158',
     858                                'longitude'   => '-74.224',
     859                                'country'     => 'PE',
     860                                'internal'    => true,
     861                        ),
     862                ),
    788863        );
    789864
    790          return $cases;
     865        return $cases;
    791866}
    792867
Note: See TracChangeset for help on using the changeset viewer.