feat: add ip.ts

This commit is contained in:
2025-04-19 12:26:00 +08:00
parent e170e2c245
commit 62b3cba54d
2 changed files with 34 additions and 0 deletions

25
single-scripts/ip.ts Executable file
View File

@@ -0,0 +1,25 @@
#!/usr/bin/env runts -- --allow-import --allow-net
import {
log,
} from "https://hatter.ink/script/get/@1/deno-commons-mod.ts";
const args = Deno.args;
if (args.length === 0) {
log.info(`ip.ts <IP Address>`);
Deno.exit(1);
}
const response = await fetch('https://ip2asn.hatter.ink/v1/as/ip/' + args[0], {
headers: {
"Accept": "application/json",
},
});
const response_json = await response.json();
console.log(JSON.stringify(response_json, null, 2));
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20250419T122502+08:00.MEYCIQDWT10PIhmdVF/CZmvn
// KZcE5ylE47Bpi3om0XenYeD7JQIhAOm7m+W6q7rr/hkSD16UpST5q7Qe6tKwpZqNvn6rYITQ