61 lines
No EOL
1.3 KiB
Markdown
61 lines
No EOL
1.3 KiB
Markdown
# nutils
|
|
|
|
## Response
|
|
|
|
Every request returns 5 lines of plain text:
|
|
|
|
```
|
|
203.0.113.42
|
|
host-203-0-113-42.example.net
|
|
proxy=NO, type=UNKNOWN, tor=NO
|
|
North America, United States, Los Angeles
|
|
Example ISP / AS12345
|
|
```
|
|
|
|
| Line | Field | Meaning |
|
|
|------|-------|---------|
|
|
| 1 | IP | Client public IP (from X-Forwarded-For, X-Real-IP, or remote addr) |
|
|
| 2 | Reverse DNS | PTR record, or "Unknown" |
|
|
| 3 | Classification | Abuse flags |
|
|
| 4 | Location | Continent, country, city (GeoLite2-City) |
|
|
| 5 | ASN | Organization and ASN number (GeoLite2-ASN) |
|
|
|
|
## Modes
|
|
|
|
**ip** (default)
|
|
Returns both IPv4 and IPv6. Works as a catch-all.
|
|
|
|
**ip4**
|
|
IPv4 only. Rejects IPv6 clients with HTTP 400.
|
|
|
|
**ip6**
|
|
IPv6 only. Rejects IPv4 clients with HTTP 400.
|
|
|
|
## Config
|
|
|
|
```toml
|
|
[server]
|
|
listen = ":8080"
|
|
|
|
[services.ip]
|
|
enabled = true
|
|
subdomains = ["ip.example.com"]
|
|
directories = ["/"]
|
|
|
|
[services.ip4]
|
|
enabled = true
|
|
subdomains = ["ip4.example.com"]
|
|
|
|
[services.ip6]
|
|
enabled = true
|
|
subdomains = ["ip6.example.com"]
|
|
|
|
[geo]
|
|
asn_db = "GeoLite2-ASN.mmdb"
|
|
city_db = "GeoLite2-City.mmdb"
|
|
download_url_asn = "https://git.io/GeoLite2-ASN.mmdb"
|
|
download_url_city = "https://git.io/GeoLite2-City.mmdb"
|
|
cache_dir = "data"
|
|
```
|
|
|
|
Services can be toggled on/off with `enabled`. MMDBs are downloaded automatically on first run and cached in `cache_dir`. |