diff --git a/README.md b/README.md index 489ddc9..819f6a7 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,17 @@ # myip.dn42 -[http://myip.dn42](http://myip.dn42): shows current ipv4 or ipv6 address +[http://myip.dn42](http://myip.dn42/): shows current ipv4 or ipv6 address [http://v4.myip.dn42](http://v4.myip.dn42/): shows ipv4 address -[http://v6.myip.dn42](http://v6.myip.dn42): shows ipv6 address +[http://v6.myip.dn42](http://v6.myip.dn42/): shows ipv6 address + + +[specs](specs.md) + - [source code](wwwroot) +- [nginx config](nginx-config) (preferred) +- [rust implementation](https://git.dn42.dev/famfo/myip-rs) by [famfo](https://git.dn42.dev/famfo/) - [apache2 config](apache2-config) diff --git a/nginx-config/myip.dn42-nginx.conf b/nginx-config/myip.dn42-nginx.conf index d38dc41..0fd837e 100644 --- a/nginx-config/myip.dn42-nginx.conf +++ b/nginx-config/myip.dn42-nginx.conf @@ -5,7 +5,11 @@ server { server_name *.myip.dn42; server_name 172.22.0.81; server_name [fd42:d42:d42:81::1]; - location /raw { + + root /path/to/myip-wwwroot; + index index.html; + + location /raw { return 200 '$remote_addr\n'; add_header Content-Type text/plain; } @@ -17,9 +21,9 @@ server { return 200 '{"version": "1.0", "ip": "$remote_addr", "server": "$server_addr","node_as": "", "node_location": "", "node_id": ""}'; } - location = / { - root /path/to/myip-wwwroot; - index index.html; - } + #location = / { + # + #} + } diff --git a/specs.md b/specs.md new file mode 100644 index 0000000..5d4c276 --- /dev/null +++ b/specs.md @@ -0,0 +1,18 @@ +# specs for myip.dn42 + +## subdomains +- myip.dn42: reachable both with ipv4 and ipv6 +- v4.myip.dn42: reachable with ipv4 only +- v6.myip.dn42: raachable with ipv6 only + +## endpoints + +- / and /index.[fileextension]: "fancy" human readable version with either serverside or clientside rendering +- /raw returns the ip address of the client +- /api returns json with + - version: string, "1.0" + - ip: string, client ip + - server: string, ip of the server/node connected to, + - node_as: string, ASN of node without "AS" prefix + - node_location: string, ISO 3166-1 alpha-2 of node + - node_id: string, nodename the operator chooses for his node \ No newline at end of file diff --git a/wwwroot/index.html b/wwwroot/index.html new file mode 100644 index 0000000..48c4ba0 --- /dev/null +++ b/wwwroot/index.html @@ -0,0 +1,92 @@ + + + + + + myip.dn42 + + + + + + + + + + + + + + + +
+

myip.dn42

+
+
+
+

Your IP address

+ Your default IP address is fetching from api.
+ Your IPv4 address is fetching from api.
+ Your IPv6 address is fetching from api.
+
+
+

Remote Node

+ The node's ip address is fetching from api.
+ The node's ipv4 address is fetching from api.
+ The node's ipv6 address is fetching from api.
+ You have reached the myip.dn42 service of ASfetching from api. The server is located in fetching from api . The server has the ID/name fetching from api. +
+
+ + +