mirror of
https://github.com/skidoodle/ipinfo.git
synced 2025-02-15 08:29:17 +01:00
Update readme.md
This commit is contained in:
parent
ae91bd7ca8
commit
8901320eea
1 changed files with 54 additions and 35 deletions
89
readme.md
89
readme.md
|
@ -5,56 +5,56 @@
|
||||||
- **IP Geolocation**: Provides city, region, country, continent, and coordinates for any IP address.
|
- **IP Geolocation**: Provides city, region, country, continent, and coordinates for any IP address.
|
||||||
- **ASN Information**: Includes autonomous system number and organization.
|
- **ASN Information**: Includes autonomous system number and organization.
|
||||||
- **Hostname Lookup**: Retrieves the hostname associated with the IP address.
|
- **Hostname Lookup**: Retrieves the hostname associated with the IP address.
|
||||||
- **Automatic Database Updates**: Keeps GeoIP databases up-to-date weekly.
|
- **Automatic Database Updates**: Keeps GeoIP databases up-to-date daily.
|
||||||
- **JSONP Support**: Allows JSONP responses for cross-domain requests.
|
- **JSONP Support**: Allows JSONP responses for cross-domain requests.
|
||||||
|
|
||||||
## Example Endpoints
|
## Example Endpoints
|
||||||
### Get information about an IP address
|
### Get information about an IP address
|
||||||
```sh
|
```sh
|
||||||
$ curl https://ip.albert.lol/8.8.8.8
|
$ curl https://ip.albert.lol/9.9.9.9
|
||||||
{
|
{
|
||||||
"ip": "8.8.8.8",
|
"ip": "9.9.9.9",
|
||||||
"hostname": "dns.google.",
|
"hostname": "dns9.quad9.net",
|
||||||
"asn": "15169",
|
"asn": "19281",
|
||||||
"organization": "Google LLC",
|
"org": "QUAD9-AS-1",
|
||||||
"city": "Mountain View",
|
"city": "Berkeley",
|
||||||
"region": "California",
|
"region": "California",
|
||||||
"country": "US",
|
"country": "United States",
|
||||||
"country_full": "United States",
|
"continent": "North America",
|
||||||
"continent": "NA",
|
"timezone": "America/Los_Angeles",
|
||||||
"continent_full": "North America",
|
"loc": "37.8767,-122.2676"
|
||||||
"loc": "37.4223,-122.0850"
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
### Get specific information (e.g., city) about an IP address
|
### Get specific information (e.g., city) about an IP address
|
||||||
```sh
|
```sh
|
||||||
$ curl https://ip.albert.lol/8.8.8.8/city
|
$ curl https://ip.albert.lol/9.9.9.9/city
|
||||||
Mountain View
|
{
|
||||||
|
"city": "Berkeley"
|
||||||
|
}
|
||||||
```
|
```
|
||||||
### Use JSONP callback function
|
### Use JSONP callback function
|
||||||
```sh
|
```sh
|
||||||
$ curl http://ip.albert.lol/8.8.8.8?callback=getGoogle
|
$ curl https://test.albert.lol/9.9.9.9?callback=Quad9
|
||||||
/**/ typeof getGoogle === 'function' && getGoogle({
|
/**/ typeof Quad9 === 'function' && Quad9({
|
||||||
"ip": "8.8.8.8",
|
"ip": "9.9.9.9",
|
||||||
"hostname": "dns.google.",
|
"hostname": "dns9.quad9.net",
|
||||||
"asn": "15169",
|
"asn": "19281",
|
||||||
"organization": "Google LLC",
|
"org": "QUAD9-AS-1",
|
||||||
"city": "Mountain View",
|
"city": "Berkeley",
|
||||||
"region": "California",
|
"region": "California",
|
||||||
"country": "US",
|
"country": "United States",
|
||||||
"country_full": "United States",
|
"continent": "North America",
|
||||||
"continent": "NA",
|
"timezone": "America/Los_Angeles",
|
||||||
"continent_full": "North America",
|
"loc": "37.8767,-122.2676"
|
||||||
"loc": "37.4223,-122.0850"
|
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
```html
|
```html
|
||||||
<script>
|
<script>
|
||||||
let getGoogle = function(data) {
|
let Quad9 = function(data) {
|
||||||
alert("Google's ASN is " + data.asn);
|
alert("Quad9's ASN is " + data.asn);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script src="https://ip.albert.lol/8.8.8.8?callback=getGoogle"></script>
|
<script src="https://test.albert.lol/9.9.9.9?callback=Quad9"></script>
|
||||||
```
|
```
|
||||||
|
|
||||||
## Running Locally
|
## Running Locally
|
||||||
|
@ -63,27 +63,42 @@ let getGoogle = function(data) {
|
||||||
git clone https://github.com/skidoodle/ipinfo
|
git clone https://github.com/skidoodle/ipinfo
|
||||||
cd ipinfo
|
cd ipinfo
|
||||||
docker build -t ipinfo:main .
|
docker build -t ipinfo:main .
|
||||||
docker run -p 3000:3000 ipinfo:main
|
docker run \
|
||||||
|
-p 3000:3000
|
||||||
|
-e GEOIPUPDATE_ACCOUNT_ID=<> \
|
||||||
|
-e GEOIPUPDATE_LICENSE_KEY=<> \
|
||||||
|
-e GEOIPUPDATE_EDITION_IDS=<> \
|
||||||
|
-e GEOIPUPDATE_DB_DIR=<> \
|
||||||
|
ipinfo:main
|
||||||
```
|
```
|
||||||
### Without Docker
|
### Without Docker
|
||||||
```sh
|
```sh
|
||||||
git clone https://github.com/skidoodle/ipinfo
|
git clone https://github.com/skidoodle/ipinfo
|
||||||
cd ipinfo
|
cd ipinfo
|
||||||
go run main.go
|
go run .
|
||||||
```
|
```
|
||||||
|
|
||||||
## Deploying
|
## Deploying
|
||||||
### Docker Compose
|
### Docker Compose
|
||||||
```yaml
|
```yaml
|
||||||
version: '3.9'
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
ipinfo:
|
ipinfo:
|
||||||
|
image: ghcr.io/skidoodle/ipinfo:main
|
||||||
container_name: ipinfo
|
container_name: ipinfo
|
||||||
image: 'ghcr.io/skidoodle/ipinfo:main'
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- '3000:3000'
|
- "3000:3000"
|
||||||
|
environment:
|
||||||
|
GEOIPUPDATE_ACCOUNT_ID: ${GEOIPUPDATE_ACCOUNT_ID}
|
||||||
|
GEOIPUPDATE_LICENSE_KEY: ${GEOIPUPDATE_LICENSE_KEY}
|
||||||
|
GEOIPUPDATE_EDITION_IDS: "GeoLite2-City GeoLite2-ASN"
|
||||||
|
GEOIPUPDATE_DB_DIR: /app
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "curl", "-f", "http://localhost:3000/"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 3
|
||||||
|
start_period: 40s
|
||||||
```
|
```
|
||||||
### Docker Run
|
### Docker Run
|
||||||
```sh
|
```sh
|
||||||
|
@ -92,6 +107,10 @@ docker run \
|
||||||
--name=ipinfo \
|
--name=ipinfo \
|
||||||
--restart=unless-stopped \
|
--restart=unless-stopped \
|
||||||
-p 3000:3000 \
|
-p 3000:3000 \
|
||||||
|
-e GEOIPUPDATE_ACCOUNT_ID=<> \
|
||||||
|
-e GEOIPUPDATE_LICENSE_KEY=<> \
|
||||||
|
-e GEOIPUPDATE_EDITION_IDS=<> \
|
||||||
|
-e GEOIPUPDATE_DB_DIR=<> \
|
||||||
ghcr.io/skidoodle/ipinfo:main
|
ghcr.io/skidoodle/ipinfo:main
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue