Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
TelcoDB
Web Frontend
Commits
e396fc82
Verified
Commit
e396fc82
authored
Oct 22, 2019
by
Elias Ojala
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
List of TLDs
parent
2456a76f
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
122 additions
and
3 deletions
+122
-3
package.json
package.json
+1
-0
src/app.ts
src/app.ts
+4
-0
src/controllers/dns.controller.ts
src/controllers/dns.controller.ts
+2
-1
src/controllers/index.ts
src/controllers/index.ts
+1
-0
src/controllers/tld.controller.ts
src/controllers/tld.controller.ts
+52
-0
views/components/navbar.twig
views/components/navbar.twig
+1
-0
views/home/about.twig
views/home/about.twig
+16
-2
views/tld/list.twig
views/tld/list.twig
+26
-0
views/tld/show.twig
views/tld/show.twig
+14
-0
yarn.lock
yarn.lock
+5
-0
No files found.
package.json
View file @
e396fc82
...
...
@@ -36,6 +36,7 @@
"
ip-cidr
"
:
"
^2.0.6
"
,
"
is-asn
"
:
"
^1.0.1
"
,
"
is-cidr
"
:
"
^3.1.0
"
,
"
is-domain-name
"
:
"
^1.0.1
"
,
"
is-ip
"
:
"
^3.1.0
"
,
"
jquery
"
:
"
^3.4.1
"
,
"
lusca
"
:
"
^1.6.1
"
,
...
...
src/app.ts
View file @
e396fc82
...
...
@@ -29,6 +29,7 @@ import {
IxController
,
NetController
,
ExploreController
,
TldController
,
}
from
"
./controllers
"
;
twig
.
extendFunction
(
"
getenv
"
,
(
name
:
string
)
=>
{
...
...
@@ -188,6 +189,9 @@ app.use("/ix/", IxController);
// DNS names
app
.
use
(
"
/dns/
"
,
DnsController
);
// TLDs
app
.
use
(
"
/tld/
"
,
TldController
);
const
badgeData
=
[
/* ASN data badges */
{
...
...
src/controllers/dns.controller.ts
View file @
e396fc82
import
{
NextFunction
,
Request
,
Response
,
Router
}
from
"
express
"
;
import
domainNameRegex
from
"
domain-name-regex
"
;
import
isDomainName
from
"
is-domain-name
"
;
import
axios
from
"
axios
"
;
import
getIpInfo
from
"
../functions/getIpInfo
"
;
import
isIp
from
"
is-ip
"
;
...
...
@@ -16,7 +17,7 @@ function catcher(x) {
router
.
get
(
"
/:domain
"
,
(
req
:
Request
,
res
:
Response
,
next
:
NextFunction
)
=>
{
if
(
isIp
(
req
.
params
.
domain
))
{
res
.
redirect
(
301
,
`/ip/
${
req
.
params
.
domain
}
`
);
}
else
if
(
domainNameRegex
.
test
(
req
.
params
.
domain
))
{
}
else
if
(
domainNameRegex
.
test
(
req
.
params
.
domain
)
||
isDomainName
(
req
.
params
.
domain
)
)
{
axios
.
get
(
`https://api.telcodb.net/v1/resolve?format=json&q=
${
req
.
params
.
domain
}
`
)
.
then
((
response
)
=>
{
Promise
.
all
([
...
...
src/controllers/index.ts
View file @
e396fc82
...
...
@@ -8,3 +8,4 @@ export * from "./country.controller";
export
*
from
"
./ix.controller
"
;
export
*
from
"
./net.controller
"
;
export
*
from
"
./explore.controller
"
;
export
*
from
"
./tld.controller
"
;
src/controllers/tld.controller.ts
0 → 100644
View file @
e396fc82
import
{
NextFunction
,
Request
,
Response
,
Router
}
from
"
express
"
;
import
axios
from
"
axios
"
;
import
isDomainName
from
"
is-domain-name
"
;
const
router
:
Router
=
Router
();
/**
* List
*/
router
.
get
(
"
/
"
,
(
req
:
Request
,
res
:
Response
,
next
:
NextFunction
)
=>
{
axios
.
get
(
"
https://gitlab.lelux.fi/TelcoDB/tld-json/raw/master/data/tld-list.json
"
)
.
then
(
x
=>
x
.
data
)
.
then
(
data
=>
{
res
.
render
(
"
tld/list.twig
"
,
{
"
canonical_url
"
:
"
/tld/
"
,
"
title
"
:
"
List of TLDs
"
,
"
description
"
:
"
List of Top Level Domains, assigned by ICANN
"
,
"
domains
"
:
data
,
});
})
});
router
.
get
(
"
/:tld
"
,
(
req
:
Request
,
res
:
Response
,
next
:
NextFunction
)
=>
{
const
tld
=
req
.
params
.
tld
;
if
(
isDomainName
(
tld
))
{
axios
.
get
(
`https://api.telcodb.net/v1/resolve?format=json&q=
${
tld
}
`
)
.
then
(
x
=>
x
.
data
)
.
then
(
data
=>
data
.
ns
)
.
then
(
nameservers
=>
{
if
(
nameservers
===
undefined
)
{
next
();
return
;
}
res
.
render
(
"
tld/show.twig
"
,
{
"
canonical_url
"
:
`/tld/
${
tld
}
`
,
"
title
"
:
`Information about .
${
tld
}
`
,
"
tld
"
:
tld
,
"
nameservers
"
:
nameservers
,
});
})
.
catch
(
next
);
}
else
{
next
();
}
})
export
const
TldController
:
Router
=
router
;
views/components/navbar.twig
View file @
e396fc82
...
...
@@ -16,6 +16,7 @@
<div
class=
"dropdown-menu"
>
<a
class=
"dropdown-item"
href=
"/explore/asn"
>
ASN List
</a>
{# <a class="dropdown-item" href="/explore/ip">Browse IPs</a> #}
<a
class=
"dropdown-item"
href=
"/tld/"
>
Top Level Domains
</a>
</div>
</li>
<li
class=
"nav-item dropdown"
>
...
...
views/home/about.twig
View file @
e396fc82
...
...
@@ -5,15 +5,29 @@
<p>
TelcoDB is a website for Internet research.
</p>
<a
name=
"data-sources"
></a><h
3
>
Data sources
</h
3
>
<a
name=
"data-sources"
></a><h
2
>
Data sources
</h
2
>
<p>
We use the following data sources:
<h3>
ASN data
</h3>
<ul>
<li><a
href=
"https://asrank.caida.org/"
>
CAIDA ASRank
</a></li>
<li><a
href=
"https://peeringdb.com/"
>
PeeringDB
</a></li>
<li><a
href=
"https://www.team-cymru.com/IP-ASN-mapping.html"
>
Cymru IP-to-ASN mapping
</a></li>
</ul></p>
</ul>
<h3>
Domain name data
</h3>
<ul>
<li><a
href=
"https://publicsuffix.org/list/"
>
Public Suffix List
</a></li>
<li><a
href=
"/docs/dns-hsts-preloading/"
>
Chromium HSTS preload list
</a></li>
</ul>
<h3>
Tor Relay data
</h3>
<ul>
<li><a
href=
"https://www.dan.me.uk/dnsbl"
>
Tor Relay List by dan.me.uk
</a></li>
</ul>
</p>
<a
name=
"contact"
></a><h3>
Contact
</h3>
...
...
views/tld/list.twig
0 → 100644
View file @
e396fc82
{%
extends
'layouts/default.twig'
%}
{%
block
body
%}
<h1>
{{
title
}}
</h1>
<p>
The list of domains is provided by the
<a
href=
"https://publicsuffix.org/list/"
>
Public Suffix List
</a>
.
</p>
<ul>
{%
for
domain
in
domains
%}
{%
if
'.'
in
domain
%}
{# <li><a href="/tld/{{ domain}}">{{ domain }}</a></li></li> #}
{%
else
%}
<li>
<a
href=
"/tld/
{{
domain
}}
"
>
{{
domain
}}
</a>
{%
if
domain
|
length
==
2
%}
(
{{
countryCode
(
domain
)
}}
)
{%
endif
%}
</li>
{%
endif
%}
{%
endfor
%}
</ul>
{%
endblock
%}
\ No newline at end of file
views/tld/show.twig
0 → 100644
View file @
e396fc82
{%
extends
'layouts/default.twig'
%}
{%
block
body
%}
<h1>
{{
title
}}
</h1>
<h2>
Nameservers
</h2>
<ul
class=
"pl-3"
>
{%
for
server
in
nameservers
%}
<li><a
href=
"/dns/
{{
server
}}
"
>
{{
server
}}
</a></li>
{%
endfor
%}
</ul>
<p>
More detailed DNS data can be found from
<a
href=
"/dns/
{{
tld
}}
"
>
here
</a>
.
</p>
{%
endblock
%}
\ No newline at end of file
yarn.lock
View file @
e396fc82
...
...
@@ -2113,6 +2113,11 @@ is-descriptor@^1.0.0, is-descriptor@^1.0.2:
is-data-descriptor "^1.0.0"
kind-of "^6.0.2"
is-domain-name@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-domain-name/-/is-domain-name-1.0.1.tgz#f6eb33b14a497541dca58335137d4466e0c20da1"
integrity sha1-9uszsUpJdUHcpYM1E31EZuDCDaE=
is-extendable@^0.1.0, is-extendable@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment