Compare your server’s public IP with each incoming request (diff), in multiple formats... Or Just send back the incoming IP.
- 📦 Minimal dependencies (just Node.js,
Express
, andnode-fetch
) - 🔄 Multiple output formats: JSON, HTML/text, or plain-text
- 🚦 Built-in rate limiting per endpoint
- 🛡️ Health check with full JSON status
- 🔁 Configurable external IP services & intervals
- Node.js ≥ 12.x, probably?
- npm ≥ 6.x, also probably?
git clone https://github.com/justinnamilee/IPdiff.git
cd IPdiff
npm install
Key | Type | Default | Description |
---|---|---|---|
agent |
String | curl/7.68.0 |
User-Agent header for external IP services. |
clean |
Number | 10 |
Interval to clean rate-limit cache (seconds). |
expire |
Number | 180 |
Rate-limit window duration (seconds). |
limit |
Number | 15 |
Global max requests per window. |
failed |
Number | 5 |
Failures allowed per service before cooldown. |
retry |
Number | 86400 |
Cooldown after failures (seconds). |
refresh |
Number | 60 |
Interval between IP refreshes (seconds). |
port |
Number | 6969 |
HTTP server listening port. |
gateway |
String | 1.0.0.1 |
IP used to verify outbound connectivity. |
startup |
Number | 5 |
Delay before first IP check on startup (seconds). |
tagsep |
String | - |
Internal tag separator, really don't worry about this. |
timeout |
Number | 300 |
Site reuse cooldown after last use (seconds). |
Name | Path | Limit |
---|---|---|
root |
/ |
10 |
health |
/health |
5 |
text |
/text |
3 |
json |
/json |
5 |
ip |
/ip |
5 |
Note: The Limit is the rate-limit for that endpoint.
node ipdiff.js
By default, it binds to the port in your config.json
.
Ensure
X-Forwarded-For
is enabled if you’re behind a reverse proxy.
Endpoint | Description | Format |
---|---|---|
/ |
Simple health check (200 OK) | text/plain |
/health |
Full JSON status (rate limits, last IP, uptime, etc.) | application/json |
/text |
Server IP & client IP in HTML/text | text/html |
/json |
Server IP & client IP as JSON | application/json |
/ip |
Client IP only | text/plain |
curl http://localhost:6969/json
{
"me": "203.0.113.42",
"you": "198.51.100.24"
}
- Probably just open an issue or something.
- ???
- Profit.
GPLv3 © justinnamilee