2024-06-02 18:22:35 +00:00
|
|
|
# ip-svc
|
2024-06-03 13:54:17 +00:00
|
|
|
Go service that will show user IPv4 and IPv6 addresses
|
2024-06-02 18:22:35 +00:00
|
|
|
|
2024-06-03 13:54:17 +00:00
|
|
|
![IP page screenshot](./docs/ip-svc-screenshot.png)
|
|
|
|
|
|
|
|
```mermaid
|
|
|
|
flowchart TD
|
|
|
|
A[net/http]
|
|
|
|
A --> B{get request RemoteAddress}
|
|
|
|
B --> C{is ipv6?}
|
|
|
|
C -->|yes| D[render template with IPv6 address]
|
|
|
|
C -->|no| E[render template with IPv4 address]
|
|
|
|
D --> F{request ipv4 address from ip4.mziesel.nl}
|
|
|
|
F -->|success| G[add address to page]
|
|
|
|
E --> H{request ipv6 address from ip6.mziesel.nl}
|
|
|
|
H -->|success| G[add address to page]
|
|
|
|
```
|
|
|
|
|
|
|
|
works by creating four dns records
|
|
|
|
|
|
|
|
```
|
|
|
|
A ip.mziesel.nl <server ipv4>
|
|
|
|
AAAA ip.mziesel.nl <server ipv6>
|
|
|
|
A ip4.mziesel.nl <server ipv4>
|
|
|
|
AAAA ip6.mziesel.nl <server ipv6>
|
|
|
|
```
|
|
|
|
|
|
|
|
#### endpoints
|
|
|
|
|
|
|
|
| Endpoint | Description |
|
|
|
|
| -------- | ----------- |
|
|
|
|
| `/` | HTML page |
|
|
|
|
| `/raw` | Just the raw IP |
|
|
|
|
| `/json` | Data in json |
|
2024-06-03 14:03:29 +00:00
|
|
|
|
|
|
|
the application is also available as a [docker image](https://git.mzsl.nl/mans/-/packages/container/ip-svc/latest)
|