{"id":932,"date":"2023-02-24T20:53:41","date_gmt":"2023-02-24T12:53:41","guid":{"rendered":"https:\/\/imuslab.com\/wordpress\/?p=932"},"modified":"2023-02-24T21:04:28","modified_gmt":"2023-02-24T13:04:28","slug":"golang-%e7%a8%8b%e5%ba%8f%e9%80%a3%e7%ba%8c%e5%9f%b7%e8%a1%8c%e4%b8%80%e5%80%8b%e6%9c%88%e4%b9%8b%e5%be%8c%e4%b8%80%e5%ae%9a%e6%9c%83%e5%87%ba%e9%8c%af%e4%b9%8b%e7%a5%9e%e5%a5%87%e5%8e%9f%e5%9b%a0","status":"publish","type":"post","link":"https:\/\/imuslab.com\/wordpress\/2023\/02\/24\/golang-%e7%a8%8b%e5%ba%8f%e9%80%a3%e7%ba%8c%e5%9f%b7%e8%a1%8c%e4%b8%80%e5%80%8b%e6%9c%88%e4%b9%8b%e5%be%8c%e4%b8%80%e5%ae%9a%e6%9c%83%e5%87%ba%e9%8c%af%e4%b9%8b%e7%a5%9e%e5%a5%87%e5%8e%9f%e5%9b%a0\/","title":{"rendered":"Golang \u7a0b\u5e8f\u9023\u7e8c\u57f7\u884c\u4e00\u500b\u6708\u4e4b\u5f8c\u4e00\u5b9a\u6703\u51fa\u932f\u4e4b\u795e\u5947\u539f\u56e0\u53ca\u9664\u932f"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"785\" height=\"575\" src=\"https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2023\/02\/\u5716\u7247.png\" alt=\"\" class=\"wp-image-933\" srcset=\"https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2023\/02\/\u5716\u7247.png 785w, https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2023\/02\/\u5716\u7247-300x220.png 300w, https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2023\/02\/\u5716\u7247-768x563.png 768w\" sizes=\"auto, (max-width: 785px) 100vw, 785px\" \/><\/figure>\n\n\n\n<p>\u8a71\u8aaa\u534a\u5e74\u524d\u6211\u958b\u767c\u4e86\u4e00\u500b\u53eb <a href=\"https:\/\/github.com\/tobychui\/imusutm\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"imusutm  (opens in a new tab)\">imusutm <\/a>\u7684 Simple Up Time Monitor\u3002\u5b83\u662f\u4e00\u500b\u5f88\u7c21\u55ae\u7684\u7a0b\u5f0f\uff1a\u6bcf\u9694 5 \u5206\u9418\u53bb ping \u4e00\u6b21 json \u8a2d\u5b9a\u6a94\u6848\u88e1\u9762\u7684\u7db2\u5740\uff0c\u7136\u5f8c\u628a\u5b83 buffer \u5230 RAM\u3002\u540c\u6642\u63d0\u4f9b\u4e00\u500b RESTFUL API \u7d66 php script \u4f86 call \u4e26\u56de\u50b3\u6700\u8fd1\u4e00\u5929\u7684\u72c0\u614b\u3002<\/p>\n\n\n\n<p>\u53ef\u662f\u4e0d\u77e5\u9053\u70ba\u751a\u9ebc\uff0c\u9019\u7a0b\u5f0f\u5f88\u56fa\u5b9a\u6bcf\u9694\u4e00\u500b\u6708\u5c31\u6703\u51fa\u73fe\u5168\u90e8\u65b7\u7dda\u7684\u72c0\u614b\uff0c\u9023\u5e36\u7528\u9019\u7cfb\u7d71\u7684 Telegram bot \u4e5f\u4e00\u5f8b\u5168\u90e8\u5831\u932f<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"478\" height=\"451\" src=\"https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2023\/02\/\u5716\u7247-2.png\" alt=\"\" class=\"wp-image-935\" srcset=\"https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2023\/02\/\u5716\u7247-2.png 478w, https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2023\/02\/\u5716\u7247-2-300x283.png 300w\" sizes=\"auto, (max-width: 478px) 100vw, 478px\" \/><\/figure>\n\n\n\n<p>\u5728\u7121\u8ad6\u5982\u4f55\u90fd\u6c92\u8fa6\u6cd5\u5728\u672c\u5730\u7aef reproduce \u4e4b\u5f8c\uff0c\u5728\u4e0a\u4e00\u500b\u6708\u6211\u628a\u6240\u6709 error \u88e1\u90fd\u52a0\u5165\u4e86 error message print-out \u4f86\u5354\u52a9\u9664\u932f\u3002\u7d50\u679c\u88ab\u6211\u767c\u73fe\u554f\u984c\u4e86\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>2023\/02\/24 20:20:34 Get \"{\u67d0\u500b\u8981 ping \u7684 IP \u5730\u5740}\": dial tcp {\u67d0\u500b\u8981 ping \u7684 IP \u5730\u5740}: bind: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full.<\/code><\/pre>\n\n\n\n<p>\u4e00\u770b\u5230\u9019\u500b\u6211\u5c31\u660e\u767d\u4e86\uff0c\u539f\u672c\u662f socket \u7528\u5149\u4e86\u3002\u53ef\u662f\u4e00\u53f0\u4e3b\u6a5f\u7684 socket \u6709\u9019\u9ebc\u591a\u600e\u53ef\u80fd\u80fd\u5168\u90e8\u4f54\u7528\uff1f<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u539f\u4f86\u662f\u5fd8\u8a18\u4e86 resp.Body.Close()<\/h3>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"704\" height=\"315\" src=\"https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2023\/02\/\u5716\u7247-3.png\" alt=\"\" class=\"wp-image-936\" srcset=\"https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2023\/02\/\u5716\u7247-3.png 704w, https:\/\/imuslab.com\/wordpress\/wp-content\/uploads\/2023\/02\/\u5716\u7247-3-300x134.png 300w\" sizes=\"auto, (max-width: 704px) 100vw, 704px\" \/><\/figure>\n\n\n\n<p>\u65bc\u662f\u6211\u53bb\u770b\u6574\u6bb5 code \u552f\u4e00\u6709\u7528\u5230 socket \u7684\u90e8\u5206\uff1ahttp.Get(url)\uff0c\u767c\u73fe\u5fd8\u8a18\u4e86\u5beb resp.Body.Close() \u4e86\uff08222 \u884c\u662f\u65b0\u52a0\u5165\u7684\uff09\uff0c\u6240\u4ee5\u96e3\u602a\u6703\u51fa\u73fe\u9019\u500b\u554f\u984c\u3002 <\/p>\n\n\n\n<p>\u53ef\u662f\uff0c\u53c8\u70ba\u751a\u9ebc\u662f\u5927\u7d04\u4e00\u500b\u6708\u6703\u51fa\u73fe\u4e00\u6b21\uff1f<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Windows \u7684 Dynamic Port \u8207 ArozOS<\/h3>\n\n\n\n<p><a href=\"https:\/\/superuser.com\/questions\/1090122\/what-is-the-default-range-of-ephemeral-ports-in-windows-7\">Windows \u7684 dynamic port range \u662f\u7531 49152 \u5230 65535<\/a>\u3002\u96d6\u7136\u6709\u4e00\u4e9b\u9593\u4e2d\u6703\u88ab\u4f54\u7528\uff0c\u4f46\u662f\u5927\u90e8\u5206\u90fd\u662f\u7528\u5b8c\u4e4b\u5f8c\u5c31\u6703\u88ab\u91cb\u653e\u51fa\u4f86\u3002\u9019\u5169\u500b\u6578\u5b57\u76f8\u6e1b\u4e4b\u5f8c\u4fbf\u80fd\u5f97\u51fa  16384  \u500b\u80fd\u7528\u7684 dynamic port\u3002<\/p>\n\n\n\n<p>\u81f3\u65bc\u70ba\u751a\u9ebc\u662f\u4e00\u500b\u6708\uff1f\u56e0\u70ba \u6bcf\u5c0f\u6642\u6709 12 \u500b 5 \u5206\u9418 x \u4e00\u5929 24\u5c0f\u6642 x  30\u5929 =  8640 \u500b connection\uff0c\u7136\u5f8c\u7531\u65bc ArozOS \u4f7f\u7528\u7684 Go net\/http \u6703\u81ea\u52d5\u65b7\u958b\uff0c\u800c\u9019\u6578\u5b57\u53c8\u5dee\u4e0d\u591a\u662f\u53ef\u7528 port \u6578\u7684\u4e00\u534a\uff0c\u518d\u52a0\u4e0a\u5217\u8868\u4e0a\u53c8\u525b\u597d\u53ea\u6709\u5169\u500b connection \u662f\u80fd\u7dad\u6301\u7684\uff0c\u6211\u597d\u50cf\u731c\u5230\u9ede\u751a\u9ebc\u7684\u6a23\u5b50\uff08\uff1f<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u7e3d\u62ec\u800c\u8a00<\/h3>\n\n\n\n<p>\u76f8\u4fe1\u52a0\u5165\u4e86 resp.Body.Close() \u4e4b\u5f8c\u5c31\u80fd\u89e3\u6c7a utm \u4e0d\u7a69\u5b9a\u7684\u554f\u984c\u4e86\uff0c\u5982\u679c\u4e0b\u4e00\u500b\u6708\u518d\u51fa\u73fe\u985e\u4f3c\u7684\u554f\u984c\u6211\u9084\u662f\u6574\u500b\u780d\u6389\u91cd\u5beb\u597d\u4e86\uff08\u7562\u7adf\u9019\u53ea\u662f\u4e00\u500b\u6211\u5728\u7b49\u4e0a\u98db\u6a5f\u6642\u7684\u5c0f\u4f5c\u54c1\uff0c\u51fa\u73fe\u9019\u4e9b\u5947\u602a\u7684 bug \u4e5f\u4e0d\u600e\u9ebc\u610f\u5916\u5c31\u662f\u4e86\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8a71\u8aaa\u534a\u5e74\u524d\u6211\u958b\u767c\u4e86\u4e00\u500b\u53eb imusutm \u7684 Simple Up Time Monitor\u3002\u5b83\u662f\u4e00\u500b\u5f88\u7c21\u55ae\u7684\u7a0b\u5f0f\uff1a\u6bcf\u9694 5 \u5206\u9418\u53bb ping \u4e00\u6b21 json \u8a2d\u5b9a\u6a94\u6848\u88e1\u9762\u7684\u7db2\u5740\uff0c\u7136\u5f8c\u628a\u5b83 buffer \u5230 RAM\u3002\u540c\u6642\u63d0\u4f9b\u4e00\u500b RESTFUL API \u7d66 php script \u4f86 call \u4e26\u56de\u50b3\u6700\u8fd1\u4e00\u5929\u7684\u72c0\u614b\u3002 \u53ef\u662f\u4e0d\u77e5\u9053\u70ba\u751a\u9ebc\uff0c\u9019\u7a0b\u5f0f\u5f88\u56fa\u5b9a\u6bcf\u9694\u4e00\u500b\u6708\u5c31\u6703\u51fa\u73fe\u5168\u90e8\u65b7\u7dda\u7684\u72c0\u614b\uff0c\u9023\u5e36\u7528\u9019\u7cfb\u7d71\u7684 Telegram bot \u4e5f\u4e00\u5f8b\u5168\u90e8\u5831\u932f \u5728\u7121\u8ad6\u5982\u4f55\u90fd\u6c92\u8fa6\u6cd5\u5728\u672c\u5730\u7aef reproduce \u4e4b\u5f8c\uff0c\u5728\u4e0a\u4e00\u500b\u6708\u6211\u628a\u6240\u6709 error \u88e1\u90fd\u52a0\u5165\u4e86 error message print-out \u4f86\u5354\u52a9\u9664\u932f\u3002\u7d50\u679c\u88ab\u6211\u767c\u73fe\u554f\u984c\u4e86\uff1a \u4e00\u770b\u5230\u9019\u500b\u6211\u5c31\u660e\u767d\u4e86\uff0c\u539f\u672c\u662f socket \u7528\u5149\u4e86\u3002\u53ef\u662f\u4e00\u53f0\u4e3b\u6a5f\u7684 socket \u6709\u9019\u9ebc\u591a\u600e\u53ef\u80fd\u80fd\u5168\u90e8\u4f54\u7528\uff1f \u539f\u4f86\u662f\u5fd8\u8a18\u4e86 resp.Body.Close() \u65bc\u662f\u6211\u53bb\u770b\u6574\u6bb5 code \u552f\u4e00\u6709\u7528\u5230 socket \u7684\u90e8\u5206\uff1ahttp.Get(url)\uff0c\u767c\u73fe\u5fd8\u8a18\u4e86\u5beb resp.Body.Close() \u4e86\uff08222 \u884c\u662f\u65b0\u52a0\u5165\u7684\uff09\uff0c\u6240\u4ee5\u96e3\u602a\u6703\u51fa\u73fe\u9019\u500b\u554f\u984c\u3002 \u53ef\u662f\uff0c\u53c8\u70ba\u751a\u9ebc\u662f\u5927\u7d04\u4e00\u500b\u6708\u6703\u51fa\u73fe\u4e00\u6b21\uff1f Windows \u7684 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[104],"tags":[],"class_list":["post-932","post","type-post","status-publish","format-standard","hentry","category-bug-tips"],"_links":{"self":[{"href":"https:\/\/imuslab.com\/wordpress\/wp-json\/wp\/v2\/posts\/932","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/imuslab.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/imuslab.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/imuslab.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/imuslab.com\/wordpress\/wp-json\/wp\/v2\/comments?post=932"}],"version-history":[{"count":2,"href":"https:\/\/imuslab.com\/wordpress\/wp-json\/wp\/v2\/posts\/932\/revisions"}],"predecessor-version":[{"id":938,"href":"https:\/\/imuslab.com\/wordpress\/wp-json\/wp\/v2\/posts\/932\/revisions\/938"}],"wp:attachment":[{"href":"https:\/\/imuslab.com\/wordpress\/wp-json\/wp\/v2\/media?parent=932"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/imuslab.com\/wordpress\/wp-json\/wp\/v2\/categories?post=932"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/imuslab.com\/wordpress\/wp-json\/wp\/v2\/tags?post=932"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}