Get geolocation, privacy/VPN detection, ASN, company, carrier and other IP address data from the IPinfo.io API.
1
// import * as wmill from 'https://deno.land/x/windmill/index.ts'
2
3
type Ipinfo {
4
token: string
5
}
6
7
export async function main(ipinfo?: Ipinfo, ip?:string) {
8
/**
9
* Makes an API call to IPinfo to get IP address geolocation data and other IP data.
10
* @param {string} token - Your IPinfo.io access token. This param is optional.
11
* @param {string} ip - The IP address to lookup. This param is optional if you want to lookup your current IP.
12
* @returns {object} - An object with the status and the payload.
13
*/
14
const ipAddressInformation = await fetch(`https://ipinfo.io${ip ? '/' + ip : '' }/json?token=${ipinfo?.token || ""}`)
15
16
return {
17
status: ipAddressInformation.status,
18
payload: await ipAddressInformation.json(),
19
};
20
export async function main(x: string) {
return x