forked from jason5ng32/MyIP
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request jason5ng32#238 from jason5ng32/dev
Improvements
- Loading branch information
Showing
14 changed files
with
159 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
import { getIPFromIPIP } from "./ipipnet"; | ||
import { getIPFromQQ } from "./qq"; | ||
import { getIPFromUpai } from "./upai"; | ||
import { getIPFromCloudflare_CN } from "./cloudflare-cn"; | ||
import { getIPFromCloudflare_V4 } from "./cloudflare-v4"; | ||
import { getIPFromCloudflare_V6 } from "./cloudflare-v6"; | ||
import { getIPFromGCR } from "./ipchecking"; | ||
import { getIPFromIpify_V4 } from "./ipify-v4"; | ||
import { getIPFromIpify_V6 } from "./ipify-v6"; | ||
import { getIPFromIPChecking64 } from "./ipchecking64"; | ||
import { getIPFromIPChecking4 } from "./ipchecking4"; | ||
import { getIPFromIPChecking6 } from "./ipchecking6"; | ||
|
||
export { getIPFromIPIP, getIPFromQQ, getIPFromUpai, getIPFromCloudflare_CN, getIPFromCloudflare_V4, getIPFromCloudflare_V6, getIPFromGCR, getIPFromIpify_V4, getIPFromIpify_V6}; | ||
export { getIPFromIPIP, getIPFromCloudflare_V4, getIPFromCloudflare_V6, getIPFromIPChecking64, getIPFromIPChecking4, getIPFromIPChecking6}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { isValidIP } from '@/utils/valid-ip.js'; | ||
|
||
// 从 IPCheck.ing 获取 IPv4 地址 | ||
const getIPFromIPChecking4 = async () => { | ||
try { | ||
const response = await fetch("https://4.ipcheck.ing/cdn-cgi/trace"); | ||
const data = await response.text(); | ||
const lines = data.split("\n"); | ||
const ipLine = lines.find((line) => line.startsWith("ip=")); | ||
let ip = ""; | ||
if (ipLine) { | ||
ip = ipLine.split("=")[1]; | ||
} | ||
const source = "IPCheck.ing IPv4"; | ||
if (isValidIP(ip)) { | ||
return { | ||
ip: ip, | ||
source: source | ||
}; | ||
} else { | ||
console.error("Invalid IP from IPCheck.ing IPv4:", ip); | ||
return { | ||
ip: null, | ||
source: source | ||
}; | ||
} | ||
} catch (error) { | ||
console.error("Error fetching IP from IPCheck.ing IPv4:", error); | ||
return { | ||
ip: null, | ||
source: "IPCheck.ing IPv4" | ||
}; | ||
} | ||
}; | ||
|
||
export { getIPFromIPChecking4 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { isValidIP } from '@/utils/valid-ip.js'; | ||
|
||
// 从 IPCheck.ing 获取 IPv6 地址 | ||
const getIPFromIPChecking6 = async () => { | ||
try { | ||
const response = await fetch("https://6.ipcheck.ing/cdn-cgi/trace"); | ||
const data = await response.text(); | ||
const lines = data.split("\n"); | ||
const ipLine = lines.find((line) => line.startsWith("ip=")); | ||
let ip = ""; | ||
if (ipLine) { | ||
ip = ipLine.split("=")[1]; | ||
} | ||
const source = "IPCheck.ing IPv6"; | ||
if (isValidIP(ip)) { | ||
return { | ||
ip: ip, | ||
source: source | ||
}; | ||
} else { | ||
console.error("Invalid IP from IPCheck.ing IPv6:", ip); | ||
return { | ||
ip: null, | ||
source: source | ||
}; | ||
} | ||
} catch (error) { | ||
console.error("Error fetching IP from IPCheck.ing IPv6:", error); | ||
return { | ||
ip: null, | ||
source: "IPCheck.ing IPv6" | ||
}; | ||
} | ||
}; | ||
|
||
export { getIPFromIPChecking6 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { isValidIP } from '@/utils/valid-ip.js'; | ||
|
||
// 从 IPCheck.ing 获取 IPv6 地址 | ||
const getIPFromIPChecking64 = async () => { | ||
try { | ||
const response = await fetch("https://64.ipcheck.ing/cdn-cgi/trace"); | ||
const data = await response.text(); | ||
const lines = data.split("\n"); | ||
const ipLine = lines.find((line) => line.startsWith("ip=")); | ||
let ip = ""; | ||
if (ipLine) { | ||
ip = ipLine.split("=")[1]; | ||
} | ||
const source = "IPCheck.ing IPv6/4"; | ||
if (isValidIP(ip)) { | ||
return { | ||
ip: ip, | ||
source: source | ||
}; | ||
} else { | ||
console.error("Invalid IP from IPCheck.ing IPv6/4:", ip); | ||
return { | ||
ip: null, | ||
source: source | ||
}; | ||
} | ||
} catch (error) { | ||
console.error("Error fetching IP from IPCheck.ing IPv6/4:", error); | ||
return { | ||
ip: null, | ||
source: "IPCheck.ing IPv6/4" | ||
}; | ||
} | ||
}; | ||
|
||
export { getIPFromIPChecking64 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters