This commit is contained in:
2025-11-16 13:32:35 +08:00
parent e35712820f
commit 2c800d336c
11 changed files with 414 additions and 18 deletions

8
agent/ddns/get-ip.ts Normal file
View File

@@ -0,0 +1,8 @@
const baseURLv4 = 'https://4.ipw.cn/';
const baseURLv6 = 'https://6.ipw.cn/';
export const getPublicIp = async (type: 'v4' | 'v6'): Promise<string> => {
const url = type === 'v4' ? baseURLv4 : baseURLv6;
const response = await fetch(url);
const ip = (await response.text()).trim();
return ip;
}