Init repository
This commit is contained in:
commit
864b0d2acc
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 clerie
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
6
README.md
Normal file
6
README.md
Normal file
@ -0,0 +1,6 @@
|
||||
# ip.clerie.de
|
||||
Because any other "Whats my IP?"-tool sucks.
|
||||
|
||||
Try it here: https://ip.clerie.de
|
||||
|
||||
It's just one nginx site config. Feel free to host it yourself. It's open-source.
|
84
ip.clerie.de
Normal file
84
ip.clerie.de
Normal file
@ -0,0 +1,84 @@
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
server_name ip.clerie.de ip4.clerie.de ip6.clerie.de;
|
||||
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen [::]:443 ssl;
|
||||
listen 443 ssl;
|
||||
|
||||
server_name ip.clerie.de;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/ip.clerie.de/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/ip.clerie.de/privkey.pem;
|
||||
include /etc/letsencrypt/options-ssl-nginx.conf;
|
||||
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
||||
|
||||
location / {
|
||||
add_header Content-Type text/html;
|
||||
return 200 '
|
||||
<html>
|
||||
<head>
|
||||
<title>ip.clerie.de</title>
|
||||
<script>
|
||||
function httpGet(url, loaded, error) {
|
||||
var xmlHttp = new XMLHttpRequest();
|
||||
xmlHttp.open("GET", url + ((/\?/).test(url) ? "&" : "?") + (new Date()).getTime(), true);
|
||||
xmlHttp.onload = () => {
|
||||
if(xmlHttp.status == 200) {
|
||||
loaded(xmlHttp.responseText);
|
||||
}
|
||||
else {
|
||||
error();
|
||||
}
|
||||
};
|
||||
xmlHttp.onerror = () => {error();};
|
||||
xmlHttp.send(null);
|
||||
}
|
||||
function setText(id, text) {
|
||||
document.getElementById(id).innerText = text;
|
||||
}
|
||||
httpGet("https://ip4.clerie.de/",
|
||||
(response) => {setText("ip4", response);},
|
||||
() => {setText("ip4", "Error");}
|
||||
);
|
||||
httpGet("https://ip6.clerie.de/",
|
||||
(response) => {setText("ip6", response);},
|
||||
() => {setText("ip6", "Error");}
|
||||
);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>ip.clerie.de</h1>
|
||||
<ul>
|
||||
<li><b>IPv6:</b> <span id="ip6">Loading...</span></li>
|
||||
<li><b>IPv4:</b> <span id="ip4">Loading...</span></li>
|
||||
</ul>
|
||||
<p><small>Because any other "Whats my IP?"-tool sucks. <a href="https://git.clerie.de/clerie/ip.clerie.de">Host yourself :3</a></small></p>
|
||||
</body>
|
||||
</html>
|
||||
';
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen [::]:443 ssl;
|
||||
listen 443 ssl;
|
||||
|
||||
server_name ip4.clerie.de ip6.clerie.de;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/ip.clerie.de/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/ip.clerie.de/privkey.pem;
|
||||
include /etc/letsencrypt/options-ssl-nginx.conf;
|
||||
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
||||
|
||||
location / {
|
||||
add_header Content-Type text/plain;
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
return 200 $remote_addr;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user