├── .editorconfig ├── .gitignore ├── .jshintrc ├── README.MD ├── bower.json ├── connection-type-checker.js ├── gruntfile.js ├── package.json ├── src └── gurfl.json └── test └── index.html /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig http://EditorConfig.org 2 | 3 | # Root EditorConfig file 4 | root = true 5 | 6 | # Universal 7 | [*] 8 | end_of_line = lf 9 | charset = utf-8 10 | trim_trailing_whitespace = true 11 | insert_final_newline = true 12 | indent_style = space 13 | indent_size = 4 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | npm-debug.log 2 | .idea 3 | node_modules 4 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | // JSHint Configuration File 3 | // See http://jshint.com/docs/ for more details 4 | 5 | "maxerr": 50, 6 | // {int} Maximum error before stopping 7 | 8 | // Enforcing 9 | "bitwise": true, 10 | // true: Prohibit bitwise operators (&, |, ^, etc.) 11 | "camelcase": false, 12 | // true: Identifiers must be in camelCase 13 | "curly": true, 14 | // true: Require {} for every new block or scope 15 | "eqeqeq": true, 16 | // true: Require triple equals (===) for comparison 17 | "freeze": false, 18 | // true: prohibits overwriting prototypes of native objects such as Array, Date etc. 19 | "forin": true, 20 | // true: Require filtering for..in loops with obj.hasOwnProperty() 21 | "immed": false, 22 | // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());` 23 | "indent": 4, 24 | // {int} Number of spaces to use for indentation 25 | "latedef": false, 26 | // true: Require variables/functions to be defined before being used 27 | "newcap": false, 28 | // true: Require capitalization of all constructor functions e.g. `new F()` 29 | "noarg": true, 30 | // true: Prohibit use of `arguments.caller` and `arguments.callee` 31 | "noempty": true, 32 | // true: Prohibit use of empty blocks 33 | "nonbsp": true, 34 | // true: Prohibit "non-breaking whitespace" characters. 35 | "nonew": false, 36 | // true: Prohibit use of constructors for side-effects (without assignment) 37 | "plusplus": false, 38 | // true: Prohibit use of `++` & `--` 39 | "quotmark": "single", 40 | // Quotation mark consistency: 41 | // false : do nothing (default) 42 | // true : ensure whatever is used is consistent 43 | // "single" : require single quotes 44 | // "double" : require double quotes 45 | "undef": true, 46 | // true: Require all non-global variables to be declared (prevents global leaks) 47 | "unused": true, 48 | // true: Require all defined variables be used 49 | "strict": false, 50 | // true: Requires all functions run in ES5 Strict Mode 51 | "maxparams": false, 52 | // {int} Max number of formal params allowed per function 53 | "maxdepth": 4, 54 | // {int} Max depth of nested blocks (within functions) 55 | "maxstatements": false, 56 | // {int} Max number statements per function 57 | "maxcomplexity": false, 58 | // {int} Max cyclomatic complexity per function 59 | "maxlen": 100, 60 | // {int} Max number of characters per line 61 | 62 | // Relaxing 63 | "asi": false, 64 | // true: Tolerate Automatic Semicolon Insertion (no semicolons) 65 | "boss": false, 66 | // true: Tolerate assignments where comparisons would be expected 67 | "debug": false, 68 | // true: Allow debugger statements e.g. browser breakpoints. 69 | "eqnull": false, 70 | // true: Tolerate use of `== null` 71 | "es5": false, 72 | // true: Allow ES5 syntax (ex: getters and setters) 73 | "esnext": false, 74 | // true: Allow ES.next (ES6) syntax (ex: `const`) 75 | "moz": false, 76 | // true: Allow Mozilla specific syntax (extends and overrides esnext features) 77 | // (ex: `for each`, multiple try/catch, function expression…) 78 | "evil": false, 79 | // true: Tolerate use of `eval` and `new Function()` 80 | "expr": false, 81 | // true: Tolerate `ExpressionStatement` as Programs 82 | "funcscope": false, 83 | // true: Tolerate defining variables inside control statements 84 | "globalstrict": false, 85 | // true: Allow global "use strict" (also enables 'strict') 86 | "iterator": false, 87 | // true: Tolerate using the `__iterator__` property 88 | "lastsemic": false, 89 | // true: Tolerate omitting a semicolon for the last statement of a 1-line block 90 | "laxbreak": false, 91 | // true: Tolerate possibly unsafe line breakings 92 | "laxcomma": false, 93 | // true: Tolerate comma-first style coding 94 | "loopfunc": false, 95 | // true: Tolerate functions being defined in loops 96 | "multistr": false, 97 | // true: Tolerate multi-line strings 98 | "noyield": false, 99 | // true: Tolerate generator functions with no yield statement in them. 100 | "notypeof": false, 101 | // true: Tolerate invalid typeof operator values 102 | "proto": false, 103 | // true: Tolerate using the `__proto__` property 104 | "scripturl": false, 105 | // true: Tolerate script-targeted URLs 106 | "shadow": false, 107 | // true: Allows re-define variables later in code e.g. `var x=1; x=2;` 108 | "sub": false, 109 | // true: Tolerate using `[]` notation when it can still be expressed in dot notation 110 | "supernew": false, 111 | // true: Tolerate `new function () { ... };` and `new Object;` 112 | "validthis": false, 113 | // true: Tolerate using this in a non-constructor function 114 | 115 | // Environments 116 | "browser": true, 117 | // Web Browser (window, document, etc) 118 | "browserify": false, 119 | // Browserify (node.js code in the browser) 120 | "couch": false, 121 | // CouchDB 122 | "devel": true, 123 | // Development/debugging (alert, confirm, etc) 124 | "dojo": false, 125 | // Dojo Toolkit 126 | "jasmine": false, 127 | // Jasmine 128 | "jquery": true, 129 | // jQuery 130 | "mocha": true, 131 | // Mocha 132 | "mootools": false, 133 | // MooTools 134 | "node": true, 135 | // Node.js 136 | "nonstandard": false, 137 | // Widely adopted globals (escape, unescape, etc) 138 | "prototypejs": false, 139 | // Prototype and Scriptaculous 140 | "qunit": false, 141 | // QUnit 142 | "rhino": false, 143 | // Rhino 144 | "shelljs": false, 145 | // ShellJS 146 | "worker": true, 147 | // Web Workers 148 | "wsh": false, 149 | // Windows Scripting Host 150 | "yui": false, 151 | // Yahoo User Interface 152 | 153 | // Custom Globals 154 | // additional predefined global variables 155 | "globals": { 156 | "define": true 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /README.MD: -------------------------------------------------------------------------------- 1 | # connection-type-checker 2 | 3 | Utility that tries to figure out if you are on cellular or broadband. It either uses the [Network Information API](https://w3c.github.io/netinfo/) ([browser support](http://caniuse.com/#feat=netinfo)) or falls back to measuring latencies via [Resource Timing API](http://www.w3.org/TR/resource-timing/) ([browser support](http://caniuse.com/#feat=resource-timing)). If none of them is available, it will get the client's public IP from [ipify](https://www.ipify.org/) and compare that with the [GURFL list of mobile carrier IP blocks](http://www.nitingautam.com/operator.csv). If the connection type can not be specified, it will settle on broadband by default. 4 | 5 | ## Usage 6 | 7 | Include `connection-type-checker.js` script in your HTML file: 8 | 9 | ```html 10 | 11 | ``` 12 | 13 | Execute `connectionTypeChecker.getConnectionType` method with a callback function: 14 | 15 | ```js 16 | connectionTypeChecker.getConnectionType(function(result) { 17 | alert(result); 18 | }); 19 | ``` 20 | 21 | ## Possible return values 22 | 23 | * `'offline'` for when `navigator.onLine` returns `false` or the Network Information API returns `'none'`, or when Resource Timing AJAX call fails. 24 | * `'cellular'` for when the Network Information API returns `'cellular'` or `'bluetooth'`, or when Resource Timing API measures latencies >= 100 ms, or when the client's IP is amongst the list of mobile carriers. 25 | * `'broadband'` for when the Network Information API returns `'wifi'`, `'wimax'` or `'ethernet'`, or when Resource Timing API measures latencies < 100 ms, when the client's IP is not amongst the list of mobile carriers, or as the fallback value when none of the aforementioned works out. 26 | 27 | ## Demo 28 | 29 | [https://schepp.github.io/connection-type-checker/test/](https://schepp.github.io/connection-type-checker/test/) 30 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "connection-type-checker", 3 | "description": "Utility that tries to figure out if you are on cellular or broadband", 4 | "main": [ 5 | "connection-type-checker.js" 6 | ], 7 | "dependencies": {}, 8 | "devDependencies": {}, 9 | "moduleType": [ 10 | "amd", 11 | "globals", 12 | "node" 13 | ], 14 | "keywords": [ 15 | "connection", 16 | "type", 17 | "mobile" 18 | ], 19 | "authors": [ 20 | "Christian Schaefer " 21 | ], 22 | "license": "MIT", 23 | "ignore": [ 24 | "**/.*", 25 | "node_modules", 26 | "bower_components", 27 | "test", 28 | "tests" 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /connection-type-checker.js: -------------------------------------------------------------------------------- 1 | (function (root, factory) { 2 | if (typeof define === 'function' && define.amd) { 3 | // AMD. Register as an anonymous module. 4 | define([], factory); 5 | } else if (typeof module === 'object' && module.exports) { 6 | // Node. Does not work with strict CommonJS, but 7 | // only CommonJS-like environments that support module.exports, 8 | // like Node. 9 | module.exports = factory(); 10 | } else { 11 | // Browser globals (root is window) 12 | root.connectionTypeChecker = factory(); 13 | } 14 | }(this, function () { 15 | function isMobileIp(callback) { 16 | var carrierIpBlocks = [ 17 | { 18 | ipStart: '213.162.64.0', 19 | ipEnd: '213.162.67.255', 20 | country: 'AT', 21 | carrier: 'T-Mobile (Maxmobil)' 22 | }, 23 | { 24 | ipStart: '203.20.32.0', 25 | ipEnd: '203.20.39.255', 26 | country: 'AU', 27 | carrier: 'Vodafone ' 28 | }, 29 | 30 | { 31 | ipStart: '58.145.128.0', 32 | ipEnd: '58.145.159.255', 33 | country: 'AU', 34 | carrier: 'Optus' 35 | }, 36 | 37 | { 38 | ipStart: '202.124.64.0', 39 | ipEnd: '202.124.95.255', 40 | country: 'AU', 41 | carrier: 'H3G' 42 | }, 43 | 44 | { 45 | ipStart: '203.171.192.0', 46 | ipEnd: '203.171.207.255', 47 | country: 'AU', 48 | carrier: 'H3G' 49 | }, 50 | 51 | { 52 | ipStart: '192.148.116.0', 53 | ipEnd: '192.148.165.255', 54 | country: 'AU', 55 | carrier: 'Telstra' 56 | }, 57 | 58 | { 59 | ipStart: '212.39.122.0', 60 | ipEnd: '212.39.122.255', 61 | country: 'BA', 62 | carrier: 'Eronet' 63 | }, 64 | 65 | { 66 | ipStart: '202.134.8.0', 67 | ipEnd: '202.134.15.255', 68 | country: 'BD', 69 | carrier: 'AKTEL' 70 | }, 71 | 72 | { 73 | ipStart: '217.72.228.0', 74 | ipEnd: '217.72.231.255', 75 | country: 'BE', 76 | carrier: 'BASE' 77 | }, 78 | 79 | { 80 | ipStart: '212.65.63.0', 81 | ipEnd: '212.65.63.255', 82 | country: 'BE', 83 | carrier: 'Orange (Mobistar)' 84 | }, 85 | 86 | { 87 | ipStart: '81.169.60.0', 88 | ipEnd: '81.169.63.255', 89 | country: 'BE', 90 | carrier: 'Proximus' 91 | }, 92 | 93 | { 94 | ipStart: '200.140.0.0', 95 | ipEnd: '200.150.66.255', 96 | country: 'BR', 97 | carrier: 'Brazil Telecom' 98 | }, 99 | 100 | { 101 | ipStart: '200.179.66.192', 102 | ipEnd: '200.179.66.255', 103 | country: 'BR', 104 | carrier: 'TIM' 105 | }, 106 | 107 | { 108 | ipStart: '189.0.0.0', 109 | ipEnd: '189.0.255.255', 110 | country: 'BR', 111 | carrier: 'VIVO' 112 | }, 113 | 114 | { 115 | ipStart: '206.47.78.128', 116 | ipEnd: '206.47.78.159', 117 | country: 'CA', 118 | carrier: 'Bell Mobilite' 119 | }, 120 | 121 | { 122 | ipStart: '212.35.32.0', 123 | ipEnd: '212.35.47.255', 124 | country: 'CH', 125 | carrier: 'Sunrise (Diax)' 126 | }, 127 | 128 | { 129 | ipStart: '194.230.144.0', 130 | ipEnd: '194.230.159.255', 131 | country: 'CH', 132 | carrier: 'Sunrise (Diax)' 133 | }, 134 | 135 | { 136 | ipStart: '213.55.128.0', 137 | ipEnd: '213.55.255.255', 138 | country: 'CH', 139 | carrier: 'Orange' 140 | }, 141 | 142 | { 143 | ipStart: '138.188.0.0', 144 | ipEnd: '138.188.255.255', 145 | country: 'CH', 146 | carrier: 'Swisscom' 147 | }, 148 | 149 | { 150 | ipStart: '200.91.0.0', 151 | ipEnd: '200.91.31.255', 152 | country: 'CL', 153 | carrier: 'Telefonica CTC' 154 | }, 155 | 156 | { 157 | ipStart: '217.77.164.0', 158 | ipEnd: '217.77.165.255', 159 | country: 'CZ', 160 | carrier: 'Vodafone (oskarmobil)' 161 | }, 162 | 163 | { 164 | ipStart: '84.57.113.0', 165 | ipEnd: '84.61.96.255', 166 | country: 'DE', 167 | carrier: 'Arcor' 168 | }, 169 | 170 | { 171 | ipStart: '82.113.100.0', 172 | ipEnd: '82.113.100.255', 173 | country: 'DE', 174 | carrier: 'O2' 175 | }, 176 | 177 | { 178 | ipStart: '80.187.0.0', 179 | ipEnd: '80.187.111.255', 180 | country: 'DE', 181 | carrier: 'T-Mobile' 182 | }, 183 | 184 | { 185 | ipStart: '139.7.0.0', 186 | ipEnd: '139.7.255.255', 187 | country: 'DE', 188 | carrier: 'Vodafone' 189 | }, 190 | 191 | { 192 | ipStart: '80.251.192.0', 193 | ipEnd: '80.251.207.255', 194 | country: 'DK', 195 | carrier: 'H3G (SE?)' 196 | }, 197 | 198 | { 199 | ipStart: '194.182.251.0', 200 | ipEnd: '194.182.251.63', 201 | country: 'DK', 202 | carrier: 'Tele Danmark (TDC)' 203 | }, 204 | 205 | { 206 | ipStart: '62.44.128.0', 207 | ipEnd: '62.44.191.255', 208 | country: 'DK', 209 | carrier: 'Teliamobile' 210 | }, 211 | 212 | { 213 | ipStart: '217.71.32.0', 214 | ipEnd: '217.71.35.12', 215 | country: 'EE', 216 | carrier: 'EMT' 217 | }, 218 | 219 | { 220 | ipStart: '213.143.32.0', 221 | ipEnd: '213.143.43.255', 222 | country: 'ES', 223 | carrier: 'Amena' 224 | }, 225 | 226 | { 227 | ipStart: '195.55.47.0', 228 | ipEnd: '195.55.47.63', 229 | country: 'ES', 230 | carrier: 'Telefonica' 231 | }, 232 | 233 | { 234 | ipStart: '80.27.0.0', 235 | ipEnd: '80.27.127.255', 236 | country: 'ES', 237 | carrier: 'Telefonica TME' 238 | }, 239 | 240 | { 241 | ipStart: '62.87.92.0', 242 | ipEnd: '62.87.92.63', 243 | country: 'ES', 244 | carrier: 'Vodafone' 245 | }, 246 | 247 | { 248 | ipStart: '62.142.0.0', 249 | ipEnd: '62.142.7.255', 250 | country: 'FI', 251 | carrier: 'Saunalahti' 252 | }, 253 | 254 | { 255 | ipStart: '193.209.131.0', 256 | ipEnd: '193.209.134.255', 257 | country: 'FI', 258 | carrier: 'Sonera' 259 | }, 260 | 261 | { 262 | ipStart: '62.201.128.0', 263 | ipEnd: '62.201.129.255', 264 | country: 'FR', 265 | carrier: 'Bouygues Telecom' 266 | }, 267 | 268 | { 269 | ipStart: '213.223.200.0', 270 | ipEnd: '213.223.200.255', 271 | country: 'FR', 272 | carrier: 'Cegetel' 273 | }, 274 | 275 | { 276 | ipStart: '195.115.116.0', 277 | ipEnd: '195.115.119.255', 278 | country: 'FR', 279 | carrier: 'Cegetel' 280 | }, 281 | 282 | { 283 | ipStart: '194.206.212.0', 284 | ipEnd: '194.206.212.7', 285 | country: 'FR', 286 | carrier: 'Orange (France Telecom)' 287 | }, 288 | 289 | { 290 | ipStart: '193.113.235.0', 291 | ipEnd: '193.113.235.255', 292 | country: 'GB', 293 | carrier: '02' 294 | }, 295 | 296 | { 297 | ipStart: '193.113.200.0', 298 | ipEnd: '193.113.200.255', 299 | country: 'GB', 300 | carrier: 'O2' 301 | }, 302 | 303 | { 304 | ipStart: '89.192.0.0 ', 305 | ipEnd: '89.193.255.255', 306 | country: 'GB', 307 | carrier: 'Orange' 308 | }, 309 | 310 | { 311 | ipStart: '213.205.192.0', 312 | ipEnd: '213.205.223.255', 313 | country: 'GB', 314 | carrier: 'Orange' 315 | }, 316 | 317 | { 318 | ipStart: '213.205.224.0', 319 | ipEnd: '213.205.255.255', 320 | country: 'GB', 321 | carrier: 'Orange' 322 | }, 323 | 324 | { 325 | ipStart: '193.35.128.0', 326 | ipEnd: '193.35.143.255', 327 | country: 'GB', 328 | carrier: 'Orange' 329 | }, 330 | 331 | { 332 | ipStart: '149.254.0.0', 333 | ipEnd: '149.254.255.255', 334 | country: 'GB', 335 | carrier: 'T-Mobile' 336 | }, 337 | 338 | { 339 | ipStart: '212.183.128.0', 340 | ipEnd: '212.183.144.255', 341 | country: 'GB', 342 | carrier: 'Vodafone' 343 | }, 344 | 345 | { 346 | ipStart: '195.167.65.0', 347 | ipEnd: '195.167.65.255', 348 | country: 'GR', 349 | carrier: 'Cosmote' 350 | }, 351 | 352 | { 353 | ipStart: '62.103.102.0', 354 | ipEnd: '62.103.103.255', 355 | country: 'GR', 356 | carrier: 'Cosmote' 357 | }, 358 | 359 | { 360 | ipStart: '84.224.0.0', 361 | ipEnd: '84.224.63.255', 362 | country: 'HU', 363 | carrier: 'Pannon' 364 | }, 365 | 366 | { 367 | ipStart: '212.51.126.0', 368 | ipEnd: '212.51.126.255', 369 | country: 'HU', 370 | carrier: 'T-Mobile (Westel)' 371 | }, 372 | 373 | { 374 | ipStart: '202.93.36.0', 375 | ipEnd: '202.93.37.255', 376 | country: 'ID', 377 | carrier: 'Indosat (Mentari/IM3)' 378 | }, 379 | 380 | { 381 | ipStart: '219.83.36.128', 382 | ipEnd: '219.83.36.143', 383 | country: 'ID', 384 | carrier: 'Indosat (XL?)' 385 | }, 386 | 387 | { 388 | ipStart: '212.129.64.0', 389 | ipEnd: '212.129.64.255', 390 | country: 'IE', 391 | carrier: 'Meteor' 392 | }, 393 | 394 | { 395 | ipStart: '62.40.32.0', 396 | ipEnd: '62.40.63.255', 397 | country: 'IE', 398 | carrier: 'O2' 399 | }, 400 | 401 | { 402 | ipStart: '213.233.128.0', 403 | ipEnd: '213.233.159.255', 404 | country: 'IE', 405 | carrier: 'Vodafone' 406 | }, 407 | 408 | { 409 | ipStart: '192.118.8.0', 410 | ipEnd: '192.118.11.255', 411 | country: 'IL', 412 | carrier: 'Orange (via Partner Comms?)' 413 | }, 414 | 415 | { 416 | ipStart: '203.145.128.0', 417 | ipEnd: '203.145.128.15', 418 | country: 'IN', 419 | carrier: 'Bharti' 420 | }, 421 | 422 | { 423 | ipStart: '203.145.159.32', 424 | ipEnd: '203.145.159.47', 425 | country: 'IN', 426 | carrier: 'Bharti' 427 | }, 428 | 429 | { 430 | ipStart: '59.145.208.0', 431 | ipEnd: '59.145.208.255', 432 | country: 'IN', 433 | carrier: 'Bharti' 434 | }, 435 | 436 | { 437 | ipStart: '202.56.231.112', 438 | ipEnd: '202.56.231.127', 439 | country: 'IN', 440 | carrier: 'Bharti' 441 | }, 442 | 443 | { 444 | ipStart: '220.227.211.0', 445 | ipEnd: '220.227.211.255', 446 | country: 'IN', 447 | carrier: 'Reliance' 448 | }, 449 | 450 | { 451 | ipStart: '219.64.0.0', 452 | ipEnd: '219.65.255.255', 453 | country: 'IN', 454 | carrier: 'VSNL' 455 | }, 456 | 457 | { 458 | ipStart: '151.80.0.0', 459 | ipEnd: '151.80.255.255', 460 | country: 'IT', 461 | carrier: 'Infostrada (telco?)' 462 | }, 463 | 464 | { 465 | ipStart: '151.83.0.0', 466 | ipEnd: '151.83.255.255', 467 | country: 'IT', 468 | carrier: 'Infostrada (telco?)' 469 | }, 470 | 471 | { 472 | ipStart: '213.26.0.0', 473 | ipEnd: '213.26.255.255', 474 | country: 'IT', 475 | carrier: 'Interbusiness/Telecom Italia?' 476 | }, 477 | 478 | { 479 | ipStart: '83.224.0.0', 480 | ipEnd: '83.225.255.255', 481 | country: 'IT', 482 | carrier: 'Vodafone' 483 | }, 484 | 485 | { 486 | ipStart: '210.169.40.0', 487 | ipEnd: '210.169.40.255', 488 | country: 'JP', 489 | carrier: 'AU (KDDI)' 490 | }, 491 | 492 | { 493 | ipStart: '210.196.3.192', 494 | ipEnd: '210.196.3.255', 495 | country: 'JP', 496 | carrier: 'AU (KDDI) ' 497 | }, 498 | 499 | { 500 | ipStart: '210.196.5.192', 501 | ipEnd: '210.196.5.255', 502 | country: 'JP', 503 | carrier: 'AU (KDDI) ' 504 | }, 505 | 506 | { 507 | ipStart: '210.230.128.0', 508 | ipEnd: '210.230.128.255', 509 | country: 'JP', 510 | carrier: 'AU (KDDI) ' 511 | }, 512 | 513 | { 514 | ipStart: '210.230.141.192', 515 | ipEnd: '210.230.141.255', 516 | country: 'JP', 517 | carrier: 'AU (KDDI)' 518 | }, 519 | 520 | { 521 | ipStart: '210.234.105.32', 522 | ipEnd: '210.234.105.39', 523 | country: 'JP', 524 | carrier: 'AU (KDDI)' 525 | }, 526 | 527 | { 528 | ipStart: '210.234.108.64', 529 | ipEnd: '210.234.108.127', 530 | country: 'JP', 531 | carrier: 'AU (KDDI)' 532 | }, 533 | 534 | { 535 | ipStart: '210.251.1.192', 536 | ipEnd: '210.251.1.255', 537 | country: 'JP', 538 | carrier: 'AU (KDDI)' 539 | }, 540 | 541 | { 542 | ipStart: '210.251.2.0', 543 | ipEnd: '210.251.2.31', 544 | country: 'JP', 545 | carrier: 'AU (KDDI)' 546 | }, 547 | 548 | { 549 | ipStart: '211.5.1.0', 550 | ipEnd: '211.5.1.255', 551 | country: 'JP', 552 | carrier: 'AU (KDDI)' 553 | }, 554 | 555 | { 556 | ipStart: '211.5.2.128', 557 | ipEnd: '211.5.2.255', 558 | country: 'JP', 559 | carrier: 'AU (KDDI)' 560 | }, 561 | 562 | { 563 | ipStart: '211.5.7.0', 564 | ipEnd: '211.5.7.255', 565 | country: 'JP', 566 | carrier: 'AU (KDDI)' 567 | }, 568 | 569 | { 570 | ipStart: '218.222.1.0', 571 | ipEnd: '218.222.1.255', 572 | country: 'JP', 573 | carrier: 'AU (KDDI)' 574 | }, 575 | 576 | { 577 | ipStart: '61.117.0.0', 578 | ipEnd: '61.117.0.255', 579 | country: 'JP', 580 | carrier: 'AU (KDDI)' 581 | }, 582 | 583 | { 584 | ipStart: '61.117.1.0', 585 | ipEnd: '61.117.1.255', 586 | country: 'JP', 587 | carrier: 'AU (KDDI)' 588 | }, 589 | 590 | { 591 | ipStart: '61.117.2.0', 592 | ipEnd: '61.117.2.63', 593 | country: 'JP', 594 | carrier: 'AU (KDDI)' 595 | }, 596 | 597 | { 598 | ipStart: '61.202.3.0', 599 | ipEnd: '61.202.3.255', 600 | country: 'JP', 601 | carrier: 'AU (KDDI)' 602 | }, 603 | 604 | { 605 | ipStart: '219.108.158.0', 606 | ipEnd: '219.108.158.63', 607 | country: 'JP', 608 | carrier: 'AU (KDDI)' 609 | }, 610 | 611 | { 612 | ipStart: '219.125.148.0', 613 | ipEnd: '219.125.148.255', 614 | country: 'JP', 615 | carrier: 'AU (KDDI)' 616 | }, 617 | 618 | { 619 | ipStart: '222.5.63.0', 620 | ipEnd: '222.5.63.255', 621 | country: 'JP', 622 | carrier: 'AU (KDDI)' 623 | }, 624 | 625 | { 626 | ipStart: '222.7.56.0', 627 | ipEnd: '222.7.56.255', 628 | country: 'JP', 629 | carrier: 'AU (KDDI)' 630 | }, 631 | 632 | { 633 | ipStart: '222.5.62.128', 634 | ipEnd: '222.5.62.255', 635 | country: 'JP', 636 | carrier: 'AU (KDDI)' 637 | }, 638 | 639 | { 640 | ipStart: '222.7.57.0', 641 | ipEnd: '222.7.57.255', 642 | country: 'JP', 643 | carrier: 'AU (KDDI)' 644 | }, 645 | 646 | { 647 | ipStart: '59.135.38.128', 648 | ipEnd: '59.135.38.255', 649 | country: 'JP', 650 | carrier: 'AU (KDDI) ' 651 | }, 652 | 653 | { 654 | ipStart: '219.108.157.0', 655 | ipEnd: '219.108.157.255', 656 | country: 'JP', 657 | carrier: 'AU (KDDI)' 658 | }, 659 | 660 | { 661 | ipStart: '219.125.151.128', 662 | ipEnd: '219.125.151.255', 663 | country: 'JP', 664 | carrier: 'AU (KDDI)' 665 | }, 666 | 667 | { 668 | ipStart: '219.96.0.0', 669 | ipEnd: '219.127.255.255', 670 | country: 'JP', 671 | carrier: 'AU (KDDI)' 672 | }, 673 | 674 | { 675 | ipStart: '210.153.84.0', 676 | ipEnd: '210.153.84.255', 677 | country: 'JP', 678 | carrier: 'DoCoMo (i-mode)' 679 | }, 680 | 681 | { 682 | ipStart: '210.136.161.0', 683 | ipEnd: '210.136.161.255', 684 | country: 'JP', 685 | carrier: 'DoCoMo (i-mode) ' 686 | }, 687 | 688 | { 689 | ipStart: '210.153.86.0', 690 | ipEnd: '210.153.86.255', 691 | country: 'JP', 692 | carrier: 'DoCoMo (i-mode)' 693 | }, 694 | 695 | { 696 | ipStart: '210.153.87.0', 697 | ipEnd: '210.153.87.255', 698 | country: 'JP', 699 | carrier: 'DoCoMo (inet)' 700 | }, 701 | 702 | { 703 | ipStart: '203.138.180.0', 704 | ipEnd: '203.138.180.255', 705 | country: 'JP', 706 | carrier: 'DoCoMo (e-mail)' 707 | }, 708 | 709 | { 710 | ipStart: '203.138.181.0', 711 | ipEnd: '203.138.181.255', 712 | country: 'JP', 713 | carrier: 'DoCoMo (e-mail)' 714 | }, 715 | 716 | { 717 | ipStart: '203.138.203.0', 718 | ipEnd: '203.138.203.255', 719 | country: 'JP', 720 | carrier: 'DoCoMo (email)' 721 | }, 722 | 723 | { 724 | ipStart: '202.179.204.0', 725 | ipEnd: '202.179.204.255', 726 | country: 'JP', 727 | carrier: 'SoftBank' 728 | }, 729 | 730 | { 731 | ipStart: '202.253.96.248', 732 | ipEnd: '202.253.96.255', 733 | country: 'JP', 734 | carrier: 'SoftBank' 735 | }, 736 | 737 | { 738 | ipStart: '210.146.7.192', 739 | ipEnd: '210.146.7.255', 740 | country: 'JP', 741 | carrier: 'SoftBank' 742 | }, 743 | 744 | { 745 | ipStart: '210.146.60.192', 746 | ipEnd: '210.146.60.255', 747 | country: 'JP', 748 | carrier: 'SoftBank' 749 | }, 750 | 751 | { 752 | ipStart: '210.151.9.128', 753 | ipEnd: '210.151.9.191', 754 | country: 'JP', 755 | carrier: 'SoftBank' 756 | }, 757 | 758 | { 759 | ipStart: '210.169.130.112', 760 | ipEnd: '210.169.130.119', 761 | country: 'JP', 762 | carrier: 'SoftBank' 763 | }, 764 | 765 | { 766 | ipStart: '210.169.130.120', 767 | ipEnd: '210.169.130.127', 768 | country: 'JP', 769 | carrier: 'SoftBank' 770 | }, 771 | 772 | { 773 | ipStart: '210.169.176.0', 774 | ipEnd: '210.169.176.255', 775 | country: 'JP', 776 | carrier: 'SoftBank ' 777 | }, 778 | 779 | { 780 | ipStart: '210.175.1.128', 781 | ipEnd: '210.175.1.255', 782 | country: 'JP', 783 | carrier: 'SoftBank' 784 | }, 785 | 786 | { 787 | ipStart: '210.228.189.0', 788 | ipEnd: '210.228.189.255', 789 | country: 'JP', 790 | carrier: 'SoftBank' 791 | }, 792 | 793 | { 794 | ipStart: '211.8.159.128', 795 | ipEnd: '211.8.159.255', 796 | country: 'JP', 797 | carrier: 'SoftBank' 798 | }, 799 | 800 | { 801 | ipStart: '84.15.0.0', 802 | ipEnd: '84.15.255.255', 803 | country: 'LT', 804 | carrier: 'Bite' 805 | }, 806 | 807 | { 808 | ipStart: '213.226.128.0', 809 | ipEnd: '213.226.131.255', 810 | country: 'LT', 811 | carrier: 'Bite' 812 | }, 813 | 814 | { 815 | ipStart: '212.93.97.0', 816 | ipEnd: '212.93.97.255', 817 | country: 'LV', 818 | carrier: 'LMT' 819 | }, 820 | 821 | { 822 | ipStart: '194.134.0.0', 823 | ipEnd: '194.134.0.255', 824 | country: 'NL', 825 | carrier: 'EuroNet(ISP)' 826 | }, 827 | 828 | { 829 | ipStart: '212.45.191.0', 830 | ipEnd: '212.45.191.31', 831 | country: 'NO', 832 | carrier: 'Netcom' 833 | }, 834 | 835 | { 836 | ipStart: '130.244.196.90', 837 | ipEnd: '130.244.196.92', 838 | country: 'NO', 839 | carrier: 'Tele2' 840 | }, 841 | 842 | { 843 | ipStart: '212.17.128.0', 844 | ipEnd: '212.17.151.255', 845 | country: 'NO', 846 | carrier: 'Telenor' 847 | }, 848 | 849 | { 850 | ipStart: '166.179.37.130', 851 | ipEnd: '166.179.37.130', 852 | country: 'NZ', 853 | carrier: 'NZ Telco under WDSPCO?' 854 | }, 855 | 856 | { 857 | ipStart: '202.73.192.0', 858 | ipEnd: '202.73.207.255', 859 | country: 'NZ', 860 | carrier: 'Vodafone' 861 | }, 862 | 863 | { 864 | ipStart: '194.9.223.0', 865 | ipEnd: '194.9.223.255', 866 | country: 'PL', 867 | carrier: 'Orange (PTK-Centertel)' 868 | }, 869 | 870 | { 871 | ipStart: '212.18.178.0', 872 | ipEnd: '212.18.178.255', 873 | country: 'PT', 874 | carrier: 'Vodafone (Telecel)' 875 | }, 876 | 877 | { 878 | ipStart: '83.217.40.0', 879 | ipEnd: '83.217.43.255', 880 | country: 'RU', 881 | carrier: 'Moscow Cellular' 882 | }, 883 | 884 | { 885 | ipStart: '217.8.224.0', 886 | ipEnd: '217.8.235.255', 887 | country: 'RU', 888 | carrier: 'SCS' 889 | }, 890 | 891 | { 892 | ipStart: '217.118.84.0', 893 | ipEnd: '217.118.87.255', 894 | country: 'RU', 895 | carrier: 'Vimpelcom (beeoffice)' 896 | }, 897 | 898 | { 899 | ipStart: '212.129.104.0', 900 | ipEnd: '212.129.119.255', 901 | country: 'RU', 902 | carrier: 'Skylink' 903 | }, 904 | 905 | { 906 | ipStart: '130.244.0.0', 907 | ipEnd: '130.244.255.255', 908 | country: 'SE', 909 | carrier: 'Tele2' 910 | }, 911 | 912 | { 913 | ipStart: '192.71.148.0', 914 | ipEnd: '192.71.148.255', 915 | country: 'SE', 916 | carrier: 'Telia' 917 | }, 918 | 919 | { 920 | ipStart: '217.174.67.0', 921 | ipEnd: '217.174.67.255', 922 | country: 'SE', 923 | carrier: 'Telenor' 924 | }, 925 | 926 | { 927 | ipStart: '203.124.0.0', 928 | ipEnd: '203.124.3.255', 929 | country: 'SG', 930 | carrier: 'SingTel' 931 | }, 932 | 933 | { 934 | ipStart: '213.151.208.128', 935 | ipEnd: '213.151.208.255', 936 | country: 'SK', 937 | carrier: 'Orange (Globtel)' 938 | }, 939 | 940 | { 941 | ipStart: '203.170.228.0', 942 | ipEnd: '203.170.228.255', 943 | country: 'TH', 944 | carrier: 'Loxinfo (telco?)' 945 | }, 946 | 947 | { 948 | ipStart: '82.206.233.0', 949 | ipEnd: '82.206.233.255', 950 | country: 'TG', 951 | carrier: 'Togocel' 952 | }, 953 | 954 | { 955 | ipStart: '193.41.60.0', 956 | ipEnd: '193.41.63.255', 957 | country: 'UA', 958 | carrier: 'Kyivstar' 959 | }, 960 | 961 | { 962 | ipStart: '193.108.252.0', 963 | ipEnd: '193.108.255.255', 964 | country: 'UG', 965 | carrier: 'MTN-Uganda' 966 | }, 967 | 968 | { 969 | ipStart: '66.209.0.0', 970 | ipEnd: '66.209.31.255', 971 | country: 'US', 972 | carrier: 'Cingular' 973 | }, 974 | 975 | { 976 | ipStart: '68.24.0.0', 977 | ipEnd: '68.31.255.255', 978 | country: 'US', 979 | carrier: 'Sprint' 980 | }, 981 | 982 | { 983 | ipStart: '66.94.0.0', 984 | ipEnd: '66.94.31.255', 985 | country: 'US', 986 | carrier: 'T-Mobile' 987 | }, 988 | 989 | { 990 | ipStart: '170.206.246.0', 991 | ipEnd: '170.206.247.255', 992 | country: 'US', 993 | carrier: 'Nextel' 994 | }, 995 | 996 | { 997 | ipStart: '166.128.0.0', 998 | ipEnd: '166.255.255.255', 999 | country: 'US', 1000 | carrier: 'WDSPCO (ip leasing)' 1001 | }, 1002 | 1003 | { 1004 | ipStart: '200.40.246.0', 1005 | ipEnd: '200.40.246.63', 1006 | country: 'UY', 1007 | carrier: 'Ancel' 1008 | }, 1009 | 1010 | { 1011 | ipStart: '200.35.64.0', 1012 | ipEnd: '200.35.64.255', 1013 | country: 'VE', 1014 | carrier: 'Telcel' 1015 | }, 1016 | 1017 | { 1018 | ipStart: '196.11.240.228', 1019 | ipEnd: '196.11.245.33', 1020 | country: 'ZA', 1021 | carrier: 'MTN' 1022 | }, 1023 | 1024 | { 1025 | ipStart: '196.31.58.5', 1026 | ipEnd: '196.31.58.5', 1027 | country: 'ZA', 1028 | carrier: 'UUNET (telco?)' 1029 | }, 1030 | 1031 | { 1032 | ipStart: '196.207.32.253', 1033 | ipEnd: '196.207.45.254', 1034 | country: 'ZA', 1035 | carrier: 'Vodacom' 1036 | }, 1037 | 1038 | { 1039 | ipStart: '80.232.117.0', 1040 | ipEnd: '80.232.117.255', 1041 | country: 'OperaMini', 1042 | carrier: 'Opera' 1043 | } 1044 | ], 1045 | calcIpValue = function calcIpValue(ip) { 1046 | var i, 1047 | value = 0, 1048 | blockValue = 0, 1049 | ipBlocks = ip.split('.'); 1050 | 1051 | for (i = 0; i < ipBlocks.length; i++) { 1052 | blockValue = Math.pow(255, 4 - i); 1053 | value += blockValue * parseInt(ipBlocks[i], 10) / 255; 1054 | } 1055 | 1056 | return value; 1057 | }, 1058 | req = new XMLHttpRequest(); 1059 | 1060 | req.onload = function () { 1061 | var result, 1062 | ip, 1063 | isMobile = false, 1064 | ipInRange = function ipInRange(ipBlock) { 1065 | if ( 1066 | calcIpValue(ip) >= calcIpValue(ipBlock.ipStart) && 1067 | calcIpValue(ip) >= calcIpValue(ipBlock.ipEnd) 1068 | ) { 1069 | isMobile = true; 1070 | 1071 | if (window.console) { 1072 | console.log('Detected mobile carrier IP: ' + ipBlock.carrier); 1073 | } 1074 | } 1075 | }; 1076 | 1077 | try { 1078 | result = JSON.parse(req.response); 1079 | ip = result.ip; 1080 | carrierIpBlocks.forEach(ipInRange); 1081 | 1082 | if (isMobile) { 1083 | callback.call(undefined, 'cellular'); 1084 | } else { 1085 | callback.call(undefined, 'broadband'); 1086 | } 1087 | } catch (e) { 1088 | callback.call(undefined, 'broadband'); 1089 | } 1090 | }; 1091 | req.onerror = function () { 1092 | callback.call(undefined, 'broadband'); 1093 | }; 1094 | req.open('GET', 'https://api.ipify.org?format=json'); 1095 | req.send(); 1096 | } 1097 | 1098 | function getConnectionType(callback) { 1099 | var connection = 1100 | navigator.connection || 1101 | navigator.msConnection || 1102 | navigator.mozConnection || 1103 | navigator.webkitConnection; 1104 | 1105 | if (typeof navigator.onLine !== 'undefined' && !navigator.onLine) { 1106 | callback.call(undefined, 'offline'); 1107 | } 1108 | else if (connection) { 1109 | if (window.console) { 1110 | console.log('Using navigator.connection'); 1111 | } 1112 | 1113 | switch (connection.type) { 1114 | default: 1115 | callback.call(undefined, 'broadband'); 1116 | break; 1117 | 1118 | case 'none': 1119 | callback.call(undefined, 'offline'); 1120 | break; 1121 | 1122 | case 'bluetooth': 1123 | case 'cellular': 1124 | callback.call(undefined, 'cellular'); 1125 | break; 1126 | } 1127 | } 1128 | else if (window.performance && window.performance.getEntries) { 1129 | var req = new XMLHttpRequest(); 1130 | 1131 | if (window.console) { 1132 | console.log('Using window.performance'); 1133 | } 1134 | 1135 | req.addEventListener('load', function () { 1136 | var entries = window.performance.getEntries(), 1137 | latency = entries[0].responseStart - entries[0].requestStart; 1138 | 1139 | if (latency >= 100) { 1140 | callback.call(undefined, 'cellular'); 1141 | } else { 1142 | callback.call(undefined, 'broadband'); 1143 | } 1144 | }); 1145 | req.addEventListener('error', function () { 1146 | callback.call(undefined, 'offline'); 1147 | }); 1148 | req.open('GET', location.pathname + '?nocache=' + (new Date()).getTime()); 1149 | req.send(); 1150 | } else { 1151 | isMobileIp(callback); 1152 | } 1153 | } 1154 | 1155 | // Just return a value to define the module export. 1156 | // This example returns an object, but the module 1157 | // can return a function as the exported value. 1158 | return { 1159 | getConnectionType: getConnectionType 1160 | }; 1161 | })); 1162 | -------------------------------------------------------------------------------- /gruntfile.js: -------------------------------------------------------------------------------- 1 | module.exports = function(grunt) { 2 | 3 | grunt.initConfig({ 4 | release: { 5 | options: { 6 | npm: false //default: true 7 | } 8 | } 9 | }); 10 | 11 | grunt.loadNpmTasks('grunt-release'); 12 | 13 | grunt.registerTask('default', []); 14 | 15 | }; 16 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "connection-type-checker", 3 | "version": "1.2.0", 4 | "description": "Utility that tries to figure out if you are on cellular or broadband", 5 | "main": "connection-type-checker.js", 6 | "directories": { 7 | "test": "test" 8 | }, 9 | "dependencies": {}, 10 | "devDependencies": { 11 | "grunt": "^0.4.5", 12 | "grunt-release": "^0.13.0" 13 | }, 14 | "scripts": { 15 | "test": "echo \"Error: no test specified\" && exit 1" 16 | }, 17 | "keywords": [ 18 | "connection", 19 | "type", 20 | "mobile" 21 | ], 22 | "author": "Christian Schaefer ", 23 | "license": "MIT" 24 | } 25 | -------------------------------------------------------------------------------- /src/gurfl.json: -------------------------------------------------------------------------------- 1 | // Taken from: 2 | // http://www.nitingautam.com/operator.csv 3 | [ 4 | { 5 | "ipStart": "213.162.64.0", 6 | "ipEnd": "213.162.67.255", 7 | "country": "AT", 8 | "carrier": "T-Mobile (Maxmobil)" 9 | }, 10 | { 11 | "ipStart": "203.20.32.0", 12 | "ipEnd": "203.20.39.255", 13 | "country": "AU", 14 | "carrier": "Vodafone " 15 | }, 16 | { 17 | "ipStart": "58.145.128.0", 18 | "ipEnd": "58.145.159.255", 19 | "country": "AU", 20 | "carrier": "Optus" 21 | }, 22 | { 23 | "ipStart": "202.124.64.0", 24 | "ipEnd": "202.124.95.255", 25 | "country": "AU", 26 | "carrier": "H3G" 27 | }, 28 | { 29 | "ipStart": "203.171.192.0", 30 | "ipEnd": "203.171.207.255", 31 | "country": "AU", 32 | "carrier": "H3G" 33 | }, 34 | { 35 | "ipStart": "192.148.116.0", 36 | "ipEnd": "192.148.165.255", 37 | "country": "AU", 38 | "carrier": "Telstra" 39 | }, 40 | { 41 | "ipStart": "212.39.122.0", 42 | "ipEnd": "212.39.122.255", 43 | "country": "BA", 44 | "carrier": "Eronet" 45 | }, 46 | { 47 | "ipStart": "202.134.8.0", 48 | "ipEnd": "202.134.15.255", 49 | "country": "BD", 50 | "carrier": "AKTEL" 51 | }, 52 | { 53 | "ipStart": "217.72.228.0", 54 | "ipEnd": "217.72.231.255", 55 | "country": "BE", 56 | "carrier": "BASE" 57 | }, 58 | { 59 | "ipStart": "212.65.63.0", 60 | "ipEnd": "212.65.63.255", 61 | "country": "BE", 62 | "carrier": "Orange (Mobistar)" 63 | }, 64 | { 65 | "ipStart": "81.169.60.0", 66 | "ipEnd": "81.169.63.255", 67 | "country": "BE", 68 | "carrier": "Proximus" 69 | }, 70 | { 71 | "ipStart": "200.140.0.0", 72 | "ipEnd": "200.150.66.255", 73 | "country": "BR", 74 | "carrier": "Brazil Telecom" 75 | }, 76 | { 77 | "ipStart": "200.179.66.192", 78 | "ipEnd": "200.179.66.255", 79 | "country": "BR", 80 | "carrier": "TIM" 81 | }, 82 | { 83 | "ipStart": "189.0.0.0", 84 | "ipEnd": "189.0.255.255", 85 | "country": "BR", 86 | "carrier": "VIVO" 87 | }, 88 | { 89 | "ipStart": "206.47.78.128", 90 | "ipEnd": "206.47.78.159", 91 | "country": "CA", 92 | "carrier": "Bell Mobilite" 93 | }, 94 | { 95 | "ipStart": "212.35.32.0", 96 | "ipEnd": "212.35.47.255", 97 | "country": "CH", 98 | "carrier": "Sunrise (Diax)" 99 | }, 100 | { 101 | "ipStart": "194.230.144.0", 102 | "ipEnd": "194.230.159.255", 103 | "country": "CH", 104 | "carrier": "Sunrise (Diax)" 105 | }, 106 | { 107 | "ipStart": "213.55.128.0", 108 | "ipEnd": "213.55.255.255", 109 | "country": "CH", 110 | "carrier": "Orange" 111 | }, 112 | { 113 | "ipStart": "138.188.0.0", 114 | "ipEnd": "138.188.255.255", 115 | "country": "CH", 116 | "carrier": "Swisscom" 117 | }, 118 | { 119 | "ipStart": "200.91.0.0", 120 | "ipEnd": "200.91.31.255", 121 | "country": "CL", 122 | "carrier": "Telefonica CTC" 123 | }, 124 | { 125 | "ipStart": "217.77.164.0", 126 | "ipEnd": "217.77.165.255", 127 | "country": "CZ", 128 | "carrier": "Vodafone (oskarmobil)" 129 | }, 130 | { 131 | "ipStart": "84.57.113.0", 132 | "ipEnd": "84.61.96.255", 133 | "country": "DE", 134 | "carrier": "Arcor" 135 | }, 136 | { 137 | "ipStart": "82.113.100.0", 138 | "ipEnd": "82.113.100.255", 139 | "country": "DE", 140 | "carrier": "O2" 141 | }, 142 | { 143 | "ipStart": "80.187.0.0", 144 | "ipEnd": "80.187.111.255", 145 | "country": "DE", 146 | "carrier": "T-Mobile" 147 | }, 148 | { 149 | "ipStart": "139.7.0.0", 150 | "ipEnd": "139.7.255.255", 151 | "country": "DE", 152 | "carrier": "Vodafone" 153 | }, 154 | { 155 | "ipStart": "80.251.192.0", 156 | "ipEnd": "80.251.207.255", 157 | "country": "DK", 158 | "carrier": "H3G (SE?)" 159 | }, 160 | { 161 | "ipStart": "194.182.251.0", 162 | "ipEnd": "194.182.251.63", 163 | "country": "DK", 164 | "carrier": "Tele Danmark (TDC)" 165 | }, 166 | { 167 | "ipStart": "62.44.128.0", 168 | "ipEnd": "62.44.191.255", 169 | "country": "DK", 170 | "carrier": "Teliamobile" 171 | }, 172 | { 173 | "ipStart": "217.71.32.0", 174 | "ipEnd": "217.71.35.12", 175 | "country": "EE", 176 | "carrier": "EMT" 177 | }, 178 | { 179 | "ipStart": "213.143.32.0", 180 | "ipEnd": "213.143.43.255", 181 | "country": "ES", 182 | "carrier": "Amena" 183 | }, 184 | { 185 | "ipStart": "195.55.47.0", 186 | "ipEnd": "195.55.47.63", 187 | "country": "ES", 188 | "carrier": "Telefonica" 189 | }, 190 | { 191 | "ipStart": "80.27.0.0", 192 | "ipEnd": "80.27.127.255", 193 | "country": "ES", 194 | "carrier": "Telefonica TME" 195 | }, 196 | { 197 | "ipStart": "62.87.92.0", 198 | "ipEnd": "62.87.92.63", 199 | "country": "ES", 200 | "carrier": "Vodafone" 201 | }, 202 | { 203 | "ipStart": "62.142.0.0", 204 | "ipEnd": "62.142.7.255", 205 | "country": "FI", 206 | "carrier": "Saunalahti" 207 | }, 208 | { 209 | "ipStart": "193.209.131.0", 210 | "ipEnd": "193.209.134.255", 211 | "country": "FI", 212 | "carrier": "Sonera" 213 | }, 214 | { 215 | "ipStart": "62.201.128.0", 216 | "ipEnd": "62.201.129.255", 217 | "country": "FR", 218 | "carrier": "Bouygues Telecom" 219 | }, 220 | { 221 | "ipStart": "213.223.200.0", 222 | "ipEnd": "213.223.200.255", 223 | "country": "FR", 224 | "carrier": "Cegetel" 225 | }, 226 | { 227 | "ipStart": "195.115.116.0", 228 | "ipEnd": "195.115.119.255", 229 | "country": "FR", 230 | "carrier": "Cegetel" 231 | }, 232 | { 233 | "ipStart": "194.206.212.0", 234 | "ipEnd": "194.206.212.7", 235 | "country": "FR", 236 | "carrier": "Orange (France Telecom)" 237 | }, 238 | { 239 | "ipStart": "193.113.235.0", 240 | "ipEnd": "193.113.235.255", 241 | "country": "GB", 242 | "carrier": "02" 243 | }, 244 | { 245 | "ipStart": "193.113.200.0", 246 | "ipEnd": "193.113.200.255", 247 | "country": "GB", 248 | "carrier": "O2" 249 | }, 250 | { 251 | "ipStart": "89.192.0.0 ", 252 | "ipEnd": "89.193.255.255", 253 | "country": "GB", 254 | "carrier": "Orange" 255 | }, 256 | { 257 | "ipStart": "213.205.192.0", 258 | "ipEnd": "213.205.223.255", 259 | "country": "GB", 260 | "carrier": "Orange" 261 | }, 262 | { 263 | "ipStart": "213.205.224.0", 264 | "ipEnd": "213.205.255.255", 265 | "country": "GB", 266 | "carrier": "Orange" 267 | }, 268 | { 269 | "ipStart": "193.35.128.0", 270 | "ipEnd": "193.35.143.255", 271 | "country": "GB", 272 | "carrier": "Orange" 273 | }, 274 | { 275 | "ipStart": "149.254.0.0", 276 | "ipEnd": "149.254.255.255", 277 | "country": "GB", 278 | "carrier": "T-Mobile" 279 | }, 280 | { 281 | "ipStart": "212.183.128.0", 282 | "ipEnd": "212.183.144.255", 283 | "country": "GB", 284 | "carrier": "Vodafone" 285 | }, 286 | { 287 | "ipStart": "195.167.65.0", 288 | "ipEnd": "195.167.65.255", 289 | "country": "GR", 290 | "carrier": "Cosmote" 291 | }, 292 | { 293 | "ipStart": "62.103.102.0", 294 | "ipEnd": "62.103.103.255", 295 | "country": "GR", 296 | "carrier": "Cosmote" 297 | }, 298 | { 299 | "ipStart": "84.224.0.0", 300 | "ipEnd": "84.224.63.255", 301 | "country": "HU", 302 | "carrier": "Pannon" 303 | }, 304 | { 305 | "ipStart": "212.51.126.0", 306 | "ipEnd": "212.51.126.255", 307 | "country": "HU", 308 | "carrier": "T-Mobile (Westel)" 309 | }, 310 | { 311 | "ipStart": "202.93.36.0", 312 | "ipEnd": "202.93.37.255", 313 | "country": "ID", 314 | "carrier": "Indosat (Mentari/IM3)" 315 | }, 316 | { 317 | "ipStart": "219.83.36.128", 318 | "ipEnd": "219.83.36.143", 319 | "country": "ID", 320 | "carrier": "Indosat (XL?)" 321 | }, 322 | { 323 | "ipStart": "212.129.64.0", 324 | "ipEnd": "212.129.64.255", 325 | "country": "IE", 326 | "carrier": "Meteor" 327 | }, 328 | { 329 | "ipStart": "62.40.32.0", 330 | "ipEnd": "62.40.63.255", 331 | "country": "IE", 332 | "carrier": "O2" 333 | }, 334 | { 335 | "ipStart": "213.233.128.0", 336 | "ipEnd": "213.233.159.255", 337 | "country": "IE", 338 | "carrier": "Vodafone" 339 | }, 340 | { 341 | "ipStart": "192.118.8.0", 342 | "ipEnd": "192.118.11.255", 343 | "country": "IL", 344 | "carrier": "Orange (via Partner Comms?)" 345 | }, 346 | { 347 | "ipStart": "203.145.128.0", 348 | "ipEnd": "203.145.128.15", 349 | "country": "IN", 350 | "carrier": "Bharti" 351 | }, 352 | { 353 | "ipStart": "203.145.159.32", 354 | "ipEnd": "203.145.159.47", 355 | "country": "IN", 356 | "carrier": "Bharti" 357 | }, 358 | { 359 | "ipStart": "59.145.208.0", 360 | "ipEnd": "59.145.208.255", 361 | "country": "IN", 362 | "carrier": "Bharti" 363 | }, 364 | { 365 | "ipStart": "202.56.231.112", 366 | "ipEnd": "202.56.231.127", 367 | "country": "IN", 368 | "carrier": "Bharti" 369 | }, 370 | { 371 | "ipStart": "220.227.211.0", 372 | "ipEnd": "220.227.211.255", 373 | "country": "IN", 374 | "carrier": "Reliance" 375 | }, 376 | { 377 | "ipStart": "219.64.0.0", 378 | "ipEnd": "219.65.255.255", 379 | "country": "IN", 380 | "carrier": "VSNL" 381 | }, 382 | { 383 | "ipStart": "151.80.0.0", 384 | "ipEnd": "151.80.255.255", 385 | "country": "IT", 386 | "carrier": "Infostrada (telco?)" 387 | }, 388 | { 389 | "ipStart": "151.83.0.0", 390 | "ipEnd": "151.83.255.255", 391 | "country": "IT", 392 | "carrier": "Infostrada (telco?)" 393 | }, 394 | { 395 | "ipStart": "213.26.0.0", 396 | "ipEnd": "213.26.255.255", 397 | "country": "IT", 398 | "carrier": "Interbusiness/Telecom Italia?" 399 | }, 400 | { 401 | "ipStart": "83.224.0.0", 402 | "ipEnd": "83.225.255.255", 403 | "country": "IT", 404 | "carrier": "Vodafone" 405 | }, 406 | { 407 | "ipStart": "210.169.40.0", 408 | "ipEnd": "210.169.40.255", 409 | "country": "JP", 410 | "carrier": "AU (KDDI)" 411 | }, 412 | { 413 | "ipStart": "210.196.3.192", 414 | "ipEnd": "210.196.3.255", 415 | "country": "JP", 416 | "carrier": "AU (KDDI) " 417 | }, 418 | { 419 | "ipStart": "210.196.5.192", 420 | "ipEnd": "210.196.5.255", 421 | "country": "JP", 422 | "carrier": "AU (KDDI) " 423 | }, 424 | { 425 | "ipStart": "210.230.128.0", 426 | "ipEnd": "210.230.128.255", 427 | "country": "JP", 428 | "carrier": "AU (KDDI) " 429 | }, 430 | { 431 | "ipStart": "210.230.141.192", 432 | "ipEnd": "210.230.141.255", 433 | "country": "JP", 434 | "carrier": "AU (KDDI)" 435 | }, 436 | { 437 | "ipStart": "210.234.105.32", 438 | "ipEnd": "210.234.105.39", 439 | "country": "JP", 440 | "carrier": "AU (KDDI)" 441 | }, 442 | { 443 | "ipStart": "210.234.108.64", 444 | "ipEnd": "210.234.108.127", 445 | "country": "JP", 446 | "carrier": "AU (KDDI)" 447 | }, 448 | { 449 | "ipStart": "210.251.1.192", 450 | "ipEnd": "210.251.1.255", 451 | "country": "JP", 452 | "carrier": "AU (KDDI)" 453 | }, 454 | { 455 | "ipStart": "210.251.2.0", 456 | "ipEnd": "210.251.2.31", 457 | "country": "JP", 458 | "carrier": "AU (KDDI)" 459 | }, 460 | { 461 | "ipStart": "211.5.1.0", 462 | "ipEnd": "211.5.1.255", 463 | "country": "JP", 464 | "carrier": "AU (KDDI)" 465 | }, 466 | { 467 | "ipStart": "211.5.2.128", 468 | "ipEnd": "211.5.2.255", 469 | "country": "JP", 470 | "carrier": "AU (KDDI)" 471 | }, 472 | { 473 | "ipStart": "211.5.7.0", 474 | "ipEnd": "211.5.7.255", 475 | "country": "JP", 476 | "carrier": "AU (KDDI)" 477 | }, 478 | { 479 | "ipStart": "218.222.1.0", 480 | "ipEnd": "218.222.1.255", 481 | "country": "JP", 482 | "carrier": "AU (KDDI)" 483 | }, 484 | { 485 | "ipStart": "61.117.0.0", 486 | "ipEnd": "61.117.0.255", 487 | "country": "JP", 488 | "carrier": "AU (KDDI)" 489 | }, 490 | { 491 | "ipStart": "61.117.1.0", 492 | "ipEnd": "61.117.1.255", 493 | "country": "JP", 494 | "carrier": "AU (KDDI)" 495 | }, 496 | { 497 | "ipStart": "61.117.2.0", 498 | "ipEnd": "61.117.2.63", 499 | "country": "JP", 500 | "carrier": "AU (KDDI)" 501 | }, 502 | { 503 | "ipStart": "61.202.3.0", 504 | "ipEnd": "61.202.3.255", 505 | "country": "JP", 506 | "carrier": "AU (KDDI)" 507 | }, 508 | { 509 | "ipStart": "219.108.158.0", 510 | "ipEnd": "219.108.158.63", 511 | "country": "JP", 512 | "carrier": "AU (KDDI)" 513 | }, 514 | { 515 | "ipStart": "219.125.148.0", 516 | "ipEnd": "219.125.148.255", 517 | "country": "JP", 518 | "carrier": "AU (KDDI)" 519 | }, 520 | { 521 | "ipStart": "222.5.63.0", 522 | "ipEnd": "222.5.63.255", 523 | "country": "JP", 524 | "carrier": "AU (KDDI)" 525 | }, 526 | { 527 | "ipStart": "222.7.56.0", 528 | "ipEnd": "222.7.56.255", 529 | "country": "JP", 530 | "carrier": "AU (KDDI)" 531 | }, 532 | { 533 | "ipStart": "222.5.62.128", 534 | "ipEnd": "222.5.62.255", 535 | "country": "JP", 536 | "carrier": "AU (KDDI)" 537 | }, 538 | { 539 | "ipStart": "222.7.57.0", 540 | "ipEnd": "222.7.57.255", 541 | "country": "JP", 542 | "carrier": "AU (KDDI)" 543 | }, 544 | { 545 | "ipStart": "59.135.38.128", 546 | "ipEnd": "59.135.38.255", 547 | "country": "JP", 548 | "carrier": "AU (KDDI) " 549 | }, 550 | { 551 | "ipStart": "219.108.157.0", 552 | "ipEnd": "219.108.157.255", 553 | "country": "JP", 554 | "carrier": "AU (KDDI)" 555 | }, 556 | { 557 | "ipStart": "219.125.151.128", 558 | "ipEnd": "219.125.151.255", 559 | "country": "JP", 560 | "carrier": "AU (KDDI)" 561 | }, 562 | { 563 | "ipStart": "219.96.0.0", 564 | "ipEnd": "219.127.255.255", 565 | "country": "JP", 566 | "carrier": "AU (KDDI)" 567 | }, 568 | { 569 | "ipStart": "210.153.84.0", 570 | "ipEnd": "210.153.84.255", 571 | "country": "JP", 572 | "carrier": "DoCoMo (i-mode)" 573 | }, 574 | { 575 | "ipStart": "210.136.161.0", 576 | "ipEnd": "210.136.161.255", 577 | "country": "JP", 578 | "carrier": "DoCoMo (i-mode) " 579 | }, 580 | { 581 | "ipStart": "210.153.86.0", 582 | "ipEnd": "210.153.86.255", 583 | "country": "JP", 584 | "carrier": "DoCoMo (i-mode)" 585 | }, 586 | { 587 | "ipStart": "210.153.87.0", 588 | "ipEnd": "210.153.87.255", 589 | "country": "JP", 590 | "carrier": "DoCoMo (inet)" 591 | }, 592 | { 593 | "ipStart": "203.138.180.0", 594 | "ipEnd": "203.138.180.255", 595 | "country": "JP", 596 | "carrier": "DoCoMo (e-mail)" 597 | }, 598 | { 599 | "ipStart": "203.138.181.0", 600 | "ipEnd": "203.138.181.255", 601 | "country": "JP", 602 | "carrier": "DoCoMo (e-mail)" 603 | }, 604 | { 605 | "ipStart": "203.138.203.0", 606 | "ipEnd": "203.138.203.255", 607 | "country": "JP", 608 | "carrier": "DoCoMo (email)" 609 | }, 610 | { 611 | "ipStart": "202.179.204.0", 612 | "ipEnd": "202.179.204.255", 613 | "country": "JP", 614 | "carrier": "SoftBank" 615 | }, 616 | { 617 | "ipStart": "202.253.96.248", 618 | "ipEnd": "202.253.96.255", 619 | "country": "JP", 620 | "carrier": "SoftBank" 621 | }, 622 | { 623 | "ipStart": "210.146.7.192", 624 | "ipEnd": "210.146.7.255", 625 | "country": "JP", 626 | "carrier": "SoftBank" 627 | }, 628 | { 629 | "ipStart": "210.146.60.192", 630 | "ipEnd": "210.146.60.255", 631 | "country": "JP", 632 | "carrier": "SoftBank" 633 | }, 634 | { 635 | "ipStart": "210.151.9.128", 636 | "ipEnd": "210.151.9.191", 637 | "country": "JP", 638 | "carrier": "SoftBank" 639 | }, 640 | { 641 | "ipStart": "210.169.130.112", 642 | "ipEnd": "210.169.130.119", 643 | "country": "JP", 644 | "carrier": "SoftBank" 645 | }, 646 | { 647 | "ipStart": "210.169.130.120", 648 | "ipEnd": "210.169.130.127", 649 | "country": "JP", 650 | "carrier": "SoftBank" 651 | }, 652 | { 653 | "ipStart": "210.169.176.0", 654 | "ipEnd": "210.169.176.255", 655 | "country": "JP", 656 | "carrier": "SoftBank " 657 | }, 658 | { 659 | "ipStart": "210.175.1.128", 660 | "ipEnd": "210.175.1.255", 661 | "country": "JP", 662 | "carrier": "SoftBank" 663 | }, 664 | { 665 | "ipStart": "210.228.189.0", 666 | "ipEnd": "210.228.189.255", 667 | "country": "JP", 668 | "carrier": "SoftBank" 669 | }, 670 | { 671 | "ipStart": "211.8.159.128", 672 | "ipEnd": "211.8.159.255", 673 | "country": "JP", 674 | "carrier": "SoftBank" 675 | }, 676 | { 677 | "ipStart": "84.15.0.0", 678 | "ipEnd": "84.15.255.255", 679 | "country": "LT", 680 | "carrier": "Bite" 681 | }, 682 | { 683 | "ipStart": "213.226.128.0", 684 | "ipEnd": "213.226.131.255", 685 | "country": "LT", 686 | "carrier": "Bite" 687 | }, 688 | { 689 | "ipStart": "212.93.97.0", 690 | "ipEnd": "212.93.97.255", 691 | "country": "LV", 692 | "carrier": "LMT" 693 | }, 694 | { 695 | "ipStart": "194.134.0.0", 696 | "ipEnd": "194.134.0.255", 697 | "country": "NL", 698 | "carrier": "EuroNet(ISP)" 699 | }, 700 | { 701 | "ipStart": "212.45.191.0", 702 | "ipEnd": "212.45.191.31", 703 | "country": "NO", 704 | "carrier": "Netcom" 705 | }, 706 | { 707 | "ipStart": "130.244.196.90", 708 | "ipEnd": "130.244.196.92", 709 | "country": "NO", 710 | "carrier": "Tele2" 711 | }, 712 | { 713 | "ipStart": "212.17.128.0", 714 | "ipEnd": "212.17.151.255", 715 | "country": "NO", 716 | "carrier": "Telenor" 717 | }, 718 | { 719 | "ipStart": "166.179.37.130", 720 | "ipEnd": "166.179.37.130", 721 | "country": "NZ", 722 | "carrier": "NZ Telco under WDSPCO?" 723 | }, 724 | { 725 | "ipStart": "202.73.192.0", 726 | "ipEnd": "202.73.207.255", 727 | "country": "NZ", 728 | "carrier": "Vodafone" 729 | }, 730 | { 731 | "ipStart": "194.9.223.0", 732 | "ipEnd": "194.9.223.255", 733 | "country": "PL", 734 | "carrier": "Orange (PTK-Centertel)" 735 | }, 736 | { 737 | "ipStart": "212.18.178.0", 738 | "ipEnd": "212.18.178.255", 739 | "country": "PT", 740 | "carrier": "Vodafone (Telecel)" 741 | }, 742 | { 743 | "ipStart": "83.217.40.0", 744 | "ipEnd": "83.217.43.255", 745 | "country": "RU", 746 | "carrier": "Moscow Cellular" 747 | }, 748 | { 749 | "ipStart": "217.8.224.0", 750 | "ipEnd": "217.8.235.255", 751 | "country": "RU", 752 | "carrier": "SCS" 753 | }, 754 | { 755 | "ipStart": "217.118.84.0", 756 | "ipEnd": "217.118.87.255", 757 | "country": "RU", 758 | "carrier": "Vimpelcom (beeoffice)" 759 | }, 760 | { 761 | "ipStart": "212.129.104.0", 762 | "ipEnd": "212.129.119.255", 763 | "country": "RU", 764 | "carrier": "Skylink" 765 | }, 766 | { 767 | "ipStart": "130.244.0.0", 768 | "ipEnd": "130.244.255.255", 769 | "country": "SE", 770 | "carrier": "Tele2" 771 | }, 772 | { 773 | "ipStart": "192.71.148.0", 774 | "ipEnd": "192.71.148.255", 775 | "country": "SE", 776 | "carrier": "Telia" 777 | }, 778 | { 779 | "ipStart": "217.174.67.0", 780 | "ipEnd": "217.174.67.255", 781 | "country": "SE", 782 | "carrier": "Telenor" 783 | }, 784 | { 785 | "ipStart": "203.124.0.0", 786 | "ipEnd": "203.124.3.255", 787 | "country": "SG", 788 | "carrier": "SingTel" 789 | }, 790 | { 791 | "ipStart": "213.151.208.128", 792 | "ipEnd": "213.151.208.255", 793 | "country": "SK", 794 | "carrier": "Orange (Globtel)" 795 | }, 796 | { 797 | "ipStart": "203.170.228.0", 798 | "ipEnd": "203.170.228.255", 799 | "country": "TH", 800 | "carrier": "Loxinfo (telco?)" 801 | }, 802 | { 803 | "ipStart": "82.206.233.0", 804 | "ipEnd": "82.206.233.255", 805 | "country": "TG", 806 | "carrier": "Togocel" 807 | }, 808 | { 809 | "ipStart": "193.41.60.0", 810 | "ipEnd": "193.41.63.255", 811 | "country": "UA", 812 | "carrier": "Kyivstar" 813 | }, 814 | { 815 | "ipStart": "193.108.252.0", 816 | "ipEnd": "193.108.255.255", 817 | "country": "UG", 818 | "carrier": "MTN-Uganda" 819 | }, 820 | { 821 | "ipStart": "66.209.0.0", 822 | "ipEnd": "66.209.31.255", 823 | "country": "US", 824 | "carrier": "Cingular" 825 | }, 826 | { 827 | "ipStart": "68.24.0.0", 828 | "ipEnd": "68.31.255.255", 829 | "country": "US", 830 | "carrier": "Sprint" 831 | }, 832 | { 833 | "ipStart": "66.94.0.0", 834 | "ipEnd": "66.94.31.255", 835 | "country": "US", 836 | "carrier": "T-Mobile" 837 | }, 838 | { 839 | "ipStart": "170.206.246.0", 840 | "ipEnd": "170.206.247.255", 841 | "country": "US", 842 | "carrier": "Nextel" 843 | }, 844 | { 845 | "ipStart": "166.128.0.0", 846 | "ipEnd": "166.255.255.255", 847 | "country": "US", 848 | "carrier": "WDSPCO (ip leasing)" 849 | }, 850 | { 851 | "ipStart": "200.40.246.0", 852 | "ipEnd": "200.40.246.63", 853 | "country": "UY", 854 | "carrier": "Ancel" 855 | }, 856 | { 857 | "ipStart": "200.35.64.0", 858 | "ipEnd": "200.35.64.255", 859 | "country": "VE", 860 | "carrier": "Telcel" 861 | }, 862 | { 863 | "ipStart": "196.11.240.228", 864 | "ipEnd": "196.11.245.33", 865 | "country": "ZA", 866 | "carrier": "MTN" 867 | }, 868 | { 869 | "ipStart": "196.31.58.5", 870 | "ipEnd": "196.31.58.5", 871 | "country": "ZA", 872 | "carrier": "UUNET (telco?)" 873 | }, 874 | { 875 | "ipStart": "196.207.32.253", 876 | "ipEnd": "196.207.45.254", 877 | "country": "ZA", 878 | "carrier": "Vodacom" 879 | }, 880 | { 881 | "ipStart": "80.232.117.0", 882 | "ipEnd": "80.232.117.255", 883 | "country": "OperaMini", 884 | "carrier": "Opera" 885 | } 886 | ] 887 | -------------------------------------------------------------------------------- /test/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Connection Type Checker Test 6 | 7 | 12 | 13 | 14 | 15 | 16 | --------------------------------------------------------------------------------