the browser-facing portion of osu!
1<?php
2
3// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
4// See the LICENCE file in the repository root for full licence text.
5
6namespace Tests\Singletons;
7
8use App\Singletons\Ip2Asn;
9use Tests\TestCase;
10
11class Ip2AsnTest extends TestCase
12{
13 /**
14 * @dataProvider dataProviderForLookup
15 */
16 public function testLookup(string $ip, string $asn)
17 {
18 $this->assertSame((new Ip2Asn())->lookup($ip), $asn);
19 }
20
21 public static function dataProviderForLookup(): array
22 {
23 return [
24 'cloudflare 1' => ['2606:4700::6810:85e5', '13335'],
25 'cloudflare 2' => ['104.16.133.229', '13335'],
26 'google dns 1' => ['8.8.8.8', '15169'],
27 'google dns 2' => ['8.8.4.4', '15169'],
28 'google search 1' => ['2404:6800:400a:804::200e', '15169'],
29 'he 1' => ['216.218.236.2', '6939'],
30 'he 2' => ['2001:470:0:503::2', '6939'],
31 'opendns 1' => ['2620:119:35::35', '36692'],
32 'opendns 2' => ['2620:119:35::53', '36692'],
33 'opendns 3' => ['2620:0:ccc::2', '36692'],
34 'opendns 4' => ['2620:0:ccd::2', '36692'],
35 'opendns 5' => ['208.67.222.123', '36692'],
36 'opendns 6' => ['208.67.220.123', '36692'],
37 'ovh 1' => ['198.27.92.15', '16276'],
38 'some uni 1' => ['167.205.3.1', '4796'],
39 ];
40 }
41}