搭了个获取 IP 的服务

2020-08-04 12:38:50 +08:00
 asmoker

之前一直使用 ip.cn 获取主机的出口 IP,后来不知道咋回事儿, curl ip.cn 就一直报错:error code: 1020

所以闲着没事儿自己搭了一个,有需要的可以自取,访问地址:ip.threep.top

curl 访问:

$ curl ip.threep.top

域名的话你可以理解为 3P 比较好记 🙊

10160 次点击
所在节点    程序员
59 条回复
CallMeReznov
2020-08-04 13:51:41 +08:00
ip.sb 我一直用这个,还有各种 API,方便实用好记
glp664186796
2020-08-04 13:55:05 +08:00
我的电脑已经翻墙。访问 ip.threep.top 会显示深圳的 ip,访问 ip.fm 会显示香港的 ip,为什么还不一样?
internelp
2020-08-04 13:55:16 +08:00
curl ipaddr.host
asmoker
2020-08-04 14:01:01 +08:00
还有老哥用 ApacheBench 帮忙压测,真的费心了 😀
asmoker
2020-08-04 14:13:23 +08:00
koharu
2020-08-04 14:13:58 +08:00
wangritian
2020-08-04 14:18:11 +08:00
搞 freeswitch 的时候弄过 stun 服务,专门获取外网 ip 的协议
lasuar
2020-08-04 14:24:21 +08:00
这个帖子不错 收藏了
sikeerwei
2020-08-04 14:25:59 +08:00
curl ip.sb
matrix67
2020-08-04 14:29:55 +08:00
@wangritian #27 现在都用 ipd


Usage:
ipd [OPTIONS]

Application Options:
-f, --country-db=FILE Path to GeoIP country database
-c, --city-db=FILE Path to GeoIP city database
-l, --listen=ADDR Listening address (default: :8080)
-r, --reverse-lookup Perform reverse hostname lookups
-p, --port-lookup Enable port lookup
-t, --template=FILE Path to template (default: index.html)
-H, --trusted-header=NAME Header to trust for remote IP, if present (e.g. X-Real-IP)
-L, --log-level=[debug|info|warn|error|fatal|panic] Log level to use (default: info)

Help Options:
-h, --help Show this help message
moonfly
2020-08-04 14:32:28 +08:00
我也在自己的博客主机上用 PHP 写了一个查 IP 的 api,
后来觉得域名太长了,curl 要敲好多字符,于是在 .bash_profile 中封装了一个 cip() 的函数,
shell 下直接执行 cip 返回我当前上网的公网 IP,PTR 和归属地信息,
执行 cip {IP} 返回指定 IP 的归属地,PTR 信息;
timothyye
2020-08-04 14:35:02 +08:00
我也搭了一个
curl https://myip.biturl.top
96412hj
2020-08-04 14:40:58 +08:00
钓鱼?
wfifi
2020-08-04 14:48:03 +08:00
curl 访问 ip.cn 时带上 user agent,-L 参数处理重定向,内容就出来了
smileawei
2020-08-04 14:48:04 +08:00
nginx 一段配置就搞定了。
location / {
default_type text/plain;
return 200 "$remote_addr\n" ;
}

搭配 GEO IP 库 更佳。
JamesR
2020-08-04 14:56:24 +08:00
0x4C
2020-08-04 15:17:27 +08:00
curl ifconfig.me
这个挺好记的
wakzz
2020-08-04 15:20:10 +08:00
curl ip.sb
aaa5838769
2020-08-04 15:24:23 +08:00
支持一下,我还以为能获取其他 IP 的详细信息了。
asmoker
2020-08-04 15:47:03 +08:00
@aaa5838769 curl myip.ipip.net 这个不错

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/695489

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX