获取系统物理地址的方法
从 How to Get Your System’s Geographic Location From a Bash Script 看到的。
其实很简单,就是借助两个网络服务来完成
获取公网IP
curl https://ipinfo.io/ip
14.120.26.99
根据公网IP获取物理地址
curl https://ipvigilante.com/$ip
{"status":"success","data":{"ipv4":"14.120.26.99","continent_name":"Asia","country_name":"China","subdivision_1_name":"Guangdong","subdivision_2_name":null,"city_name":"Guangzhou","latitude":"23.11670","longitude":"113.25000"}}