From 8b85ad1dce20fcdd89040653253ae46ffc382db2 Mon Sep 17 00:00:00 2001 From: zw963 Date: Thu, 18 Apr 2024 16:26:20 +0000 Subject: [PATCH] deploy: 2c1e1b5bb7263bfc05ecb6edb4a9af29d6f72a57 --- 404.html | 8 +-- Myip.html | 163 ++++++++++++++++++++++++++++++++++++++++-------- index.html | 8 +-- index.json | 2 +- search-index.js | 2 +- 5 files changed, 147 insertions(+), 36 deletions(-) diff --git a/404.html b/404.html index dc0e4c4..22167a5 100644 --- a/404.html +++ b/404.html @@ -4,8 +4,8 @@ - - + + @@ -14,7 +14,7 @@ - myip 0.4.6 + myip 0.4.8 @@ -45,7 +45,7 @@

- 0.4.6 + 0.4.8 diff --git a/Myip.html b/Myip.html index f6441bc..bcfed57 100644 --- a/Myip.html +++ b/Myip.html @@ -4,8 +4,8 @@ - - + + @@ -14,7 +14,7 @@ - Myip - myip 0.4.6 + Myip - myip 0.4.8 @@ -45,7 +45,7 @@

- 0.4.6 + 0.4.8 @@ -104,14 +104,14 @@

- + myip.cr
- + myip/version.cr @@ -145,6 +145,8 @@

+ +

  • - #chan : Channel({String, String}) + #chan : Channel({String, String, String?}) + +
  • + +
  • + #chan_send_count : Int32 + +
  • + +
  • + #chan_send_count=(chan_send_count : Int32) + +
  • + +
  • + #ip111_chan_send_count : Int32 + +
  • + +
  • + #ip111_chan_send_count=(ip111_chan_send_count : Int32)
  • - #get_ip_from_ib_sb + #ip_from_ib_sb
  • - #get_ip_from_ip138 + #ip_from_ip111 + +
  • + +
  • + #ip_from_ip138
  • @@ -179,8 +206,6 @@

    - -
    @@ -192,12 +217,18 @@

    + + + + + + @@ -210,6 +241,8 @@

    + +

    Instance Method Detail

    -
    +
    + + +
    +
    + + [View source] + +
    +
    + +
    +
    + + def chan_send_count : Int32 + + # +
    + +
    +
    + + [View source] + +
    +
    + +
    +
    + + def chan_send_count=(chan_send_count : Int32) + + # +
    + +
    +
    + + [View source] + +
    +
    + +
    - def chan : Channel({String, String}) + def ip111_chan_send_count : Int32 - # + #

    -
    +
    - def get_ip_from_ib_sb + def ip111_chan_send_count=(ip111_chan_send_count : Int32) - # + #

    -
    +
    - def get_ip_from_ip138 + def ip_from_ib_sb - # + #

    - [View source] + [View source] + +
    +
    + +
    +
    + + def ip_from_ip111 + + # +
    + +
    +
    + + [View source] + +
    +
    + +
    +
    + + def ip_from_ip138 + + # +
    + +
    +
    + + [View source]
    @@ -278,15 +391,13 @@


    - -
    diff --git a/index.html b/index.html index 40ea767..5b5defb 100644 --- a/index.html +++ b/index.html @@ -4,8 +4,8 @@ - - + + @@ -14,7 +14,7 @@ - myip 0.4.6 + myip 0.4.8 @@ -45,7 +45,7 @@

    - 0.4.6 + 0.4.8

    diff --git a/index.json b/index.json index 03888aa..a2900e5 100644 --- a/index.json +++ b/index.json @@ -1 +1 @@ -{"repository_name":"myip","body":"# myip\n\n返回本机的公网 IP 以及访问外网的公网 IP,使用 http://www.ip138.com 以及 http://ib.sb/geoip 提供的服务。\n查看[文档](https://crystal-china.github.io/myip/)获取更多帮助\n\n```sh\n ╰─ $ bin/myip \n ╰─ $ myip\nip138.com:您的iP地址是:[1.2.3.4 ] 来自:中国广东 联通\nip.sb/geoip:您访问外网地址信息:\n{\"organization\" => \"Khalid Group\",\n \"longitude\" => -3.684,\n \"timezone\" => \"Europe/Madrid\",\n \"isp\" => \"Khalid Group\",\n \"offset\" => 3600,\n \"asn\" => 147291,\n \"asn_organization\" => \"KHALID GROUP\",\n \"country\" => \"Spain\",\n \"ip\" => \"5.6.7.8\",\n \"latitude\" => 40.4172,\n \"continent_code\" => \"EU\",\n \"country_code\" => \"ES\"}\n```\n\n## Contributing\n\n1. Fork it ()\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Billy.Zheng](https://github.com/zw963) - creator and maintainer\n","program":{"html_id":"myip/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"myip","program":true,"enum":false,"alias":false,"const":false,"types":[{"html_id":"myip/Myip","path":"Myip.html","kind":"class","full_name":"Myip","name":"Myip","abstract":false,"superclass":{"html_id":"myip/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"myip/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"myip/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/myip.cr","line_number":6,"url":"https://github.com/crystal-china/myip/blob/v0.4.6/src/myip.cr#L6"},{"filename":"src/myip/version.cr","line_number":1,"url":"https://github.com/crystal-china/myip/blob/v0.4.6/src/myip/version.cr#L1"}],"repository_name":"myip","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"VERSION","name":"VERSION","value":"{{ (`shards version \\\"/home/runner/work/myip/myip/src/myip\\\"`).chomp.stringify }}"}],"instance_methods":[{"html_id":"chan:Channel({String,String})-instance-method","name":"chan","abstract":false,"location":{"filename":"src/myip.cr","line_number":7,"url":"https://github.com/crystal-china/myip/blob/v0.4.6/src/myip.cr#L7"},"def":{"name":"chan","visibility":"Public","body":"@chan"}},{"html_id":"get_ip_from_ib_sb-instance-method","name":"get_ip_from_ib_sb","abstract":false,"location":{"filename":"src/myip.cr","line_number":9,"url":"https://github.com/crystal-china/myip/blob/v0.4.6/src/myip.cr#L9"},"def":{"name":"get_ip_from_ib_sb","visibility":"Public","body":"spawn do\n begin\n url = \"https://api.ip.sb/geoip\"\n response = HTTP::Client.get(url)\n result = JSON.parse(response.body)\n io = IO::Memory.new\n PrettyPrint.format(result, io, 79)\n io.rewind\n chan.send({\"ip.sb/geoip:您访问外网地址信息:\\n\", io.gets_to_end})\n rescue ex : ArgumentError | Socket::Error\n chan.send({\"ip.sb/geoip:\", ex.message.not_nil!})\n end\nend"}},{"html_id":"get_ip_from_ip138-instance-method","name":"get_ip_from_ip138","abstract":false,"location":{"filename":"src/myip.cr","line_number":23,"url":"https://github.com/crystal-china/myip/blob/v0.4.6/src/myip.cr#L23"},"def":{"name":"get_ip_from_ip138","visibility":"Public","body":"spawn do\n begin\n url = \"http://www.ip138.com\"\n doc = from_url(url, follow: true)\n ip138_url = (doc.css(\"iframe\")).first.attribute_by(\"src\")\n url = \"http:#{ip138_url}\"\n doc = from_url(url)\n chan.send({\"ip138.com:\", (doc.css(\"body p\")).first.tag_text.strip})\n rescue ex : ArgumentError | Socket::Error\n chan.send({\"ip138.com:\", ex.message.not_nil!})\n end\nend"}},{"html_id":"process-instance-method","name":"process","abstract":false,"location":{"filename":"src/myip.cr","line_number":37,"url":"https://github.com/crystal-china/myip/blob/v0.4.6/src/myip.cr#L37"},"def":{"name":"process","visibility":"Public","body":"2.times do\n select\nwhen value = chan.receive\n title, ip = value\n STDERR.puts(\"#{title}#{ip}\")\nwhen timeout(5.seconds)\n STDERR.puts(\"Timeout, check your network connection!\")\n exit\nend\n\nend"}}]}]}} \ No newline at end of file +{"repository_name":"myip","body":"# myip\n\n返回本机的公网 IP 以及访问外网的公网 IP,使用 http://www.ip138.com 以及 http://ib.sb/geoip 提供的服务。\n查看[文档](https://crystal-china.github.io/myip/)获取更多帮助\n\n```sh\n ╰─ $ bin/myip \n ╰─ $ myip\nip138.com:您的iP地址是:[1.2.3.4 ] 来自:中国广东 联通\nip.sb/geoip:您访问外网地址信息:\n{\"organization\" => \"Khalid Group\",\n \"longitude\" => -3.684,\n \"timezone\" => \"Europe/Madrid\",\n \"isp\" => \"Khalid Group\",\n \"offset\" => 3600,\n \"asn\" => 147291,\n \"asn_organization\" => \"KHALID GROUP\",\n \"country\" => \"Spain\",\n \"ip\" => \"5.6.7.8\",\n \"latitude\" => 40.4172,\n \"continent_code\" => \"EU\",\n \"country_code\" => \"ES\"}\n```\n\n## Contributing\n\n1. Fork it ()\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Billy.Zheng](https://github.com/zw963) - creator and maintainer\n","program":{"html_id":"myip/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"myip","program":true,"enum":false,"alias":false,"const":false,"types":[{"html_id":"myip/Myip","path":"Myip.html","kind":"class","full_name":"Myip","name":"Myip","abstract":false,"superclass":{"html_id":"myip/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"myip/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"myip/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/myip.cr","line_number":8,"url":"https://github.com/crystal-china/myip/blob/v0.4.8/src/myip.cr#L8"},{"filename":"src/myip/version.cr","line_number":1,"url":"https://github.com/crystal-china/myip/blob/v0.4.8/src/myip/version.cr#L1"}],"repository_name":"myip","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"VERSION","name":"VERSION","value":"{{ (`shards version \\\"/home/runner/work/myip/myip/src/myip\\\"`).chomp.stringify }}"}],"instance_methods":[{"html_id":"chan:Channel({String,String,String?})-instance-method","name":"chan","abstract":false,"location":{"filename":"src/myip.cr","line_number":9,"url":"https://github.com/crystal-china/myip/blob/v0.4.8/src/myip.cr#L9"},"def":{"name":"chan","visibility":"Public","body":"@chan"}},{"html_id":"chan_send_count:Int32-instance-method","name":"chan_send_count","abstract":false,"location":{"filename":"src/myip.cr","line_number":10,"url":"https://github.com/crystal-china/myip/blob/v0.4.8/src/myip.cr#L10"},"def":{"name":"chan_send_count","return_type":"Int32","visibility":"Public","body":"@chan_send_count"}},{"html_id":"chan_send_count=(chan_send_count:Int32)-instance-method","name":"chan_send_count=","abstract":false,"args":[{"name":"chan_send_count","external_name":"chan_send_count","restriction":"Int32"}],"args_string":"(chan_send_count : Int32)","args_html":"(chan_send_count : Int32)","location":{"filename":"src/myip.cr","line_number":10,"url":"https://github.com/crystal-china/myip/blob/v0.4.8/src/myip.cr#L10"},"def":{"name":"chan_send_count=","args":[{"name":"chan_send_count","external_name":"chan_send_count","restriction":"Int32"}],"visibility":"Public","body":"@chan_send_count = chan_send_count"}},{"html_id":"ip111_chan_send_count:Int32-instance-method","name":"ip111_chan_send_count","abstract":false,"location":{"filename":"src/myip.cr","line_number":11,"url":"https://github.com/crystal-china/myip/blob/v0.4.8/src/myip.cr#L11"},"def":{"name":"ip111_chan_send_count","return_type":"Int32","visibility":"Public","body":"@ip111_chan_send_count"}},{"html_id":"ip111_chan_send_count=(ip111_chan_send_count:Int32)-instance-method","name":"ip111_chan_send_count=","abstract":false,"args":[{"name":"ip111_chan_send_count","external_name":"ip111_chan_send_count","restriction":"Int32"}],"args_string":"(ip111_chan_send_count : Int32)","args_html":"(ip111_chan_send_count : Int32)","location":{"filename":"src/myip.cr","line_number":11,"url":"https://github.com/crystal-china/myip/blob/v0.4.8/src/myip.cr#L11"},"def":{"name":"ip111_chan_send_count=","args":[{"name":"ip111_chan_send_count","external_name":"ip111_chan_send_count","restriction":"Int32"}],"visibility":"Public","body":"@ip111_chan_send_count = ip111_chan_send_count"}},{"html_id":"ip_from_ib_sb-instance-method","name":"ip_from_ib_sb","abstract":false,"location":{"filename":"src/myip.cr","line_number":13,"url":"https://github.com/crystal-china/myip/blob/v0.4.8/src/myip.cr#L13"},"def":{"name":"ip_from_ib_sb","visibility":"Public","body":"self.chan_send_count = chan_send_count() + 1\nspawn do\n begin\n url = \"https://api.ip.sb/geoip\"\n response = HTTP::Client.get(url)\n result = JSON.parse(response.body)\n io = IO::Memory.new\n PrettyPrint.format(result, io, width: 79)\n io.rewind\n chan.send({\"----- Result from: #{url}:您访问外网地址信息:-----\", io.gets_to_end, nil})\n rescue ex : ArgumentError | Socket::Error\n chan.send({\"----- Error from: #{url}:-----\", ex.message.not_nil!, nil})\n end\nend\n"}},{"html_id":"ip_from_ip111-instance-method","name":"ip_from_ip111","abstract":false,"location":{"filename":"src/myip.cr","line_number":29,"url":"https://github.com/crystal-china/myip/blob/v0.4.8/src/myip.cr#L29"},"def":{"name":"ip_from_ip111","visibility":"Public","body":"ip111_url = \"http://www.ip111.cn\"\ndoc, code = from_url(ip111_url)\ntitle = (doc.css(\".card-header\")).first.tag_text.strip\nipinfo = (doc.css(\".card-body p\")).first.tag_text.strip\nSTDERR.puts(\"----- Result from #{ip111_url}:-----\", \"#{title}:#{ipinfo}\")\nheaders = HTTP::Headers {\"Referer\" => \"http://www.ip111.cn/\"}\n(doc.nodes(\"iframe\")).each do |node|\n self.chan_send_count = chan_send_count() + 1\n self.ip111_chan_send_count = ip111_chan_send_count() + 1\n spawn do\n begin\n url = (node.attribute_by(\"src\")).not_nil!\n doc, code = from_url(url, headers: headers)\n title = (node.parent!.parent!.parent!.css(\".card-header\")).first.tag_text.strip\n ipinfo = doc.body!.tag_text.strip\n ip = ipinfo[/[a-z0-9:.]+/]\n chan.send({\"----- Result from #{ip111_url}:#{url}:-----\", \"#{title}:#{ipinfo}\", ip})\n rescue ex : ArgumentError | Socket::Error\n chan.send({\"----- Error from: #{ip111_url}:#{url}:-----\", ex.message.not_nil!, nil})\n end\n end\nend\n"}},{"html_id":"ip_from_ip138-instance-method","name":"ip_from_ip138","abstract":false,"location":{"filename":"src/myip.cr","line_number":62,"url":"https://github.com/crystal-china/myip/blob/v0.4.8/src/myip.cr#L62"},"def":{"name":"ip_from_ip138","visibility":"Public","body":"self.chan_send_count = chan_send_count + 1\nspawn do\n begin\n url = \"https://www.ip138.com\"\n doc, _code = from_url(url, follow: true)\n ip138_url = (doc.css(\"iframe\")).first.attribute_by(\"src\")\n headers = HTTP::Headers {\"Origin\" => \"https://ip.skk.moe\"}\n doc, code = from_url(\"https:#{ip138_url}\", headers: headers)\n if code == 502\n myip = (doc.css(\"body p span.F\")).first.tag_text[/IP:\\s*([0-9.]+)/, 1]\n url = \"https://www.ip138.com/iplookup.php?ip=#{myip}\"\n doc, _code = from_url(url, headers: headers)\n output = String.build do |io|\n (doc.css(\"div.table-box>table>tbody tr\")).each do |x|\n io << x.tag_text\n end\n end\n chan.send({\"----- Result from: #{url}:-----\", output.squeeze('\\n'), nil})\n else\n chan.send({\"----- Result from: #{url}:-----\", (doc.css(\"body p\")).first.tag_text.strip, nil})\n end\n rescue ex : ArgumentError | Socket::Error\n chan.send({\"----- Error from: #{url}:-----\", ex.message.not_nil!, nil})\n end\nend\n"}},{"html_id":"process-instance-method","name":"process","abstract":false,"location":{"filename":"src/myip.cr","line_number":91,"url":"https://github.com/crystal-china/myip/blob/v0.4.8/src/myip.cr#L91"},"def":{"name":"process","visibility":"Public","body":"detail_chan = Channel(Tuple(String, String)).new\nchan_send_count.times do\n select\nwhen value = chan.receive\n title, ipinfo, ip = value\n STDERR.puts(\"#{(title.colorize(:yellow)).on_blue.bold}\\n#{ipinfo}\")\n if !ip.nil?\n spawn do\n details_ip_url = \"https://www.ipshudi.com/#{ip}.htm\"\n doc, _code = from_url(details_ip_url)\n output = String.build do |io|\n (doc.css(\"div.ft>table>tbody>tr>td\")).each do |x|\n io << x.tag_text\n end\n end\n detail_chan.send({\"----- Checking #{ip} use ipshudi.com:-----\", output.squeeze('\\n')})\n end\n end\nwhen timeout(5.seconds)\n STDERR.puts(\"Timeout, check your network connection!\")\n exit\nend\n\nend\nip111_chan_send_count.times do\n select\nwhen value = detail_chan.receive\n title, ipinfo = value\n STDERR.puts(\"#{(title.colorize(:yellow)).on_blue.bold}\\n#{ipinfo}\")\nend\n\nend\n"}}]}]}} \ No newline at end of file diff --git a/search-index.js b/search-index.js index 82a23ad..e26ff1f 100644 --- a/search-index.js +++ b/search-index.js @@ -1 +1 @@ -crystal_doc_search_index_callback({"repository_name":"myip","body":"# myip\n\n返回本机的公网 IP 以及访问外网的公网 IP,使用 http://www.ip138.com 以及 http://ib.sb/geoip 提供的服务。\n查看[文档](https://crystal-china.github.io/myip/)获取更多帮助\n\n```sh\n ╰─ $ bin/myip \n ╰─ $ myip\nip138.com:您的iP地址是:[1.2.3.4 ] 来自:中国广东 联通\nip.sb/geoip:您访问外网地址信息:\n{\"organization\" => \"Khalid Group\",\n \"longitude\" => -3.684,\n \"timezone\" => \"Europe/Madrid\",\n \"isp\" => \"Khalid Group\",\n \"offset\" => 3600,\n \"asn\" => 147291,\n \"asn_organization\" => \"KHALID GROUP\",\n \"country\" => \"Spain\",\n \"ip\" => \"5.6.7.8\",\n \"latitude\" => 40.4172,\n \"continent_code\" => \"EU\",\n \"country_code\" => \"ES\"}\n```\n\n## Contributing\n\n1. Fork it ()\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Billy.Zheng](https://github.com/zw963) - creator and maintainer\n","program":{"html_id":"myip/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"myip","program":true,"enum":false,"alias":false,"const":false,"types":[{"html_id":"myip/Myip","path":"Myip.html","kind":"class","full_name":"Myip","name":"Myip","abstract":false,"superclass":{"html_id":"myip/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"myip/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"myip/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/myip.cr","line_number":6,"url":"https://github.com/crystal-china/myip/blob/v0.4.6/src/myip.cr#L6"},{"filename":"src/myip/version.cr","line_number":1,"url":"https://github.com/crystal-china/myip/blob/v0.4.6/src/myip/version.cr#L1"}],"repository_name":"myip","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"VERSION","name":"VERSION","value":"{{ (`shards version \\\"/home/runner/work/myip/myip/src/myip\\\"`).chomp.stringify }}"}],"instance_methods":[{"html_id":"chan:Channel({String,String})-instance-method","name":"chan","abstract":false,"location":{"filename":"src/myip.cr","line_number":7,"url":"https://github.com/crystal-china/myip/blob/v0.4.6/src/myip.cr#L7"},"def":{"name":"chan","visibility":"Public","body":"@chan"}},{"html_id":"get_ip_from_ib_sb-instance-method","name":"get_ip_from_ib_sb","abstract":false,"location":{"filename":"src/myip.cr","line_number":9,"url":"https://github.com/crystal-china/myip/blob/v0.4.6/src/myip.cr#L9"},"def":{"name":"get_ip_from_ib_sb","visibility":"Public","body":"spawn do\n begin\n url = \"https://api.ip.sb/geoip\"\n response = HTTP::Client.get(url)\n result = JSON.parse(response.body)\n io = IO::Memory.new\n PrettyPrint.format(result, io, 79)\n io.rewind\n chan.send({\"ip.sb/geoip:您访问外网地址信息:\\n\", io.gets_to_end})\n rescue ex : ArgumentError | Socket::Error\n chan.send({\"ip.sb/geoip:\", ex.message.not_nil!})\n end\nend"}},{"html_id":"get_ip_from_ip138-instance-method","name":"get_ip_from_ip138","abstract":false,"location":{"filename":"src/myip.cr","line_number":23,"url":"https://github.com/crystal-china/myip/blob/v0.4.6/src/myip.cr#L23"},"def":{"name":"get_ip_from_ip138","visibility":"Public","body":"spawn do\n begin\n url = \"http://www.ip138.com\"\n doc = from_url(url, follow: true)\n ip138_url = (doc.css(\"iframe\")).first.attribute_by(\"src\")\n url = \"http:#{ip138_url}\"\n doc = from_url(url)\n chan.send({\"ip138.com:\", (doc.css(\"body p\")).first.tag_text.strip})\n rescue ex : ArgumentError | Socket::Error\n chan.send({\"ip138.com:\", ex.message.not_nil!})\n end\nend"}},{"html_id":"process-instance-method","name":"process","abstract":false,"location":{"filename":"src/myip.cr","line_number":37,"url":"https://github.com/crystal-china/myip/blob/v0.4.6/src/myip.cr#L37"},"def":{"name":"process","visibility":"Public","body":"2.times do\n select\nwhen value = chan.receive\n title, ip = value\n STDERR.puts(\"#{title}#{ip}\")\nwhen timeout(5.seconds)\n STDERR.puts(\"Timeout, check your network connection!\")\n exit\nend\n\nend"}}]}]}}) \ No newline at end of file +crystal_doc_search_index_callback({"repository_name":"myip","body":"# myip\n\n返回本机的公网 IP 以及访问外网的公网 IP,使用 http://www.ip138.com 以及 http://ib.sb/geoip 提供的服务。\n查看[文档](https://crystal-china.github.io/myip/)获取更多帮助\n\n```sh\n ╰─ $ bin/myip \n ╰─ $ myip\nip138.com:您的iP地址是:[1.2.3.4 ] 来自:中国广东 联通\nip.sb/geoip:您访问外网地址信息:\n{\"organization\" => \"Khalid Group\",\n \"longitude\" => -3.684,\n \"timezone\" => \"Europe/Madrid\",\n \"isp\" => \"Khalid Group\",\n \"offset\" => 3600,\n \"asn\" => 147291,\n \"asn_organization\" => \"KHALID GROUP\",\n \"country\" => \"Spain\",\n \"ip\" => \"5.6.7.8\",\n \"latitude\" => 40.4172,\n \"continent_code\" => \"EU\",\n \"country_code\" => \"ES\"}\n```\n\n## Contributing\n\n1. Fork it ()\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Billy.Zheng](https://github.com/zw963) - creator and maintainer\n","program":{"html_id":"myip/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"myip","program":true,"enum":false,"alias":false,"const":false,"types":[{"html_id":"myip/Myip","path":"Myip.html","kind":"class","full_name":"Myip","name":"Myip","abstract":false,"superclass":{"html_id":"myip/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"myip/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"myip/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/myip.cr","line_number":8,"url":"https://github.com/crystal-china/myip/blob/v0.4.8/src/myip.cr#L8"},{"filename":"src/myip/version.cr","line_number":1,"url":"https://github.com/crystal-china/myip/blob/v0.4.8/src/myip/version.cr#L1"}],"repository_name":"myip","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"VERSION","name":"VERSION","value":"{{ (`shards version \\\"/home/runner/work/myip/myip/src/myip\\\"`).chomp.stringify }}"}],"instance_methods":[{"html_id":"chan:Channel({String,String,String?})-instance-method","name":"chan","abstract":false,"location":{"filename":"src/myip.cr","line_number":9,"url":"https://github.com/crystal-china/myip/blob/v0.4.8/src/myip.cr#L9"},"def":{"name":"chan","visibility":"Public","body":"@chan"}},{"html_id":"chan_send_count:Int32-instance-method","name":"chan_send_count","abstract":false,"location":{"filename":"src/myip.cr","line_number":10,"url":"https://github.com/crystal-china/myip/blob/v0.4.8/src/myip.cr#L10"},"def":{"name":"chan_send_count","return_type":"Int32","visibility":"Public","body":"@chan_send_count"}},{"html_id":"chan_send_count=(chan_send_count:Int32)-instance-method","name":"chan_send_count=","abstract":false,"args":[{"name":"chan_send_count","external_name":"chan_send_count","restriction":"Int32"}],"args_string":"(chan_send_count : Int32)","args_html":"(chan_send_count : Int32)","location":{"filename":"src/myip.cr","line_number":10,"url":"https://github.com/crystal-china/myip/blob/v0.4.8/src/myip.cr#L10"},"def":{"name":"chan_send_count=","args":[{"name":"chan_send_count","external_name":"chan_send_count","restriction":"Int32"}],"visibility":"Public","body":"@chan_send_count = chan_send_count"}},{"html_id":"ip111_chan_send_count:Int32-instance-method","name":"ip111_chan_send_count","abstract":false,"location":{"filename":"src/myip.cr","line_number":11,"url":"https://github.com/crystal-china/myip/blob/v0.4.8/src/myip.cr#L11"},"def":{"name":"ip111_chan_send_count","return_type":"Int32","visibility":"Public","body":"@ip111_chan_send_count"}},{"html_id":"ip111_chan_send_count=(ip111_chan_send_count:Int32)-instance-method","name":"ip111_chan_send_count=","abstract":false,"args":[{"name":"ip111_chan_send_count","external_name":"ip111_chan_send_count","restriction":"Int32"}],"args_string":"(ip111_chan_send_count : Int32)","args_html":"(ip111_chan_send_count : Int32)","location":{"filename":"src/myip.cr","line_number":11,"url":"https://github.com/crystal-china/myip/blob/v0.4.8/src/myip.cr#L11"},"def":{"name":"ip111_chan_send_count=","args":[{"name":"ip111_chan_send_count","external_name":"ip111_chan_send_count","restriction":"Int32"}],"visibility":"Public","body":"@ip111_chan_send_count = ip111_chan_send_count"}},{"html_id":"ip_from_ib_sb-instance-method","name":"ip_from_ib_sb","abstract":false,"location":{"filename":"src/myip.cr","line_number":13,"url":"https://github.com/crystal-china/myip/blob/v0.4.8/src/myip.cr#L13"},"def":{"name":"ip_from_ib_sb","visibility":"Public","body":"self.chan_send_count = chan_send_count() + 1\nspawn do\n begin\n url = \"https://api.ip.sb/geoip\"\n response = HTTP::Client.get(url)\n result = JSON.parse(response.body)\n io = IO::Memory.new\n PrettyPrint.format(result, io, width: 79)\n io.rewind\n chan.send({\"----- Result from: #{url}:您访问外网地址信息:-----\", io.gets_to_end, nil})\n rescue ex : ArgumentError | Socket::Error\n chan.send({\"----- Error from: #{url}:-----\", ex.message.not_nil!, nil})\n end\nend\n"}},{"html_id":"ip_from_ip111-instance-method","name":"ip_from_ip111","abstract":false,"location":{"filename":"src/myip.cr","line_number":29,"url":"https://github.com/crystal-china/myip/blob/v0.4.8/src/myip.cr#L29"},"def":{"name":"ip_from_ip111","visibility":"Public","body":"ip111_url = \"http://www.ip111.cn\"\ndoc, code = from_url(ip111_url)\ntitle = (doc.css(\".card-header\")).first.tag_text.strip\nipinfo = (doc.css(\".card-body p\")).first.tag_text.strip\nSTDERR.puts(\"----- Result from #{ip111_url}:-----\", \"#{title}:#{ipinfo}\")\nheaders = HTTP::Headers {\"Referer\" => \"http://www.ip111.cn/\"}\n(doc.nodes(\"iframe\")).each do |node|\n self.chan_send_count = chan_send_count() + 1\n self.ip111_chan_send_count = ip111_chan_send_count() + 1\n spawn do\n begin\n url = (node.attribute_by(\"src\")).not_nil!\n doc, code = from_url(url, headers: headers)\n title = (node.parent!.parent!.parent!.css(\".card-header\")).first.tag_text.strip\n ipinfo = doc.body!.tag_text.strip\n ip = ipinfo[/[a-z0-9:.]+/]\n chan.send({\"----- Result from #{ip111_url}:#{url}:-----\", \"#{title}:#{ipinfo}\", ip})\n rescue ex : ArgumentError | Socket::Error\n chan.send({\"----- Error from: #{ip111_url}:#{url}:-----\", ex.message.not_nil!, nil})\n end\n end\nend\n"}},{"html_id":"ip_from_ip138-instance-method","name":"ip_from_ip138","abstract":false,"location":{"filename":"src/myip.cr","line_number":62,"url":"https://github.com/crystal-china/myip/blob/v0.4.8/src/myip.cr#L62"},"def":{"name":"ip_from_ip138","visibility":"Public","body":"self.chan_send_count = chan_send_count + 1\nspawn do\n begin\n url = \"https://www.ip138.com\"\n doc, _code = from_url(url, follow: true)\n ip138_url = (doc.css(\"iframe\")).first.attribute_by(\"src\")\n headers = HTTP::Headers {\"Origin\" => \"https://ip.skk.moe\"}\n doc, code = from_url(\"https:#{ip138_url}\", headers: headers)\n if code == 502\n myip = (doc.css(\"body p span.F\")).first.tag_text[/IP:\\s*([0-9.]+)/, 1]\n url = \"https://www.ip138.com/iplookup.php?ip=#{myip}\"\n doc, _code = from_url(url, headers: headers)\n output = String.build do |io|\n (doc.css(\"div.table-box>table>tbody tr\")).each do |x|\n io << x.tag_text\n end\n end\n chan.send({\"----- Result from: #{url}:-----\", output.squeeze('\\n'), nil})\n else\n chan.send({\"----- Result from: #{url}:-----\", (doc.css(\"body p\")).first.tag_text.strip, nil})\n end\n rescue ex : ArgumentError | Socket::Error\n chan.send({\"----- Error from: #{url}:-----\", ex.message.not_nil!, nil})\n end\nend\n"}},{"html_id":"process-instance-method","name":"process","abstract":false,"location":{"filename":"src/myip.cr","line_number":91,"url":"https://github.com/crystal-china/myip/blob/v0.4.8/src/myip.cr#L91"},"def":{"name":"process","visibility":"Public","body":"detail_chan = Channel(Tuple(String, String)).new\nchan_send_count.times do\n select\nwhen value = chan.receive\n title, ipinfo, ip = value\n STDERR.puts(\"#{(title.colorize(:yellow)).on_blue.bold}\\n#{ipinfo}\")\n if !ip.nil?\n spawn do\n details_ip_url = \"https://www.ipshudi.com/#{ip}.htm\"\n doc, _code = from_url(details_ip_url)\n output = String.build do |io|\n (doc.css(\"div.ft>table>tbody>tr>td\")).each do |x|\n io << x.tag_text\n end\n end\n detail_chan.send({\"----- Checking #{ip} use ipshudi.com:-----\", output.squeeze('\\n')})\n end\n end\nwhen timeout(5.seconds)\n STDERR.puts(\"Timeout, check your network connection!\")\n exit\nend\n\nend\nip111_chan_send_count.times do\n select\nwhen value = detail_chan.receive\n title, ipinfo = value\n STDERR.puts(\"#{(title.colorize(:yellow)).on_blue.bold}\\n#{ipinfo}\")\nend\n\nend\n"}}]}]}}) \ No newline at end of file