Nothing has been indexed for test2 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.

Installation

# Add this to your shard.yml
dependencies:
  myip:
    github: crystal-china/myip
    version: ~> test2

Then run:

shards install

shard.yml

No shard.yml has been indexed for test2. You can read it on the repository.

Dependencies

Unknown: the shard.yml for this version has not been read yet.

README

This README is the one indexed from the repository at its latest ref, not from the tag for this version.

myip

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

  • myip ipify:通过 https://api.ipify.org 获取 IPv4 地址
  • myip ipify6:通过 https://api6.ipify.org 获取 IPv6 地址
  • myip cf:通过 Cloudflare trace 获取 IP、机房、国家及连接信息
  • myip ident:通过 ident.me 获取 IP 及地理信息(JSON)
  • myip aws:通过 AWS CheckIP 获取 IP 地址
  • myip akamai:通过 Akamai 获取 IP 地址
  • myip ipsb:通过 https://api.ip.sb/geoip 获取详细 IP 信息
  • myip ifconfig.io:通过 https://ifconfig.io/ip 获取 IP 地址
  • myip ifconfig.co:通过 https://ifconfig.co/json 获取 IP、地理位置及 ASN 信息
  • myip ifconfig.me:通过 https://ifconfig.me/all.json 获取 IP 及连接信息(JSON)
  • myip icanhazip:通过 https://icanhazip.com 获取 IP 地址
  • myip httpbin:通过 https://httpbin.org/ip 获取来源 IP 地址(JSON)
  • myip dyndns:通过 http://checkip.dyndns.org 获取 IP 地址(HTML)
  • myip ip111:通过 https://ip111.cn 获取国内、国外及 Google 路径的 IP 信息
  • myip ip138:通过 https://www.ip138.com 获取国内 IP 信息

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