Speedtest.net servers

parent 24d73eba
......@@ -23,6 +23,7 @@
"@types/ip-address": "^5.8.2",
"@types/lusca": "^1.6.1",
"@types/node": "^12.7.3",
"@types/xml2js": "^0.4.5",
"axios": "^0.19.0",
"babel-preset-minify": "^0.5.1",
"bootstrap": "^4.3.1",
......@@ -48,7 +49,8 @@
"punycode": "^2.1.1",
"svg-country-flags": "^1.2.6",
"twig": "^1.13.3",
"typescript": "^3.6.2"
"typescript": "^3.6.2",
"xml2js": "^0.4.22"
},
"devDependencies": {
"nodemon": "^1.19.1",
......
$(document).ready(function () {
$('#speedtestServerTable').DataTable({
"columnDefs": [{
"orderable": false,
"targets": 'no-sort',
}],
"responsive": true,
});
});
\ No newline at end of file
......@@ -61,6 +61,9 @@ twig.extendFunction("portSizeProcessor", (rawSize: string) => {
import txtParser from "./view-functions/txtParser";
twig.extendFunction("txtParser", txtParser);
import hostnamePortSplitter from "./view-functions/hostnamePortSplitter";
twig.extendFunction("hostnamePortSplitter", hostnamePortSplitter);
twig.extendFunction("getReverse", (ipAddr: string): string => {
return "";
})
......
import { NextFunction, Request, Response, Router, response } from "express";
import axios from "axios";
const router: Router = Router();
import { request } from "graphql-request";
import Axios from "axios";
import xml2js from "xml2js";
/**
* @param num The number to round
......@@ -85,6 +86,7 @@ router.get("/asn/:pageNumber([0-9][0-9]?[0-9]?)", (req: Request, res: Response,
})
.catch(next);
});
/**
* Browse IPs
*/
......@@ -95,4 +97,37 @@ router.get("/ip", (req: Request, res: Response, next: NextFunction) => {
});
});
/**
* Browse Speedtest.net servers
*/
router.get("/speedtest-servers/", (req: Request, res: Response, next: NextFunction) => {
Axios.get(`https://www.speedtest.net/speedtest-servers.php`)
.then(x => x.data)
.then(rawXmlData => {
const parser = new xml2js.Parser({});
parser.parseStringPromise(rawXmlData)
.then(data => data.settings.servers)
.then(data => data[0].server)
.then(servers => {
const finalData = [];
servers.forEach(server => {
finalData.push(server['$']);
});
return finalData;
})
.then(servers => {
res.render("explore/speedtest-servers.twig", {
title: `Browse Speedtest.net servers`,
canonical_url: `/explore/speedtest-servers/`,
servers,
})
})
.catch(next);
})
.catch(next)
});
export const ExploreController: Router = router;
function split(input: string): { hostname: string, port } {
const x = input.split(":");
return {
hostname: x[0],
port: x[1],
}
}
function hostnamePortSplitter(input: string): string {
const data = split(input);
return `<a href="/search?q=${data.hostname}">${data.hostname}</a>:${data.port}`;
}
export default hostnamePortSplitter;
\ No newline at end of file
......@@ -18,6 +18,7 @@
{# <a class="dropdown-item" href="/explore/ip">Browse IPs</a> #}
<a class="dropdown-item" href="/tld/">Top Level Domains</a>
<a class="dropdown-item" href="/tor-relay/">Tor relays</a>
<a class="dropdown-item" href="/explore/speedtest-servers/">Speedtest.net servers</a>
</div>
</li>
<li class="nav-item dropdown">
......@@ -37,7 +38,7 @@
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="/docs/">API</a>
<a class="nav-link" href="/docs/">Documentation</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/about/">About</a>
......
......@@ -57,9 +57,10 @@
https://api.telcodb.net/peeringdb/asn?q=6939
</a>
<pre class="mb-0"><code>$ curl -I https://api.telcodb.net/peeringdb/asn?q=6939
<pre class="mb-0"><code>$ curl -I <a href="https://api.telcodb.net/peeringdb/asn?q=6939"
class="text-dark">https://api.telcodb.net/peeringdb/asn?q=6939</a>
HTTP/2 302
location: https://peeringdb.com/api/net/291</code></pre>
location: <a href="https://peeringdb.com/api/net/291" class="text-dark">https://peeringdb.com/api/net/291</a></code></pre>
<p class="mt-2 mb-0">We are aware of
<a class="text-monospace text-code"
......
{% extends 'layouts/default.twig' %}
{% block body %}
<h1>{{ title|e}}</td></h1>
<table class="table" id="speedtestServerTable">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Host</th>
<th scope="col">Name</th>
<th scope="col">Sponsor</th>
<th scope="col">Country</th>
<th scope="col">Location</th>
{# <th scope="col">Country Code</th> #}
<th scope="col">URL</th>
</tr>
</thead>
<tbody>
{% for server in servers %}
<tr>
<th scope="row">{{ server.id }}</th>
<td>{{ hostnamePortSplitter(server.host) }}</td>
<td>{{ server.name }}</td>
<td>{{ server.sponsor }}</td>
<td>{{ server.country }}</td>
<td>
<a href="https://www.openstreetmap.org/search?query={{ server.lat }}%2C{{ server.lon }}">
{{ server.lat }},{{ server.lon }}
</a>
</td>
{# <td>{{ server.cc }}</td> #}
<td>{{ server.url }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}
{% block javascripts %}
{# Datatables #}
<script src="/assets/js/pages/explore/speedtest-servers.js"></script>
<link rel="stylesheet" type="text/css" href="/assets/libs/datatables.net-bs4/css/dataTables.bootstrap4.min.css"/>
<script type="text/javascript" src="/assets/libs/datatables.net/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="/assets/libs/datatables.net-bs4/js/dataTables.bootstrap4.min.js"></script>
<script type="text/javascript" src="/assets/libs/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
{% endblock %}
\ No newline at end of file
......@@ -734,6 +734,13 @@
"@types/express-serve-static-core" "*"
"@types/mime" "*"
"@types/xml2js@^0.4.5":
version "0.4.5"
resolved "https://registry.yarnpkg.com/@types/xml2js/-/xml2js-0.4.5.tgz#d21759b056f282d9c7066f15bbf5c19b908f22fa"
integrity sha512-yohU3zMn0fkhlape1nxXG2bLEGZRc1FeqF80RoHaYXJN7uibaauXfhzhOJr1Xh36sn+/tx21QAOf07b/xYVk1w==
dependencies:
"@types/node" "*"
abbrev@1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8"
......@@ -1490,7 +1497,7 @@ deep-extend@^0.6.0:
resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac"
integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==
define-properties@^1.1.2:
define-properties@^1.1.2, define-properties@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1"
integrity sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==
......@@ -1581,6 +1588,31 @@ encodeurl@~1.0.2:
resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59"
integrity sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=
es-abstract@^1.5.1:
version "1.16.0"
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.16.0.tgz#d3a26dc9c3283ac9750dca569586e976d9dcc06d"
integrity sha512-xdQnfykZ9JMEiasTAJZJdMWCQ1Vm00NBw79/AWi7ELfZuuPCSOMDZbT9mkOfSctVtfhb+sAAzrm+j//GjjLHLg==
dependencies:
es-to-primitive "^1.2.0"
function-bind "^1.1.1"
has "^1.0.3"
has-symbols "^1.0.0"
is-callable "^1.1.4"
is-regex "^1.0.4"
object-inspect "^1.6.0"
object-keys "^1.1.1"
string.prototype.trimleft "^2.1.0"
string.prototype.trimright "^2.1.0"
es-to-primitive@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.0.tgz#edf72478033456e8dda8ef09e00ad9650707f377"
integrity sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==
dependencies:
is-callable "^1.1.4"
is-date-object "^1.0.1"
is-symbol "^1.0.2"
es6-promise@^4.2.5:
version "4.2.8"
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a"
......@@ -1923,6 +1955,13 @@ has-values@^1.0.0:
is-number "^3.0.0"
kind-of "^4.0.0"
has@^1.0.1, has@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796"
integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==
dependencies:
function-bind "^1.1.1"
he@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f"
......@@ -2101,6 +2140,11 @@ is-buffer@^2.0.2:
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.3.tgz#4ecf3fcf749cbd1e472689e109ac66261a25e725"
integrity sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw==
is-callable@^1.1.4:
version "1.1.4"
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75"
integrity sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==
is-ci@^1.0.10:
version "1.2.1"
resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.2.1.tgz#e3779c8ee17fccf428488f6e281187f2e632841c"
......@@ -2129,6 +2173,11 @@ is-data-descriptor@^1.0.0:
dependencies:
kind-of "^6.0.0"
is-date-object@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16"
integrity sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=
is-descriptor@^0.1.0:
version "0.1.6"
resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca"
......@@ -2251,6 +2300,13 @@ is-redirect@^1.0.0:
resolved "https://registry.yarnpkg.com/is-redirect/-/is-redirect-1.0.0.tgz#1d03dded53bd8db0f30c26e4f95d36fc7c87dc24"
integrity sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ=
is-regex@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491"
integrity sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=
dependencies:
has "^1.0.1"
is-retry-allowed@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz#11a060568b67339444033d0125a61a20d564fb34"
......@@ -2261,6 +2317,13 @@ is-stream@^1.0.0, is-stream@^1.1.0:
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"
integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ=
is-symbol@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.2.tgz#a055f6ae57192caee329e7a860118b497a950f38"
integrity sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==
dependencies:
has-symbols "^1.0.0"
is-windows@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d"
......@@ -2715,7 +2778,12 @@ object-copy@^0.1.0:
define-property "^0.2.5"
kind-of "^3.0.3"
object-keys@^1.0.11, object-keys@^1.0.12:
object-inspect@^1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.6.0.tgz#c70b6cbf72f274aab4c34c0c82f5167bf82cf15b"
integrity sha512-GJzfBZ6DgDAmnuaM3104jR4s1Myxr3Y3zfIyN4z3UdqN69oSRacNK8UhnobDdC+7J2AHCjGwxQubNJfE70SXXQ==
object-keys@^1.0.11, object-keys@^1.0.12, object-keys@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e"
integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==
......@@ -2737,6 +2805,14 @@ object.assign@^4.1.0:
has-symbols "^1.0.0"
object-keys "^1.0.11"
object.getownpropertydescriptors@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz#8758c846f5b407adab0f236e0986f14b051caa16"
integrity sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=
dependencies:
define-properties "^1.1.2"
es-abstract "^1.5.1"
object.pick@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747"
......@@ -3102,7 +3178,7 @@ safe-regex@^1.1.0:
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
sax@^1.2.4:
sax@>=0.6.0, sax@^1.2.4:
version "1.2.4"
resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9"
integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==
......@@ -3301,6 +3377,22 @@ string-width@^1.0.1:
is-fullwidth-code-point "^2.0.0"
strip-ansi "^4.0.0"
string.prototype.trimleft@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz#6cc47f0d7eb8d62b0f3701611715a3954591d634"
integrity sha512-FJ6b7EgdKxxbDxc79cOlok6Afd++TTs5szo+zJTUyow3ycrRfJVE2pq3vcN53XexvKZu/DJMDfeI/qMiZTrjTw==
dependencies:
define-properties "^1.1.3"
function-bind "^1.1.1"
string.prototype.trimright@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/string.prototype.trimright/-/string.prototype.trimright-2.1.0.tgz#669d164be9df9b6f7559fa8e89945b168a5a6c58"
integrity sha512-fXZTSV55dNBwv16uw+hh5jkghxSnc5oHq+5K/gXgizHwAvMetdAJlHqqoFC1FSDVPYWLkAKl2cxpUT41sV7nSg==
dependencies:
define-properties "^1.1.3"
function-bind "^1.1.1"
string_decoder@~1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8"
......@@ -3575,6 +3667,14 @@ util-deprecate@~1.0.1:
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=
util.promisify@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/util.promisify/-/util.promisify-1.0.0.tgz#440f7165a459c9a16dc145eb8e72f35687097030"
integrity sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==
dependencies:
define-properties "^1.1.2"
object.getownpropertydescriptors "^2.0.3"
util@^0.10.3:
version "0.10.4"
resolved "https://registry.yarnpkg.com/util/-/util-0.10.4.tgz#3aa0125bfe668a4672de58857d3ace27ecb76901"
......@@ -3644,6 +3744,20 @@ xdg-basedir@^3.0.0:
resolved "https://registry.yarnpkg.com/xdg-basedir/-/xdg-basedir-3.0.0.tgz#496b2cc109eca8dbacfe2dc72b603c17c5870ad4"
integrity sha1-SWsswQnsqNus/i3HK2A8F8WHCtQ=
xml2js@^0.4.22:
version "0.4.22"
resolved "https://registry.yarnpkg.com/xml2js/-/xml2js-0.4.22.tgz#4fa2d846ec803237de86f30aa9b5f70b6600de02"
integrity sha512-MWTbxAQqclRSTnehWWe5nMKzI3VmJ8ltiJEco8akcC6j3miOhjjfzKum5sId+CWhfxdOs/1xauYr8/ZDBtQiRw==
dependencies:
sax ">=0.6.0"
util.promisify "~1.0.0"
xmlbuilder "~11.0.0"
xmlbuilder@~11.0.0:
version "11.0.1"
resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-11.0.1.tgz#be9bae1c8a046e76b31127726347d0ad7002beb3"
integrity sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==
yallist@^2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment