myip

返回本机的公网 IP 以及访问外网的公网 IP,匿名使用以下服务(均无需 API key):

IPv6-only 服务需要当前网络具备可用的 IPv6 出口,否则会返回连接错误。

调试

默认情况下,查询失败只会向 STDERR 输出简洁错误。通过 LOG_LEVEL=DEBUG 可以同时查看原始异常和完整堆栈:

LOG_LEVEL=DEBUG myip ipify

查询结果仍输出到 STDOUT,spinner、错误和 debug 日志输出到 STDERR。

ip111.png

Contributing

  1. Fork it (https://github.com/crystal-china/myip/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors