Last active
August 17, 2021 02:45
-
-
Save yorickshan/481bb1d031c5d5e79f758f9ea82d562c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
let clientIp | |
$.getJSON("https://api.ipify.org/?format=json", function(e) { | |
clientIp = e.ip; | |
}); | |
// linux 获取内网地址 | |
ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:" | |
// mac 获取内网地址 | |
ipconfig getifaddr en0 | |
// 获取公网地址 | |
curl api.ipify.org | |
curl cip.cc | |
curl ip.sb | |
curl ifconfig.co | |
curl ifconfig.co/json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment