Skip to content

Simple Cloudflare Worker Config to return IP + GeoInfo in plain TEXT, CSV, JSON, XML & YAML

License

Notifications You must be signed in to change notification settings

Azathothas/ip.ajam.dev

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Note: You will need modern fonts to be able to view Flags

  • Specify --ipv4 | --ipv6 or similar for ipv4|ipv6 only data

Returns plain IPv4 | IPv6

curl -qfsSL "https://ip.ajam.dev"

Returns csv IPv4 | IPv6, GeoInfo & User-Agent

!#Using: curl + column
curl -qfsSL "https://ip.ajam.dev/csv" | column -ts ','
Example Response
ip           city       country  flag  region     latitude   longitude  org         timezone           user-agent   readme
18.227.3.14  São Paulo  BR       🇧🇷    São Paulo  -23.53350  -46.63590  Amazon.com  America/Sao_Paulo  curl/7.88.1  https://github.com/Azathothas/ip.ajam.dev

Returns HTML IPv4 | IPv6, GeoInfo & User-Agent

Example Response

image


Returns json IPv4 | IPv6, GeoInfo & User-Agent

!#Using: curl + https://github.com/jqlang/jq
curl -qfsSL "https://ip.ajam.dev/json" | jq '.'
Example Response
{
"ip": "18.227.3.14",
"city": "São Paulo",
"country": "BR",
"flag": "🇧🇷",
"region": "São Paulo",
"latitude": "-23.53350",
"longitude": "-46.63590",
"org": "Amazon.com",
"timezone": "America/Sao_Paulo",
"user-agent": "curl/7.88.1",
"readme": "https://github.com/Azathothas/ip.ajam.dev"
}

Returns text IPv4 | IPv6, GeoInfo & User-Agent

curl -qfsSL "https://ip.ajam.dev/text"
Example Response
ip=18.227.3.14
city=São Paulo
country=BR
flag=🇧🇷
region=São Paulo
latitude=-23.53350
longitude=-46.63590
org=Amazon.com
timezone=America/Sao_Paulo
user-agent=curl/7.88.1
readme=https://github.com/Azathothas/ip.ajam.dev

Returns xml IPv4 | IPv6, GeoInfo & User-Agent

!#Using: curl + https://github.com/sibprogrammer/xq
curl -qfsSL "https://ip.ajam.dev/xml" | xq
Example Response
<?xml version="1.0" encoding="UTF-8"?>
<data>
  <ip>18.227.3.14</ip>
  <city>São Paulo</city>
  <country>BR</country>
  <flag>🇧🇷</flag>
  <region>São Paulo</region>
  <latitude>-23.53350</latitude>
  <longitude>-46.63590</longitude>
  <org>Amazon.com</org>
  <timezone>America/Sao_Paulo</timezone>
  <user-agent>curl/7.88.1</user-agent>
  <readme>https://github.com/Azathothas/ip.ajam.dev</readme>
</data>

Returns yaml IPv4 | IPv6, GeoInfo & User-Agent

!#Using: curl + https://github.com/mikefarah/yq
curl -qfsSL "https://ip.ajam.dev/yaml" | yq '.'
Example Response
ip: "18.227.3.14"
city: "São Paulo"
country: "BR"
flag: "🇧🇷"
region: "São Paulo"
latitude: "-23.53350"
longitude: "-46.63590"
org: "Amazon.com"
timezone: "America/Sao_Paulo"
user-agent: "curl/7.88.1"
readme: "https://github.com/Azathothas/ip.ajam.dev"

Deploy (Note to Self)

!# Install Wrangler: https://developers.cloudflare.com/workers/wrangler/install-and-update/
npm install "wrangler@latest" -g

!# Clone Source
git clone --filter="blob:none" "https://github.com/Azathothas/ip.ajam.dev"
cd "./ip.ajam.dev"
code "./ip.ajam.dev"

!# Deploy
npm install ; wrangler login
wrangler deploy

!# Dashboard >> Workers & Pages >> ip-api >> Settings >> Custom Domains >> Add: ip.ajam.dev