getIpInfo
Script
v12
Fork
1
2
3
4
5
6
import
{
fetch
}
from
"https://esm.town/v/std/fetch"
;
export
const
getIpInfo
=
async
(
req
:
express
.
Request
)
=>
{
const
ip
=
(
req
as
any
)
.
options
.
headers
[
"true-client-ip"
]
;
return
await
(
await
fetch
(
`http://ip-api.com/json/
${
ip
}
`
)
)
.
json
(
)
;
}
;