{"id":463694,"date":"2025-06-17T21:00:38","date_gmt":"2025-06-17T21:00:38","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=463694"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=463694","title":{"rendered":"<span>net\/http: \u0420\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u00ab\u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c\u00bb<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412\u00a0\u043c\u0438\u0440\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u0435\u0431\u2011\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 (\u0434\u0430, \u0434\u0430, \u044d\u0442\u043e \u0442\u043e\u0442 \u0441\u0430\u043c\u044b\u0439 \u0445\u0430\u0439\u043f \u043f\u0440\u043e \u00ab\u0445\u0430\u0439\u043b\u043e\u0430\u0434\u00bb, \u00ab\u043b\u0435\u0433\u043a\u043e\u0432\u0435\u0441\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438\u00bb, \u00abio\u2011bound \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438\u00bb \u0438 \u0434\u0440\u0443\u0433\u043e\u0435) Go \u0437\u0430\u0432\u043e\u0435\u0432\u0430\u043b \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u044c \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0441\u0432\u043e\u0435\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043b\u0435\u0433\u043a\u043e\u0441\u0442\u0438 \u0438 \u043d\u0430\u0434\u0435\u0436\u043d\u043e\u0441\u0442\u0438. \u041e\u0434\u043d\u0438\u043c \u0438\u0437\u00a0\u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u044b Go \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 <a href=\"https:\/\/pkg.go.dev\/net\/http#pkg-index\" rel=\"noopener noreferrer nofollow\">net\/http<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f\u00a0\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f HTTP\u2011\u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432. \u041e\u0434\u043d\u0430\u043a\u043e, \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430\u00a0\u043a\u0430\u0436\u0443\u0449\u0443\u044e\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u043a\u0435\u0442\u0430, \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043c\u043e\u0436\u0435\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0432\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u0434\u0430 \u0438 \u043f\u043e\u043c\u043e\u0447\u044c \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a.<\/p>\n<p>\u041c\u044b \u0432\u043c\u0435\u0441\u0442\u0435 \u0432\u00a0\u0432\u0430\u043c\u0438, \u0434\u043e\u0440\u043e\u0433\u0438\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0438, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0430\u0441\u043f\u0435\u043a\u0442\u044b \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b net\/http, \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0432\u0435\u0441\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0430\u00a0\u0442\u0430\u043a\u0436\u0435 \u043e\u0431\u0441\u0443\u0434\u0438\u043c, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437\u00a0\u044d\u0442\u0430\u043f\u043e\u0432 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435. \u041d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442\u00a0\u0443\u0440\u043e\u0432\u043d\u044f \u0432\u0430\u0448\u0438\u0445 \u0437\u043d\u0430\u043d\u0438\u0439, \u0431\u0443\u0434\u044c \u0432\u044b \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u043c \u0438\u043b\u0438\u00a0\u043e\u043f\u044b\u0442\u043d\u044b\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c, \u0432\u044b \u043d\u0430\u0439\u0434\u0435\u0442\u0435 \u0437\u0434\u0435\u0441\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u043c \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 Go \u0434\u043b\u044f\u00a0\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u044b\u0441\u043e\u043a\u043e\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0438 \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0445 \u0432\u0435\u0431\u2011\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439.<\/p>\n<h4>\u0414\u043b\u044f \u043a\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f?<\/h4>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e\u00a0\u0436\u0435, \u0434\u043b\u044f\u00a0\u0442\u0435\u0445, \u043a\u0442\u043e \u0445\u043e\u0447\u0435\u0442 \u0433\u043b\u0443\u0431\u0436\u0435 \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a\u00a0\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0430\u00a0\u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0430\u043a\u0435\u0442\u0430 net\/http \u0432\u00a0Go. \u041d\u043e! \u041e\u043d\u0430 \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u0442\u0435\u043c, \u043a\u0442\u043e \u0443\u0436\u0435 \u043f\u0438\u0448\u0435\u0442 HTTP\u2011\u0441\u0435\u0440\u0432\u0438\u0441\u044b \u043d\u0430\u00a0Go \u0438 \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u0441\u044f \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u0441\u0432\u043e\u0438 \u043d\u0430\u0432\u044b\u043a\u0438. \u041d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043d\u0430\u0439\u0434\u0443\u0442 \u0437\u0434\u0435\u0441\u044c \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0430\u00a0\u0443\u0436\u0435 \u043e\u043f\u044b\u0442\u043d\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b \u0441\u043c\u043e\u0433\u0443\u0442 \u043e\u0441\u0432\u0435\u0436\u0438\u0442\u044c \u0437\u043d\u0430\u043d\u0438\u044f \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u0430\u0439\u0442\u0438 \u0434\u043b\u044f\u00a0\u0441\u0435\u0431\u044f \u0447\u0442\u043e\u2011\u0442\u043e \u043d\u043e\u0432\u043e\u0435. \u0427\u0442\u043e\u0431\u044b \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u043f\u043e\u043b\u044c\u0437\u044b \u043e\u0442\u00a0\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438,\u00a0\u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0437\u043d\u0430\u043d\u0438\u044f \u044f\u0437\u044b\u043a\u0430 Go, \u043d\u043e\u00a0\u0434\u0430\u0436\u0435 \u0431\u0435\u0437\u00a0\u043d\u0438\u0445 \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043d\u044f\u0442\u044c \u0441\u0443\u0442\u044c \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<blockquote>\n<p>\u0425\u043e\u0447\u0443 \u0442\u0430\u043a\u0436\u0435 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e\u00a0\u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043d\u0435\u00a0\u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 net\/http, \u043d\u043e\u00a0\u0438 \u0441\u043b\u0443\u0436\u0438\u0442 \u0445\u043e\u0440\u043e\u0448\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u00a0\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u041f\u041e\u00a0\u043d\u0430\u00a0\u044f\u0437\u044b\u043a\u0435 Go. \u0412\u0435\u0434\u044c \u043f\u043e\u0437\u043d\u0430\u043d\u0438\u0435 \u043a\u0430\u043a\u0438\u0445\u2011\u043b\u0438\u0431\u043e \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432, \u0437\u0430\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0440\u043e\u0434\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0438\u043a\u0430\u043c\u0438 \u043a\u0430\u043a\u043e\u0433\u043e\u2011\u043b\u0438\u0431\u043e \u0434\u0435\u043b\u0430\u00a0\u2014 \u043f\u043e\u043b\u0435\u0437\u043d\u043e, \u0438, \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u044d\u0442\u043e \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a\u00a0\u043b\u044e\u0431\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f, \u0431\u0443\u0434\u044c \u0442\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u044f\u0437\u044b\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043d\u0430\u0443\u0447\u043d\u0430\u044f \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u0430, \u0442\u0432\u043e\u0440\u0447\u0435\u0441\u0442\u0432\u043e \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<\/blockquote>\n<h4>\u041f\u043b\u0430\u043d<\/h4>\n<p>\u042f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0438\u0434\u0442\u0438 \u043f\u043e\u044d\u0442\u0430\u043f\u043d\u043e, \u0441\u0432\u0435\u0440\u0445\u0443\u00a0\u2014 \u0432\u043d\u0438\u0437, \u0434\u043b\u044f\u00a0\u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b, \u0434\u0430\u0436\u0435 \u043d\u043e\u0432\u0438\u0447\u043a\u0443 \u0432\u00a0Go,\u00a0\u0431\u044b\u043b\u0430 \u043f\u043e\u043d\u044f\u0442\u043d\u0430 \u00ab\u043c\u0430\u0433\u0438\u044f\u00bb \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e\u00a0\u0442\u043e\u043c, \u043a\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0432\u00a0\u044d\u0442\u0438 \u00ab\u0442\u0430\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0433\u043b\u0443\u0431\u0438\u043d\u044b\u00bb \u044f\u0437\u044b\u043a\u0430 \u0438 \u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u044c \u0438\u0445. \u041f\u043e\u0439\u0434\u0451\u043c \u043f\u043e\u00a0\u043f\u0443\u043d\u0442\u043a\u0430\u043c:<\/p>\n<ol>\n<li>\n<p>\u041a\u0440\u0430\u0442\u043a\u0438\u0439 \u044d\u043a\u0441\u043a\u0443\u0440\u0441 \u0432 HTTP<\/p>\n<\/li>\n<li>\n<p>\u0421\u0442\u0430\u0440\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430: \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>http.ListenAndServe()<\/code>, \u043c\u0435\u0442\u043e\u0434 <code>server.ListenAndServe().<\/code><\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432: \u043c\u0435\u0442\u043e\u0434 <code>server.Serve().<\/code><\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0447\u0430\u0441\u0442\u044f\u0445: <\/p>\n<ol>\n<li>\n<p>\u0420\u043e\u0443\u0442\u0438\u043d\u0433 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043d\u0430 \u043c\u043e\u0434\u0443\u043b\u044c net\/http.<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430 \u043b\u0438\u0441\u0442\u0435\u043d\u0435\u0440\u0430 \u00ab\u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c\u00bb<\/p>\n<\/li>\n<li>\n<p>\u0418 \u043c\u043d\u043e\u0433\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435&#8230; <\/p>\n<\/li>\n<\/ol>\n<h2>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c<\/h2>\n<h3>\u041a\u0440\u0430\u0442\u043a\u0438\u0439 \u044d\u043a\u0441\u043a\u0443\u0440\u0441 \u0432 HTTP<\/h3>\n<p>\u041d\u0430\u0447\u043d\u0451\u043c \u0441\u00a0\u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u00a0\u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0432\u00a0\u0441\u0435\u0442\u0438 (\u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442). \u0427\u0442\u043e\u0431\u044b \u043a\u0430\u043a\u2011\u0442\u043e \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438, \u0440\u0435\u0448\u0430\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0438\u00a0\u0442.\u00a0\u0434.,\u00a0\u0431\u044b\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437\u00a0\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d \u043f\u043e\u00a0\u0443\u0440\u043e\u0432\u043d\u044f\u043c\/ \u042d\u0442\u0430 \u0438\u0434\u0435\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0432 7-\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A1%D0%B5%D1%82%D0%B5%D0%B2%D0%B0%D1%8F_%D0%BC%D0%BE%D0%B4%D0%B5%D0%BB%D1%8C_OSI\" rel=\"noopener noreferrer nofollow\">OSI <\/a>(\u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438) \u0438 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u043e\u0439 4-\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/TCP\/IP\" rel=\"noopener noreferrer nofollow\">TCP\/IP<\/a> (\u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u0432\u00a0\u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435). \u0427\u0435\u043c \u043d\u0438\u0436\u0435 \u0443\u0440\u043e\u0432\u0435\u043d\u044c, \u0442\u0435\u043c \u0431\u043b\u0438\u0436\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438 \u0443\u0440\u043e\u0432\u043d\u044f \u043a\u00a0\u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430\u043c, \u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442. \u0422\u0430\u043a \u0432\u043e\u0442, \u0432\u00a0\u043c\u0438\u0440\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u0432\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430:<\/p>\n<p><strong>TCP<\/strong>\u00a0(<em>\u043e\u0442 \u0430\u043d\u0433\u043b. Transmission Control Protocol &#8212; \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043f\u0435\u0440\u0435\u0434\u0430 \u0447\u0438 \u0433\u0438\u043f\u0435\u0440\u0442\u0435\u043a\u0441\u0442\u0430) <\/em>\u2013 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u043d\u044b\u0439 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u0435\u0442\u044f\u0445 TCP\/IP, \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0449\u0438\u0439 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u0441\u0435\u0442\u044c\u044e.   <\/p>\n<p><strong>HTTP<\/strong>\u00a0<em>(\u043e\u0442 \u0430\u043d\u0433\u043b. HyperText Transfer Protocol &#8212; \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043f\u0435\u0440\u0435\u0434\u0430 \u0447\u0438 \u0433\u0438\u043f\u0435\u0440\u0442\u0435\u043a\u0441\u0442\u0430)<\/em>\u00a0\u2014 \u044d\u0442\u043e \u043f\u0440\u0438\u043a\u043b\u0430\u0434\u043d\u043e\u0439 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u0435\u0442\u0438. \u041d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0441 \u0432\u0435\u0431-\u0441\u0430\u0439\u0442\u043e\u0432. <\/p>\n<p>\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b HTTP \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 &#171;\u043f\u043e\u0432\u0435\u0440\u0445&#187; TCP \u0438 \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 \u00ab\u043a\u043b\u0438\u0435\u043d\u0442-\u0441\u0435\u0440\u0432\u0435\u0440\u00bb: \u043a\u043b\u0438\u0435\u043d\u0442, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u0442\u043e\u0440\u043e\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f; \u0441\u0435\u0440\u0432\u0435\u0440, \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0435\u0433\u043e \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u0412 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, TCP \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u0438\u0433\u0440\u0430\u0435\u0442 \u0440\u043e\u043b\u044c \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u043d\u043e\u0433\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 HTTP.<\/p>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u0432\u0441\u0435\u0445 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432 (\u043f\u043e \u043c\u043e\u0434\u0435\u043b\u0438 OSI) \u0432 \u0432\u0438\u0434\u0435 \u0416\u0414 \u0441\u0438\u0441\u0442\u0435\u043c\u044b:<\/p>\n<ol>\n<li>\n<p><strong>\u041f\u0430\u0441\u0441\u0430\u0436\u0438\u0440<\/strong>\u00a0(\u0443\u0440\u043e\u0432\u0435\u043d\u044c 7) \u0433\u043e\u0432\u043e\u0440\u0438\u0442: \u00ab\u0425\u043e\u0447\u0443 \u0437\u0430\u0439\u0442\u0438 \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0441\u0430\u0439\u0442\u0430\u00bb (<em>HTTP-\u0437\u0430\u043f\u0440\u043e\u0441<\/em>).<\/p>\n<\/li>\n<li>\n<p><strong>\u0423\u0440\u043e\u0432\u0435\u043d\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f<\/strong>\u00a0(6) \u0441\u0436\u0438\u043c\u0430\u0435\u0442 \u0442\u0435\u043a\u0441\u0442 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0438 \u0448\u0438\u0444\u0440\u0443\u0435\u0442 \u0435\u0433\u043e.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0435\u0430\u043d\u0441\u043e\u0432\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c<\/strong>\u00a0(5) \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u00ab\u0441\u0435\u0430\u043d\u0441\u00bb \u0441\u0432\u044f\u0437\u0438 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c.<\/p>\n<\/li>\n<li>\n<p><strong>\u0422\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u043d\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c<\/strong>\u00a0(4) \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u0442 \u0442\u0435\u043a\u0441\u0442 \u043d\u0430 \u043f\u0430\u043a\u0435\u0442\u044b \u0438 \u043d\u0443\u043c\u0435\u0440\u0443\u0435\u0442 \u0438\u0445 (<em>TCP<\/em>).<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0435\u0442\u0435\u0432\u043e\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c<\/strong>\u00a0(3) \u043f\u0440\u043e\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u0447\u0435\u0440\u0435\u0437 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442-\u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0442\u043e\u0440\u044b (\u00ab\u0413\u043e\u0440\u043e\u0434 \u0421 (\u0441\u0435\u0440\u0432\u0435\u0440, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0445\u043e\u0441\u0442\u0438\u0442\u0441\u044f \u0441\u0430\u0439\u0442) \u2192 \u0413\u043e\u0440\u043e\u0434 \u041f \u2192 &#8230; \u2192 \u0413\u043e\u0440\u043e\u0434 \u0426 (\u043d\u0430\u0448 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u044c \u0441\u0430\u0439\u0442\u0430) \u00bb).<\/p>\n<\/li>\n<li>\n<p><strong>\u041a\u0430\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c<\/strong>\u00a0(2) \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u043f\u0430\u043a\u0435\u0442\u044b \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u043c\u0438 \u0440\u043e\u0443\u0442\u0435\u0440\u0430\u043c\u0438 (Ethernet, Wi-Fi).<\/p>\n<\/li>\n<li>\n<p><strong>\u0424\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c<\/strong>\u00a0(1) \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0431\u0438\u0442\u044b \u043f\u043e \u043a\u0430\u0431\u0435\u043b\u044e \u0438\u043b\u0438 \u0432\u043e\u0437\u0434\u0443\u0445\u0443 (\u0441\u0432\u0435\u0442 \u0432 \u043e\u043f\u0442\u043e\u0432\u043e\u043b\u043e\u043a\u043d\u0435, \u0440\u0430\u0434\u0438\u043e\u0441\u0438\u0433\u043d\u0430\u043b\u044b).<\/p>\n<\/li>\n<\/ol>\n<h3>\u0421\u0442\u0430\u0440\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/h3>\n<p>\u041d\u0430\u0447\u043d\u0451\u043c \u0441\u00a0\u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>main()<\/code> \u0432\u00a0\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432\u044b\u0437\u043e\u0432 <code>http.ListenAndServe<\/code>\u00a0&#8212; \u0442\u043e\u0439 \u0441\u0430\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n<pre><code class=\"go\">\/\/ main.go  package main  import (   \"net\/http\" )  func main() {   mux := http.NewServeMux()      mux.HandleFunc(\"\/hello\", func(w http.ResponseWriter, r *http.Request) {     w.Write([]byte(\"Hello world!\"))   })      _ := http.ListenAndServe(\"localhost:5000\", mux) }<\/code><\/pre>\n<p>\u0412\u0441\u0451, \u0447\u0442\u043e\u00a0\u0434\u0435\u043b\u0430\u0435\u0442 \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u044d\u0442\u043e \u043f\u0440\u0438\u00a0\u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043f\u043e\u00a0\u0430\u0434\u0440\u0435\u0441\u0443 <a href=\"http:\/\/localhost:5000\/hello\" rel=\"noopener noreferrer nofollow\"><em>http:\/\/localhost:5000\/hello<\/em><\/a> \u0432\u044b\u0434\u0430\u0451\u0442 \u043d\u0430\u043c \u043d\u0430\u0434\u043f\u0438\u0441\u044c \u00abHello world!\u00bb<\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>ListenAndServe<\/code> \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u043c \u043c\u043e\u0434\u0443\u043b\u0435 net\/http:<\/p>\n<pre><code class=\"go\">\/\/ net\/http\/server.go  func ListenAndServe(addr string, handler Handler) error { \u00a0 \u00a0 server := &amp;Server{Addr: addr, Handler: handler}    \u00a0 \u00a0 return server.ListenAndServe() }<\/code><\/pre>\n<p><code>addr:<\/code> \u0421\u0442\u0440\u043e\u043a\u0430, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u0430\u0434\u0440\u0435\u0441 \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u043d\u0438\u044f. \u0410\u0434\u0440\u0435\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 &#8216;\u0425\u043e\u0441\u0442:\u041f\u043e\u0440\u0442&#8217; (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, &#171;<a href=\"http:\/\/localhost:5000\" rel=\"noopener noreferrer nofollow\">localhost:5000<\/a>&#171;).<\/p>\n<p><code>handler:<\/code> \u041e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 http.Handler &#8212; \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430.<\/p>\n<p><em>\u0412 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u0443\u043a\u0430\u0437\u0430\u043d\u043e:<\/em><\/p>\n<blockquote>\n<p>\u00ab\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u0435\u0442 \u0441\u0435\u0442\u0435\u0432\u043e\u0439 TCP \u0430\u0434\u0440\u0435\u0441 \u0438 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 Serve \u0441\u00a0Handler \u0434\u043b\u044f\u00a0\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0430\u00a0\u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f\u0445. \u041f\u0440\u0438\u043d\u044f\u0442\u044b\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e TCP keep\u2011alive. Handler \u043e\u0431\u044b\u0447\u043d\u043e \u0440\u0430\u0432\u0435\u043d \u043d\u0443\u043b\u044e, \u0438 \u0432\u00a0\u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f DefaultServeMux. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u0435\u00a0\u043d\u0443\u043b\u0435\u0432\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443\u00bb.<\/p>\n<\/blockquote>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0441\u043e\u0437\u043d\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u043e\u0435 \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0432\u044b\u0434\u0435\u043b\u0438\u043c \u0438 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f \u0441 \u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c\u0438 \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u043c\u0438:<\/p>\n<ul>\n<li>\n<p><em>Serve (\u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0442\u044c)<\/em> &#8212; \u043f\u043e\u043a\u0430 \u043c\u044b \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0443\u043d\u043a\u0442, \u0442.\u043a. \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043d\u0430 \u0432\u00a0\u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c.<\/p>\n<\/li>\n<li>\n<p><em>Handler (\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a)<\/em> &#8212; \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0432 \u0441\u0435\u0431\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044e ServeHTTP. \u041a\u0430\u043a \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u0434\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441 (\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0437\u0434\u0435\u0441\u044c: <a href=\"https:\/\/pkg.go.dev\/net\/http#Handler\" rel=\"noopener noreferrer nofollow\">Handler<\/a>).<\/p>\n<\/li>\n<li>\n<p><em>DefaultServeMux <\/em>&#8212; \u044d\u0442\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u00a0<a href=\"https:\/\/pkg.go.dev\/net\/http#ServeMux\" rel=\"noopener noreferrer nofollow\">ServeMux<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0435\u0441\u043b\u0438 \u044f\u0432\u043d\u043e \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d \u0434\u0440\u0443\u0433\u043e\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0442\u043e\u0440 (\u043f\u0440\u0438\u043c. &#8212; \u041c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0442\u043e\u0440, \u044d\u0442\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0445 \u043f\u043e \u043d\u0443\u0436\u043d\u044b\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c). \u041e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044e \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 (handlers) \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0443\u0442\u0438 URL. \u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u0435\u0441\u0442\u044c \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0434\u043b\u044f \u043f\u0443\u0442\u0438\u00a0<em>\/hello<\/em>, \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a\u00a0<em>http:\/\/localhost:5000\/hello<\/em>\u00a0\u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430 \u044d\u0442\u043e\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a.<\/p>\n<\/li>\n<li>\n<p><em>TCP keep-alive<\/em> &#8212; \u044d\u0442\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0432 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0435 TCP, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c \u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f. \u041e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f &#171;\u043c\u0435\u0440\u0442\u0432\u044b\u0445&#187; \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0433\u0434\u0430 \u043e\u0434\u043d\u0430 \u0438\u0437 \u0441\u0442\u043e\u0440\u043e\u043d \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u043b\u0430\u0441\u044c \u0438\u043b\u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u0435\u043b \u0441\u0431\u043e\u0439 \u0441\u0435\u0442\u0438) \u0438 \u0438\u0445 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f. \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f  \u0432 \u0442\u043e\u043c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 TCP &#8212; \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c, \u043e\u0434\u043d\u0430\u043a\u043e, \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0432\u043e\u0434\u0443 \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0430\u0442\u0435\u0439 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/proglib.io\/p\/samouchitel-po-go-dlya-nachinayushchih-chast-17-osnovy-setevogo-programmirovaniya-stek-tcp-ip-sokety-paket-net-2024-11-15\" rel=\"noopener noreferrer nofollow\">\u0434\u0430\u043d\u043d\u0430\u044f<\/a>).<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u0443\u0442 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e\u00a0\u0432\u00a0\u0442\u0435\u043b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0442\u0438\u043f\u0430 <a href=\"https:\/\/pkg.go.dev\/net\/http#Server\" rel=\"noopener noreferrer nofollow\">Server<\/a>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u0434\u043b\u044f\u00a0\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f HTTP\u2011\u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c. \u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u0438\u0440\u0443\u0435\u0442 \u0432\u0441\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f\u00a0\u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a\u00a0\u0430\u0434\u0440\u0435\u0441, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438, \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u044b, TLS\u2011\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438. \u041a\u0430\u0436\u0434\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044f \u0433\u0438\u0431\u043a\u043e \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0435\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c.<\/p>\n<h4>\u0421\u0435\u0440\u0432\u0435\u0440<\/h4>\n<p>\u042f \u0434\u0443\u043c\u0430\u044e, \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043b\u0438\u0448\u043d\u0438\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u0441\u0435\u0440\u0432\u0435\u0440\u0430:<\/p>\n<pre><code class=\"go\">\/\/ A Server defines parameters for running an HTTP server. \/\/ The zero value for Server is a valid configuration. type Server struct { \/\/ Addr optionally specifies the TCP address for the server to listen on, \/\/ in the form \"host:port\". If empty, \":http\" (port 80) is used. \/\/ The service names are defined in RFC 6335 and assigned by IANA. \/\/ See net.Dial for details of the address format. Addr string  Handler Handler \/\/ handler to invoke, http.DefaultServeMux if nil  \/\/ DisableGeneralOptionsHandler, if true, passes \"OPTIONS *\" requests to the Handler, \/\/ otherwise responds with 200 OK and Content-Length: 0. DisableGeneralOptionsHandler bool  \/\/ TLSConfig optionally provides a TLS configuration for use \/\/ by ServeTLS and ListenAndServeTLS. Note that this value is \/\/ cloned by ServeTLS and ListenAndServeTLS, so it's not \/\/ possible to modify the configuration with methods like \/\/ tls.Config.SetSessionTicketKeys. To use \/\/ SetSessionTicketKeys, use Server.Serve with a TLS Listener \/\/ instead. TLSConfig *tls.Config  \/\/ ReadTimeout is the maximum duration for reading the entire \/\/ request, including the body. A zero or negative value means \/\/ there will be no timeout. \/\/ \/\/ Because ReadTimeout does not let Handlers make per-request \/\/ decisions on each request body's acceptable deadline or \/\/ upload rate, most users will prefer to use \/\/ ReadHeaderTimeout. It is valid to use them both. ReadTimeout time.Duration  \/\/ ReadHeaderTimeout is the amount of time allowed to read \/\/ request headers. The connection's read deadline is reset \/\/ after reading the headers and the Handler can decide what \/\/ is considered too slow for the body. If zero, the value of \/\/ ReadTimeout is used. If negative, or if zero and ReadTimeout \/\/ is zero or negative, there is no timeout. ReadHeaderTimeout time.Duration  \/\/ WriteTimeout is the maximum duration before timing out \/\/ writes of the response. It is reset whenever a new \/\/ request's header is read. Like ReadTimeout, it does not \/\/ let Handlers make decisions on a per-request basis. \/\/ A zero or negative value means there will be no timeout. WriteTimeout time.Duration  \/\/ IdleTimeout is the maximum amount of time to wait for the \/\/ next request when keep-alives are enabled. If zero, the value \/\/ of ReadTimeout is used. If negative, or if zero and ReadTimeout \/\/ is zero or negative, there is no timeout. IdleTimeout time.Duration  \/\/ MaxHeaderBytes controls the maximum number of bytes the \/\/ server will read parsing the request header's keys and \/\/ values, including the request line. It does not limit the \/\/ size of the request body. \/\/ If zero, DefaultMaxHeaderBytes is used. MaxHeaderBytes int  \/\/ TLSNextProto optionally specifies a function to take over \/\/ ownership of the provided TLS connection when an ALPN \/\/ protocol upgrade has occurred. The map key is the protocol \/\/ name negotiated. The Handler argument should be used to \/\/ handle HTTP requests and will initialize the Request's TLS \/\/ and RemoteAddr if not already set. The connection is \/\/ automatically closed when the function returns. \/\/ If TLSNextProto is not nil, HTTP\/2 support is not enabled \/\/ automatically. TLSNextProto map[string]func(*Server, *tls.Conn, Handler)  \/\/ ConnState specifies an optional callback function that is \/\/ called when a client connection changes state. See the \/\/ ConnState type and associated constants for details. ConnState func(net.Conn, ConnState)  \/\/ ErrorLog specifies an optional logger for errors accepting \/\/ connections, unexpected behavior from handlers, and \/\/ underlying FileSystem errors. \/\/ If nil, logging is done via the log package's standard logger. ErrorLog *log.Logger  \/\/ BaseContext optionally specifies a function that returns \/\/ the base context for incoming requests on this server. \/\/ The provided Listener is the specific Listener that's \/\/ about to start accepting requests. \/\/ If BaseContext is nil, the default is context.Background(). \/\/ If non-nil, it must return a non-nil context. BaseContext func(net.Listener) context.Context  \/\/ ConnContext optionally specifies a function that modifies \/\/ the context used for a new connection c. The provided ctx \/\/ is derived from the base context and has a ServerContextKey \/\/ value. ConnContext func(ctx context.Context, c net.Conn) context.Context  inShutdown atomic.Bool \/\/ true when server is in shutdown  disableKeepAlives atomic.Bool nextProtoOnce     sync.Once \/\/ guards setupHTTP2_* init nextProtoErr      error     \/\/ result of http2.ConfigureServer if used  mu         sync.Mutex listeners  map[*net.Listener]struct{} activeConn map[*conn]struct{} onShutdown []func()  listenerGroup sync.WaitGroup }<\/code><\/pre>\n<p>\u0427\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0435\u0440\u043f\u043d\u0443\u0442\u044c? &#8212; \u041f\u0438\u0448\u0438\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.<\/p>\n<h4>Server &#8212; \u043c\u0435\u0442\u043e\u0434 ListenAndServe<\/h4>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f server \u0438\u0434\u0451\u0442 \u0432\u044b\u0437\u043e\u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 <code>ListenAndServe<\/code>:<\/p>\n<pre><code class=\"go\">\/\/ net\/http\/server.go  func (srv *Server) ListenAndServe() error {   if srv.shuttingDown() {     return ErrServerClosed   }    addr := srv.Addr    if addr == \"\" {     addr = \":http\"   }    ln, err := net.Listen(\"tcp\", addr)    if err != nil {     return err   }    return srv.Serve(ln) }<\/code><\/pre>\n<p>\u041a\u0440\u0430\u0442\u043a\u043e \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 \u043c\u0435\u0442\u043e\u0434\u0430:<\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430: \u0435\u0441\u043b\u0438 \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f (shuttingDown), \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0443\u00a0ErrServerClosed. \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: shuttingDown \u044d\u0442\u043e \u0444\u043b\u0430\u0433 \u0442\u0438\u043f\u0430 atomic.Bool, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, atomic \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0438\u0437 \u0440\u0430\u0437\u043d\u044b\u0445 \u0433\u043e\u0440\u0443\u0442\u0438\u043d \u043a \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0444\u043b\u0430\u0433\u0443 (<a href=\"https:\/\/habr.com\/ru\/articles\/744822\/\" rel=\"noopener noreferrer nofollow\">\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e atomic<\/a>)<\/p>\n<\/li>\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0430\u0434\u0440\u0435\u0441\u0430: \u0435\u0441\u043b\u0438 \u0430\u0434\u0440\u0435\u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 (srv.Addr) \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0430\u0434\u0440\u0435\u0441 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e\u00a0:http\u00a0(\u043f\u043e\u0440\u0442 80).<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 TCP-\u043b\u0438\u0441\u0442\u0435\u043d\u0435\u0440\u0430 \u043d\u0430 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u0430\u0434\u0440\u0435\u0441\u0435. \u041f\u0440\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u0440\u0442 \u0437\u0430\u043d\u044f\u0442), \u043e\u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043b\u0438\u0441\u0442\u0435\u043d\u0435\u0440\u0430, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434\u00a0<code>srv.Serve(ln)<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b &#8212; \u043e\u0431 \u044d\u0442\u043e\u043c \u0438 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440 \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<h4>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/h4>\n<p>\u0418 \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043f\u043e\u0441\u043b\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0430\u0441\u043f\u0435\u043a\u0442\u043e\u0432 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 HTTP-\u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0432 Go, \u043c\u044b \u043f\u043e\u0434\u043e\u0448\u043b\u0438 \u043a \u0441\u0430\u043c\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u043c\u0443 \u2014 \u043a \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u043c\u0443 \u043e\u0431\u0437\u043e\u0440\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>Serve<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0434\u043b\u044f \u043d\u0430\u0441 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<blockquote>\n<p>\u00abServe \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043d\u0430\u00a0Listener l, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u0434\u043b\u044f\u00a0\u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437\u00a0\u043d\u0438\u0445 \u043d\u043e\u0432\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441, \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0439 \u0432\u00a0\u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u0435. \u0421\u0435\u0440\u0432\u0438\u0441\u044b \u0432\u00a0\u0433\u043e\u0440\u0443\u0442\u0438\u043d\u0430\u0445 \u0447\u0438\u0442\u0430\u044e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 srv.Handler \u0434\u043b\u044f\u00a0\u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430\u00a0\u043d\u0438\u0445.<\/p>\n<p>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 HTTP\/2\u00a0\u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u00a0\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 Listener \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430 *tls.Conn \u0438 \u0435\u0441\u043b\u0438 \u043e\u043d\u0438\u00a0\u0431\u044b\u043b\u0438 \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0441\u00a0\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u00abh2\u00bb \u0432\u00a0TLS Config.NextProtos.<\/p>\n<p>Serve \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u0435\u043d\u0443\u043b\u0435\u0432\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443 \u0438 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442 l. \u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 [Server.Shutdown] \u0438\u043b\u0438 [Server.Close] \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u044d\u0442\u043e ErrServerClosed\u00bb.<\/p>\n<\/blockquote>\n<p>\u0413\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0434\u0430\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"go\">\/\/ net\/http\/server.go  func (srv *Server) Serve(l net.Listener) error { if fn := testHookServerServe; fn != nil { fn(srv, l) \/\/ call hook with unwrapped listener }  origListener := l l = &amp;onceCloseListener{Listener: l} defer l.Close()  if err := srv.setupHTTP2_Serve(); err != nil { return err }  if !srv.trackListener(&amp;l, true) { return ErrServerClosed } defer srv.trackListener(&amp;l, false)  baseCtx := context.Background() if srv.BaseContext != nil { baseCtx = srv.BaseContext(origListener) if baseCtx == nil { panic(\"BaseContext returned a nil context\") } }  var tempDelay time.Duration \/\/ how long to sleep on accept failure  ctx := context.WithValue(baseCtx, ServerContextKey, srv) for { rw, err := l.Accept() if err != nil { if srv.shuttingDown() { return ErrServerClosed } if ne, ok := err.(net.Error); ok &amp;&amp; ne.Temporary() { if tempDelay == 0 { tempDelay = 5 * time.Millisecond } else { tempDelay *= 2 } if max := 1 * time.Second; tempDelay &gt; max { tempDelay = max } srv.logf(\"http: Accept error: %v; retrying in %v\", err, tempDelay) time.Sleep(tempDelay) continue } return err } connCtx := ctx if cc := srv.ConnContext; cc != nil { connCtx = cc(connCtx, rw) if connCtx == nil { panic(\"ConnContext returned nil\") } } tempDelay = 0 c := srv.newConn(rw) c.setState(c.rwc, StateNew, runHooks) \/\/ before Serve can return go c.serve(connCtx) } }<\/code><\/pre>\n<p>\u0420\u0430\u0437\u043e\u0431\u044c\u0451\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043d\u0430 \u044d\u0442\u0430\u043f\u044b \u0438 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u0438\u0445 \u043f\u043e\u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e:<\/p>\n<p><strong><em>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043b\u0438\u0441\u0442\u0435\u043d\u0435\u0440\u0430:<\/em><\/strong><\/p>\n<ul>\n<li>\n<p>\u041b\u0438\u0441\u0442\u0435\u043d\u0435\u0440 \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u00a0onceCloseListener, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0435 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435. \u041f\u0440\u0438\u00a0\u044d\u0442\u043e\u043c, \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e listener \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0432\u00a0\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e origListener.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f HTTP\/2 (\u0435\u0441\u043b\u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043e).<\/p>\n<\/li>\n<li>\n<p>\u041b\u0438\u0441\u0442\u0435\u043d\u0435\u0440 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 (\u0434\u043b\u044f \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430). \u0422\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0438\u0437 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u043b\u0438\u0441\u0442\u0435\u043d\u0435\u0440\u043e\u0432. \u0412 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u0447\u0442\u043e <code>srv.trackListener<\/code> \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0434\u043b\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 (\u043d\u0435 Shutdown \u0438\u043b\u0438 Closed). <\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c: \u00ab\u041f\u043e\u0447\u0435\u043c\u0443 \u0440\u0435\u0447\u044c \u0438\u0434\u0451\u0442 \u043e\u00a0\u043b\u0438\u0441\u0442\u0435\u043d\u0435\u0440\u0430\u0445, \u043e\u043d\u00a0\u0436\u0435 \u043e\u0434\u0438\u043d?\u00bb. \u0410\u00a0\u044f \u0432\u0430\u043c \u043e\u0442\u0432\u0435\u0447\u0443, \u0447\u0442\u043e\u00a0\u043c\u0435\u0442\u043e\u0434 Serve \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u00a0\u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437\u00a0\u043c\u0435\u0442\u043e\u0434\u0430 ListenAndServe, \u043d\u043e\u00a0\u0435\u0449\u0451 \u0438 \u0438\u0437\u00a0\u043c\u0435\u0442\u043e\u0434\u0430 ServeTLS (<em>\u0432\u0430\u0436\u043d\u043e: \u044d\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u043c\u0435\u0442\u043e\u0434\u044b \u043e\u0434\u043d\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u0442\u0438\u043f\u0430 Server, \u0430\u00a0\u043d\u0435\u00a0\u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/em>)\u00a0\u2014 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e\u00a0\u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043c\u043e\u0436\u0435\u0442\u00a0\u0431\u044b\u0442\u044c \u0437\u0430\u043f\u0443\u0449\u0435\u043d \u0434\u043b\u044f\u00a0\u0440\u0430\u0437\u043b\u0438\u0447\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b, \u0432\u00a0\u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u00a0http \u0438 https. \u041d\u043e\u00a0\u044d\u0442\u043e \u043f\u043b\u043e\u0445\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438 \u043a\u0440\u0430\u0439\u043d\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439. \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u0440\u0438\u0447\u0438\u043d\u044b \u0434\u043b\u044f\u00a0\u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445\u00a0\u043b\u0438\u0441\u0442\u0435\u043d\u0435\u0440\u043e\u0432, \u044d\u0442\u043e: \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 listener&#8217;\u043e\u0432 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, hot\u2011reload), \u0441\u0435\u0440\u0432\u0435\u0440 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430\u00a0\u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430\u0445 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, IPv4\u00a0\u0438 IPv6); \u043d\u043e\u00a0\u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0443\u043d\u043a\u0442\u044b \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u0440\u0443\u0447\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 (\u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u044f \u043d\u0435\u00a0\u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043b \u0442\u0430\u043a\u043e\u0433\u043e \u0432\u00a0\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438). <\/p>\n<p><em>\u0417\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u0435\u043d\u00a0onceCloseListener? &#8212; <\/em>\u041e\u043d \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e \u043c\u0435\u0442\u043e\u0434\u00a0Close()\u00a0\u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0435\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0443\u0442 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043c\u0435\u0441\u0442. \u042d\u0442\u043e \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0430\u043d\u0438\u043a\u0443 \u0438\u0437-\u0437\u0430 \u0434\u0432\u043e\u0439\u043d\u043e\u0433\u043e \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f \u043b\u0438\u0441\u0442\u0435\u043d\u0435\u0440\u0430.<\/p>\n<p><strong><em>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430:<\/em><\/strong><\/p>\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438\u00a0BaseContext\u00a0\u0437\u0430\u0434\u0430\u043d, \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430. \u0418\u043d\u0430\u0447\u0435 \u2014\u00a0context.Background().<\/p>\n<\/li>\n<li>\n<p>\u0412 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 (ServerContextKey).<\/p>\n<\/li>\n<\/ul>\n<p>\u041c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043a\u043b\u044e\u0447 \u043a\u043e\u043d\u0442\u0435\u043a\u0442\u0441\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439, \u0437\u043d\u0430\u0447\u0438\u0442 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c. \u0418 \u043f\u0440\u0430\u0432\u0434\u0430, \u0435\u0441\u043b\u0438 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043d\u0430\u0448 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043f\u0443\u0442\u0438 &#171;\/hello&#187; \u043a\u043e\u0434 \u043d\u0438\u0436\u0435: <\/p>\n<pre><code class=\"go\">srv := r.Context().Value(http.ServerContextKey).(*http.Server)  log.Printf(\"%#+v\", srv)<\/code><\/pre>\n<p>\u041c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u044b\u0432\u043e\u0434 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0441 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u0432\u0441\u0435\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0435:  <\/p>\n<p><em>2025\/03\/03 12:18:30 &amp;http.Server{Addr:&#187;<\/em><a href=\"http:\/\/localhost:5000\" rel=\"noopener noreferrer nofollow\"><em>localhost:5000<\/em><\/a><em>&#171;, &#8230;<\/em><\/p>\n<p>\u041f\u0438\u0448\u0438\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445, \u043a\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u0443\u044e \u043d\u0430\u0445\u043e\u0434\u043a\u0443.<\/p>\n<p><strong><em>\u0426\u0438\u043a\u043b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439:<\/em><\/strong><\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u0438\u043d\u044f\u0442\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f:\u00a0l.Accept().<\/p>\n<\/li>\n<\/ul>\n<p><strong><em>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a:<\/em><\/strong><\/p>\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0441\u0435\u0440\u0432\u0435\u0440 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u2014 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f\u00a0ErrServerClosed.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u0448\u0438\u0431\u043a\u0430\u0445 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0435\u0445\u0432\u0430\u0442\u043a\u0430 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u043e\u0432) \u2014 \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430 \u043f\u0435\u0440\u0435\u0434 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0439 \u043f\u043e\u043f\u044b\u0442\u043a\u043e\u0439 (\u043d\u043e \u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 1 \u0441\u0435\u043a\u0443\u043d\u0434\u044b). \u0415\u0441\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0435\u0442, \u0434\u0430\u043b\u0435\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u0431\u0440\u043e\u0441 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0438 <code>tempDelay = 0<\/code>.<\/p>\n<\/li>\n<\/ul>\n<p><strong><em>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f:<\/em><\/strong><\/p>\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0437\u0430\u0434\u0430\u043d\u00a0ConnContext, \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442\u0441\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445).<\/p>\n<\/li>\n<\/ul>\n<p><strong><em>\u0417\u0430\u043f\u0443\u0441\u043a \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438:<\/em><\/strong><\/p>\n<ul>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u0435\u0440\u0442\u043a\u0430 \u0442\u0438\u043f\u0430\u00a0conn\u00a0\u043d\u0430\u0434 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435\u043c\u00a0net.Conn, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c HTTP-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f. <\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"go\">\/\/ net\/http\/server.go  func (srv Server) newConn(rwc net.Conn) conn {   c := &amp;conn{     server: srv,     rwc:    rwc,   }    if debugServerConnections {     c.rwc = newLoggingConn(\"server\", c.rwc)   }    return c }<\/code><\/pre>\n<p>\u041f\u043e \u0441\u0443\u0442\u0438, \u0434\u0430\u043d\u043d\u0430\u044f \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435\u043c \u0438 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e, \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443\u00a0net.Conn. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043b\u043e\u0433\u0438\u043a\u0430 HTTP-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0432<em>\u00a0<\/em>conn, \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u043a\u043e\u0434 \u00ab\u0431\u043e\u043b\u0435\u0435 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u043c\u00bb \u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u043c.<\/p>\n<ul>\n<li>\n<p>\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u00a0<a href=\"https:\/\/pkg.go.dev\/net\/http#StateNew\" rel=\"noopener noreferrer nofollow\">StateNew<\/a>.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f <code>c.serve()<\/code>. \u0414\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043c\u044b \u043e\u0431\u043e\u0437\u0440\u0435\u0432\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u043c, \u0442.\u043a. \u0434\u043b\u044f \u0435\u0433\u043e \u0440\u0430\u0437\u0431\u043e\u0440\u0430 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0435\u0449\u0451 \u043e\u0434\u043d\u0430 \u0441\u0442\u0430\u0442\u044c\u044f, \u043e\u0434\u043d\u0430\u043a\u043e \u0435\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0445\u043e\u0440\u043e\u0448\u043e &#171;\u0437\u0430\u0439\u0434\u0451\u0442&#187;, \u0442\u043e \u044f \u0431\u0443\u0434\u0443 \u0440\u0430\u0434 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e. <\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b:<\/strong><\/p>\n<p>\u0427\u0442\u043e \u0436\u0435 \u0437\u0430 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c? \u041c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u0438\u0445 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435:<\/p>\n<ul>\n<li>\n<p>\u043a\u0430\u0436\u0434\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u0432\u043e\u0435\u0439 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u0435, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f .<\/p>\n<\/li>\n<li>\n<p>\u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430 \u043f\u0440\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441\u0431\u043e\u044f\u0445 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440,\u00a0accept: too many open files).<\/p>\n<\/li>\n<li>\n<p>\u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 (\u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u044b) \u0447\u0435\u0440\u0435\u0437 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 HTTP\/2, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 TLS-\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438.<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0442\u043e\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445:<\/strong><\/p>\n<p><code>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043b\u0438\u0441\u0442\u0435\u043d\u0435\u0440\u0430 (\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432) \u2192 \u041e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 (net.Listen(\"tcp\", addr)) \u2192 \u0417\u0430\u043f\u0440\u043e\u0441 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f (\u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043a\u043b\u0438\u0435\u043d\u0442\u0430) \u2192 \u041f\u0440\u0438\u043d\u044f\u0442\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f (l.Accept()) \u2192 \u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u2192 \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u0430 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u0435 (go c.serve()) \u2192 \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u2192 \u041e\u0442\u0432\u0435\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u0443<\/code><\/p>\n<p>\u0418\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u044b\u0432\u043e\u0434:<\/p>\n<blockquote>\n<p>\u00ab\u0424\u0443\u043d\u043a\u0446\u0438\u044f Serve\u00a0\u2014 \u044d\u0442\u043e \u044f\u0434\u0440\u043e HTTP\u2011\u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0432\u00a0Go. \u041e\u043d\u0430 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u0443\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439, \u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0441\u0442\u044c \u043a\u00a0\u043e\u0448\u0438\u0431\u043a\u0430\u043c \u0438 \u0433\u0438\u0431\u043a\u0443\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u0447\u0435\u0440\u0435\u0437 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 Server.\u00bb<\/p>\n<\/blockquote>\n<p>\u0412 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a \u0440\u0430\u0437\u0431\u043e\u0440\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 Serve \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0442 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e \u0440\u0430\u0431\u043e\u0442\u0435 HTTP \u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/p>\n<ol>\n<li>\n<p>\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439? <\/p>\n<p>\u0421\u0435\u0440\u0432\u0435\u0440 \u0445\u0440\u0430\u043d\u0438\u0442 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0432 \u043c\u0430\u043f\u0435\u00a0activeConn map[*conn]struct{}. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u0430\u043f\u044b \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0437\u0430 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f O(1), \u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u0443\u0441\u0442\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u00a0struct{}, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043f\u0430\u043c\u044f\u0442\u0438, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u043c (\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u0442\u043e\u043c, \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043f\u0443\u0441\u0442\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0430\u043c\u044f\u0442\u044c \u0438\u043b\u0438 \u043d\u0435\u0442 \u0437\u0434\u0435\u0441\u044c).<\/p>\n<p>setState\u00a0\u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440,\u00a0StateNew\u00a0\u2192\u00a0StateActive\u00a0\u2192\u00a0StateClosed).<\/p>\n<p>\u041f\u0440\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043c\u043e\u0436\u043d\u043e \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0437\u0430\u043a\u0440\u044b\u0442\u044c \u0432\u0441\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0413\u0434\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432?<\/p>\n<p>\u0412 \u043c\u0435\u0442\u043e\u0434\u0435\u00a0c.serve(), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0447\u0438\u0442\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0438\u0437 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u00a0http.Request, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a (srv.Handler), \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043e\u0442\u0432\u0435\u0442 \u0432 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0438, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 (\u0435\u0441\u043b\u0438 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f keep-alive).<\/p>\n<\/li>\n<li>\n<p>\u041c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435\u00a0srv.Shutdown(ctx)\u00a0\u0438\u043b\u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0438 \u043b\u0438\u0441\u0442\u0435\u043d\u0435\u0440\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u043e\u043c\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a\u00a0isShutdown\u00a0(\u0430\u0442\u043e\u043c\u0430\u0440\u043d\u044b\u0439 \u0444\u043b\u0430\u0433).<\/p>\n<\/li>\n<li>\n<p>\u0421\u0435\u0440\u0432\u0435\u0440 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u0438\u0435\u043c \u043d\u043e\u0432\u044b\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 (\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u0432\u00a0l.Accept()). \u0418\u0442\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043f\u043e\u00a0activeConn\u00a0\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u00a0close()\u00a0\u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u043f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u0440\u044b\u0432\u0430\u044f \u0435\u0433\u043e.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0441\u0442\u0443\u043f \u043a\u00a0activeConn\u00a0\u0437\u0430\u0449\u0438\u0449\u0435\u043d \u043c\u044c\u044e\u0442\u0435\u043a\u0441\u043e\u043c (<a href=\"http:\/\/srv.mu\" rel=\"noopener noreferrer nofollow\">srv.mu<\/a>), \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0433\u043e\u043d\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438\/\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439. \u0421\u0435\u0440\u0432\u0435\u0440 \u0434\u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0433\u043e\u0440\u0443\u0442\u0438\u043d \u0447\u0435\u0440\u0435\u0437\u00a0listenerGroup.Wait()\u00a0(\u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0447\u0435\u0440\u0435\u0437\u00a0sync.WaitGroup).<\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u044f\u0432\u043d\u043e, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0437\u0430\u0432\u0438\u0441 (\u0447\u0435\u0440\u0435\u0437\u00a0SetDeadline\u00a0\u0432\u00a0net.Conn).<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u0441\u0435\u0440\u0432\u0435\u0440 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0445\u0443\u043a\u0438\u00a0onShutdown, \u0447\u0442\u043e\u0431\u044b \u0434\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c cleanup-\u043b\u043e\u0433\u0438\u043a\u0443. \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435:<\/p>\n<ul>\n<li>\n<p>\u0425\u0443\u043a (\u043e\u0442 \u0430\u043d\u0433\u043b.\u00a0hook\u00a0\u2014 &#171;\u043a\u0440\u044e\u0447\u043e\u043a&#187;) \u2014 \u044d\u0442\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0432\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043a\u043e\u0434 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u0425\u0443\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p>Cleanup-\u043b\u043e\u0433\u0438\u043a\u0430 (\u043e\u0442 \u0430\u043d\u0433\u043b.\u00a0cleanup\u00a0\u2014 &#171;\u043e\u0447\u0438\u0441\u0442\u043a\u0430&#187;) \u2014 \u044d\u0442\u043e \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0438\u043b\u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0432 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u044b. \u042d\u0442\u043e \u0432\u0430\u0436\u043d\u043e \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0443\u0442\u0435\u0447\u0435\u043a \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 (\u043f\u0430\u043c\u044f\u0442\u0438, \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u043e\u0432, \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u0441 \u0411\u0414 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435).<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<hr\/>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412\u00a0\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0441 \u0432\u0430\u043c\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b \u0440\u0430\u0431\u043e\u0442\u044b HTTP\u2011\u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0432\u00a0\u043f\u0430\u043a\u0435\u0442\u0435 net\/http \u044f\u0437\u044b\u043a\u0430 Go. \u041f\u043e \u0444\u0430\u043a\u0442\u0443 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438 \u0448\u0430\u0433 \u0437\u0430 \u0448\u0430\u0433\u043e\u043c \u043f\u0443\u0442\u044c: \u043e\u0442\u00a0\u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043e\u00a0\u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0443\u00a0\u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u043d\u0430\u043d\u0438\u044f \u0434\u043b\u044f\u00a0\u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0442\u043e, \u043a\u0430\u043a\u00a0\u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0435, \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0435 \u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0435 \u0432\u0435\u0431\u2011\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430\u00a0\u043e\u0441\u043d\u043e\u0432\u0435 Go.<\/p>\n<p>\u041f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u00a0\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440 \u00ab\u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c\u00bb, \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u0434 \u0432\u0430\u043c\u0438 \u043d\u043e\u0432\u044b\u0435 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u044b \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0438 \u043a\u043e\u0441\u0442\u044b\u043b\u0435\u0439 \ud83d\ude42 \u0422\u0443\u0442 \u0432\u0430\u0436\u043d\u043e, \u0447\u0442\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0435\u00a0\u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434, \u043d\u043e\u00a0\u0438 \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b. <\/p>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u044b\u043b\u0430 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u0438 \u0434\u0430\u043b\u0430 \u0432\u0430\u043c \u043d\u043e\u0432\u044b\u0435 \u0437\u043d\u0430\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0432 \u0441\u0432\u043e\u0451\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438. \u0416\u0435\u043b\u0430\u044e \u0443\u0441\u043f\u0435\u0445\u043e\u0432 \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0438! \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0441\u043a\u043e\u0440\u043e \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043c\u0441\u044f \u0432\u043d\u043e\u0432\u044c!<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/919348\/\"> https:\/\/habr.com\/ru\/articles\/919348\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412\u00a0\u043c\u0438\u0440\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u0435\u0431\u2011\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 (\u0434\u0430, \u0434\u0430, \u044d\u0442\u043e \u0442\u043e\u0442 \u0441\u0430\u043c\u044b\u0439 \u0445\u0430\u0439\u043f \u043f\u0440\u043e \u00ab\u0445\u0430\u0439\u043b\u043e\u0430\u0434\u00bb, \u00ab\u043b\u0435\u0433\u043a\u043e\u0432\u0435\u0441\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438\u00bb, \u00abio\u2011bound \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438\u00bb \u0438 \u0434\u0440\u0443\u0433\u043e\u0435) Go \u0437\u0430\u0432\u043e\u0435\u0432\u0430\u043b \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u044c \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0441\u0432\u043e\u0435\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043b\u0435\u0433\u043a\u043e\u0441\u0442\u0438 \u0438 \u043d\u0430\u0434\u0435\u0436\u043d\u043e\u0441\u0442\u0438. \u041e\u0434\u043d\u0438\u043c \u0438\u0437\u00a0\u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u044b Go \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 <a href=\"https:\/\/pkg.go.dev\/net\/http#pkg-index\" rel=\"noopener noreferrer nofollow\">net\/http<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f\u00a0\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f HTTP\u2011\u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432. \u041e\u0434\u043d\u0430\u043a\u043e, \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430\u00a0\u043a\u0430\u0436\u0443\u0449\u0443\u044e\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u043a\u0435\u0442\u0430, \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043c\u043e\u0436\u0435\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0432\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u0434\u0430 \u0438 \u043f\u043e\u043c\u043e\u0447\u044c \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a.<\/p>\n<p>\u041c\u044b \u0432\u043c\u0435\u0441\u0442\u0435 \u0432\u00a0\u0432\u0430\u043c\u0438, \u0434\u043e\u0440\u043e\u0433\u0438\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0438, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0430\u0441\u043f\u0435\u043a\u0442\u044b \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b net\/http, \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0432\u0435\u0441\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0430\u00a0\u0442\u0430\u043a\u0436\u0435 \u043e\u0431\u0441\u0443\u0434\u0438\u043c, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437\u00a0\u044d\u0442\u0430\u043f\u043e\u0432 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435. \u041d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442\u00a0\u0443\u0440\u043e\u0432\u043d\u044f \u0432\u0430\u0448\u0438\u0445 \u0437\u043d\u0430\u043d\u0438\u0439, \u0431\u0443\u0434\u044c \u0432\u044b \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u043c \u0438\u043b\u0438\u00a0\u043e\u043f\u044b\u0442\u043d\u044b\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c, \u0432\u044b \u043d\u0430\u0439\u0434\u0435\u0442\u0435 \u0437\u0434\u0435\u0441\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u043c \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 Go \u0434\u043b\u044f\u00a0\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u044b\u0441\u043e\u043a\u043e\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0438 \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0445 \u0432\u0435\u0431\u2011\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439.<\/p>\n<h4>\u0414\u043b\u044f \u043a\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f?<\/h4>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e\u00a0\u0436\u0435, \u0434\u043b\u044f\u00a0\u0442\u0435\u0445, \u043a\u0442\u043e \u0445\u043e\u0447\u0435\u0442 \u0433\u043b\u0443\u0431\u0436\u0435 \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a\u00a0\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0430\u00a0\u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0430\u043a\u0435\u0442\u0430 net\/http \u0432\u00a0Go. \u041d\u043e! \u041e\u043d\u0430 \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u0442\u0435\u043c, \u043a\u0442\u043e \u0443\u0436\u0435 \u043f\u0438\u0448\u0435\u0442 HTTP\u2011\u0441\u0435\u0440\u0432\u0438\u0441\u044b \u043d\u0430\u00a0Go \u0438 \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u0441\u044f \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u0441\u0432\u043e\u0438 \u043d\u0430\u0432\u044b\u043a\u0438. \u041d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043d\u0430\u0439\u0434\u0443\u0442 \u0437\u0434\u0435\u0441\u044c \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0430\u00a0\u0443\u0436\u0435 \u043e\u043f\u044b\u0442\u043d\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b \u0441\u043c\u043e\u0433\u0443\u0442 \u043e\u0441\u0432\u0435\u0436\u0438\u0442\u044c \u0437\u043d\u0430\u043d\u0438\u044f \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u0430\u0439\u0442\u0438 \u0434\u043b\u044f\u00a0\u0441\u0435\u0431\u044f \u0447\u0442\u043e\u2011\u0442\u043e \u043d\u043e\u0432\u043e\u0435. \u0427\u0442\u043e\u0431\u044b \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u043f\u043e\u043b\u044c\u0437\u044b \u043e\u0442\u00a0\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438,\u00a0\u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0437\u043d\u0430\u043d\u0438\u044f \u044f\u0437\u044b\u043a\u0430 Go, \u043d\u043e\u00a0\u0434\u0430\u0436\u0435 \u0431\u0435\u0437\u00a0\u043d\u0438\u0445 \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043d\u044f\u0442\u044c \u0441\u0443\u0442\u044c \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<blockquote>\n<p>\u0425\u043e\u0447\u0443 \u0442\u0430\u043a\u0436\u0435 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e\u00a0\u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043d\u0435\u00a0\u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 net\/http, \u043d\u043e\u00a0\u0438 \u0441\u043b\u0443\u0436\u0438\u0442 \u0445\u043e\u0440\u043e\u0448\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u00a0\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u041f\u041e\u00a0\u043d\u0430\u00a0\u044f\u0437\u044b\u043a\u0435 Go. \u0412\u0435\u0434\u044c \u043f\u043e\u0437\u043d\u0430\u043d\u0438\u0435 \u043a\u0430\u043a\u0438\u0445\u2011\u043b\u0438\u0431\u043e \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432, \u0437\u0430\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0440\u043e\u0434\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0438\u043a\u0430\u043c\u0438 \u043a\u0430\u043a\u043e\u0433\u043e\u2011\u043b\u0438\u0431\u043e \u0434\u0435\u043b\u0430\u00a0\u2014 \u043f\u043e\u043b\u0435\u0437\u043d\u043e, \u0438, \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u044d\u0442\u043e \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a\u00a0\u043b\u044e\u0431\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f, \u0431\u0443\u0434\u044c \u0442\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u044f\u0437\u044b\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043d\u0430\u0443\u0447\u043d\u0430\u044f \u0434\u0438\u0441\u0446\u0438\u043f\u043b\u0438\u043d\u0430, \u0442\u0432\u043e\u0440\u0447\u0435\u0441\u0442\u0432\u043e \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<\/blockquote>\n<h4>\u041f\u043b\u0430\u043d<\/h4>\n<p>\u042f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0438\u0434\u0442\u0438 \u043f\u043e\u044d\u0442\u0430\u043f\u043d\u043e, \u0441\u0432\u0435\u0440\u0445\u0443\u00a0\u2014 \u0432\u043d\u0438\u0437, \u0434\u043b\u044f\u00a0\u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b, \u0434\u0430\u0436\u0435 \u043d\u043e\u0432\u0438\u0447\u043a\u0443 \u0432\u00a0Go,\u00a0\u0431\u044b\u043b\u0430 \u043f\u043e\u043d\u044f\u0442\u043d\u0430 \u00ab\u043c\u0430\u0433\u0438\u044f\u00bb \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e\u00a0\u0442\u043e\u043c, \u043a\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0432\u00a0\u044d\u0442\u0438 \u00ab\u0442\u0430\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0433\u043b\u0443\u0431\u0438\u043d\u044b\u00bb \u044f\u0437\u044b\u043a\u0430 \u0438 \u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u044c \u0438\u0445. \u041f\u043e\u0439\u0434\u0451\u043c \u043f\u043e\u00a0\u043f\u0443\u043d\u0442\u043a\u0430\u043c:<\/p>\n<ol>\n<li>\n<p>\u041a\u0440\u0430\u0442\u043a\u0438\u0439 \u044d\u043a\u0441\u043a\u0443\u0440\u0441 \u0432 HTTP<\/p>\n<\/li>\n<li>\n<p>\u0421\u0442\u0430\u0440\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430: \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>http.ListenAndServe()<\/code>, \u043c\u0435\u0442\u043e\u0434 <code>server.ListenAndServe().<\/code><\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432: \u043c\u0435\u0442\u043e\u0434 <code>server.Serve().<\/code><\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0447\u0430\u0441\u0442\u044f\u0445: <\/p>\n<ol>\n<li>\n<p>\u0420\u043e\u0443\u0442\u0438\u043d\u0433 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043d\u0430 \u043c\u043e\u0434\u0443\u043b\u044c net\/http.<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430 \u043b\u0438\u0441\u0442\u0435\u043d\u0435\u0440\u0430 \u00ab\u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c\u00bb<\/p>\n<\/li>\n<li>\n<p>\u0418 \u043c\u043d\u043e\u0433\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435&#8230; <\/p>\n<\/li>\n<\/ol>\n<h2>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c<\/h2>\n<h3>\u041a\u0440\u0430\u0442\u043a\u0438\u0439 \u044d\u043a\u0441\u043a\u0443\u0440\u0441 \u0432 HTTP<\/h3>\n<p>\u041d\u0430\u0447\u043d\u0451\u043c \u0441\u00a0\u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u00a0\u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0432\u00a0\u0441\u0435\u0442\u0438 (\u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442). \u0427\u0442\u043e\u0431\u044b \u043a\u0430\u043a\u2011\u0442\u043e \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438, \u0440\u0435\u0448\u0430\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0438\u00a0\u0442.\u00a0\u0434.,\u00a0\u0431\u044b\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437\u00a0\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d \u043f\u043e\u00a0\u0443\u0440\u043e\u0432\u043d\u044f\u043c\/ \u042d\u0442\u0430 \u0438\u0434\u0435\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0432 7-\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A1%D0%B5%D1%82%D0%B5%D0%B2%D0%B0%D1%8F_%D0%BC%D0%BE%D0%B4%D0%B5%D0%BB%D1%8C_OSI\" rel=\"noopener noreferrer nofollow\">OSI <\/a>(\u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438) \u0438 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u043e\u0439 4-\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/TCP\/IP\" rel=\"noopener noreferrer nofollow\">TCP\/IP<\/a> (\u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u0432\u00a0\u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435). \u0427\u0435\u043c \u043d\u0438\u0436\u0435 \u0443\u0440\u043e\u0432\u0435\u043d\u044c, \u0442\u0435\u043c \u0431\u043b\u0438\u0436\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438 \u0443\u0440\u043e\u0432\u043d\u044f \u043a\u00a0\u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430\u043c, \u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442. \u0422\u0430\u043a \u0432\u043e\u0442, \u0432\u00a0\u043c\u0438\u0440\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u0432\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430:<\/p>\n<p><strong>TCP<\/strong>\u00a0(<em>\u043e\u0442 \u0430\u043d\u0433\u043b. Transmission Control Protocol &#8212; \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043f\u0435\u0440\u0435\u0434\u0430 \u0447\u0438 \u0433\u0438\u043f\u0435\u0440\u0442\u0435\u043a\u0441\u0442\u0430) <\/em>\u2013 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u043d\u044b\u0439 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u0435\u0442\u044f\u0445 TCP\/IP, \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0449\u0438\u0439 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u0441\u0435\u0442\u044c\u044e.   <\/p>\n<p><strong>HTTP<\/strong>\u00a0<em>(\u043e\u0442 \u0430\u043d\u0433\u043b. HyperText Transfer Protocol &#8212; \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043f\u0435\u0440\u0435\u0434\u0430 \u0447\u0438 \u0433\u0438\u043f\u0435\u0440\u0442\u0435\u043a\u0441\u0442\u0430)<\/em>\u00a0\u2014 \u044d\u0442\u043e \u043f\u0440\u0438\u043a\u043b\u0430\u0434\u043d\u043e\u0439 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u0435\u0442\u0438. \u041d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0441 \u0432\u0435\u0431-\u0441\u0430\u0439\u0442\u043e\u0432. <\/p>\n<p>\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b HTTP \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 &#171;\u043f\u043e\u0432\u0435\u0440\u0445&#187; TCP \u0438 \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 \u00ab\u043a\u043b\u0438\u0435\u043d\u0442-\u0441\u0435\u0440\u0432\u0435\u0440\u00bb: \u043a\u043b\u0438\u0435\u043d\u0442, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u0442\u043e\u0440\u043e\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f; \u0441\u0435\u0440\u0432\u0435\u0440, \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0435\u0433\u043e \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u0412 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, TCP \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u0438\u0433\u0440\u0430\u0435\u0442 \u0440\u043e\u043b\u044c \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u043d\u043e\u0433\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 HTTP.<\/p>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u0432\u0441\u0435\u0445 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432 (\u043f\u043e \u043c\u043e\u0434\u0435\u043b\u0438 OSI) \u0432 \u0432\u0438\u0434\u0435 \u0416\u0414 \u0441\u0438\u0441\u0442\u0435\u043c\u044b:<\/p>\n<ol>\n<li>\n<p><strong>\u041f\u0430\u0441\u0441\u0430\u0436\u0438\u0440<\/strong>\u00a0(\u0443\u0440\u043e\u0432\u0435\u043d\u044c 7) \u0433\u043e\u0432\u043e\u0440\u0438\u0442: \u00ab\u0425\u043e\u0447\u0443 \u0437\u0430\u0439\u0442\u0438 \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0441\u0430\u0439\u0442\u0430\u00bb (<em>HTTP-\u0437\u0430\u043f\u0440\u043e\u0441<\/em>).<\/p>\n<\/li>\n<li>\n<p><strong>\u0423\u0440\u043e\u0432\u0435\u043d\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f<\/strong>\u00a0(6) \u0441\u0436\u0438\u043c\u0430\u0435\u0442 \u0442\u0435\u043a\u0441\u0442 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0438 \u0448\u0438\u0444\u0440\u0443\u0435\u0442 \u0435\u0433\u043e.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0435\u0430\u043d\u0441\u043e\u0432\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c<\/strong>\u00a0(5) \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u00ab\u0441\u0435\u0430\u043d\u0441\u00bb \u0441\u0432\u044f\u0437\u0438 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c.<\/p>\n<\/li>\n<li>\n<p><strong>\u0422\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u043d\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c<\/strong>\u00a0(4) \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u0442 \u0442\u0435\u043a\u0441\u0442 \u043d\u0430 \u043f\u0430\u043a\u0435\u0442\u044b \u0438 \u043d\u0443\u043c\u0435\u0440\u0443\u0435\u0442 \u0438\u0445 (<em>TCP<\/em>).<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0435\u0442\u0435\u0432\u043e\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c<\/strong>\u00a0(3) \u043f\u0440\u043e\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u0447\u0435\u0440\u0435\u0437 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442-\u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0442\u043e\u0440\u044b (\u00ab\u0413\u043e\u0440\u043e\u0434 \u0421 (\u0441\u0435\u0440\u0432\u0435\u0440, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0445\u043e\u0441\u0442\u0438\u0442\u0441\u044f \u0441\u0430\u0439\u0442) \u2192 \u0413\u043e\u0440\u043e\u0434 \u041f \u2192 &#8230; \u2192 \u0413\u043e\u0440\u043e\u0434 \u0426 (\u043d\u0430\u0448 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u044c \u0441\u0430\u0439\u0442\u0430) \u00bb).<\/p>\n<\/li>\n<li>\n<p><strong>\u041a\u0430\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c<\/strong>\u00a0(2) \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u043f\u0430\u043a\u0435\u0442\u044b \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u043c\u0438 \u0440\u043e\u0443\u0442\u0435\u0440\u0430\u043c\u0438 (Ethernet, Wi-Fi).<\/p>\n<\/li>\n<li>\n<p><strong>\u0424\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c<\/strong>\u00a0(1) \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0431\u0438\u0442\u044b \u043f\u043e \u043a\u0430\u0431\u0435\u043b\u044e \u0438\u043b\u0438 \u0432\u043e\u0437\u0434\u0443\u0445\u0443 (\u0441\u0432\u0435\u0442 \u0432 \u043e\u043f\u0442\u043e\u0432\u043e\u043b\u043e\u043a\u043d\u0435, \u0440\u0430\u0434\u0438\u043e\u0441\u0438\u0433\u043d\u0430\u043b\u044b).<\/p>\n<\/li>\n<\/ol>\n<h3>\u0421\u0442\u0430\u0440\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/h3>\n<p>\u041d\u0430\u0447\u043d\u0451\u043c \u0441\u00a0\u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>main()<\/code> \u0432\u00a0\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432\u044b\u0437\u043e\u0432 <code>http.ListenAndServe<\/code>\u00a0&#8212; \u0442\u043e\u0439 \u0441\u0430\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n<pre><code class=\"go\">\/\/ main.go  package main  import (   \"net\/http\" )  func main() {   mux := http.NewServeMux()      mux.HandleFunc(\"\/hello\", func(w http.ResponseWriter, r *http.Request) {     w.Write([]byte(\"Hello world!\"))   })      _ := http.ListenAndServe(\"localhost:5000\", mux) }<\/code><\/pre>\n<p>\u0412\u0441\u0451, \u0447\u0442\u043e\u00a0\u0434\u0435\u043b\u0430\u0435\u0442 \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u044d\u0442\u043e \u043f\u0440\u0438\u00a0\u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043f\u043e\u00a0\u0430\u0434\u0440\u0435\u0441\u0443 <a href=\"http:\/\/localhost:5000\/hello\" rel=\"noopener noreferrer nofollow\"><em>http:\/\/localhost:5000\/hello<\/em><\/a> \u0432\u044b\u0434\u0430\u0451\u0442 \u043d\u0430\u043c \u043d\u0430\u0434\u043f\u0438\u0441\u044c \u00abHello world!\u00bb<\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>ListenAndServe<\/code> \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u043c \u043c\u043e\u0434\u0443\u043b\u0435 net\/http:<\/p>\n<pre><code class=\"go\">\/\/ net\/http\/server.go  func ListenAndServe(addr string, handler Handler) error { \u00a0 \u00a0 server := &amp;Server{Addr: addr, Handler: handler}    \u00a0 \u00a0 return server.ListenAndServe() }<\/code><\/pre>\n<p><code>addr:<\/code> \u0421\u0442\u0440\u043e\u043a\u0430, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u0430\u0434\u0440\u0435\u0441 \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u043d\u0438\u044f. \u0410\u0434\u0440\u0435\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 &#8216;\u0425\u043e\u0441\u0442:\u041f\u043e\u0440\u0442&#8217; (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, &#171;<a href=\"http:\/\/localhost:5000\" rel=\"noopener noreferrer nofollow\">localhost:5000<\/a>&#171;).<\/p>\n<p><code>handler:<\/code> \u041e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 http.Handler &#8212; \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430.<\/p>\n<p><em>\u0412 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u0443\u043a\u0430\u0437\u0430\u043d\u043e:<\/em><\/p>\n<blockquote>\n<p>\u00ab\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u0435\u0442 \u0441\u0435\u0442\u0435\u0432\u043e\u0439 TCP \u0430\u0434\u0440\u0435\u0441 \u0438 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 Serve \u0441\u00a0Handler \u0434\u043b\u044f\u00a0\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0430\u00a0\u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f\u0445. \u041f\u0440\u0438\u043d\u044f\u0442\u044b\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e TCP keep\u2011alive. Handler \u043e\u0431\u044b\u0447\u043d\u043e \u0440\u0430\u0432\u0435\u043d \u043d\u0443\u043b\u044e, \u0438 \u0432\u00a0\u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f DefaultServeMux. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u0435\u00a0\u043d\u0443\u043b\u0435\u0432\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443\u00bb.<\/p>\n<\/blockquote>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0441\u043e\u0437\u043d\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u043e\u0435 \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0432\u044b\u0434\u0435\u043b\u0438\u043c \u0438 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f \u0441 \u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c\u0438 \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u043c\u0438:<\/p>\n<ul>\n<li>\n<p><em>Serve (\u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0442\u044c)<\/em> &#8212; \u043f\u043e\u043a\u0430 \u043c\u044b \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0443\u043d\u043a\u0442, \u0442.\u043a. \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043d\u0430 \u0432\u00a0\u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c.<\/p>\n<\/li>\n<li>\n<p><em>Handler (\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a)<\/em> &#8212; \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0432 \u0441\u0435\u0431\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044e ServeHTTP. \u041a\u0430\u043a \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u0434\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441 (\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0437\u0434\u0435\u0441\u044c: <a href=\"https:\/\/pkg.go.dev\/net\/http#Handler\" rel=\"noopener noreferrer nofollow\">Handler<\/a>).<\/p>\n<\/li>\n<li>\n<p><em>DefaultServeMux <\/em>&#8212; \u044d\u0442\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u00a0<a href=\"https:\/\/pkg.go.dev\/net\/http#ServeMux\" rel=\"noopener noreferrer nofollow\">ServeMux<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0435\u0441\u043b\u0438 \u044f\u0432\u043d\u043e \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d \u0434\u0440\u0443\u0433\u043e\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0442\u043e\u0440 (\u043f\u0440\u0438\u043c. &#8212; \u041c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0442\u043e\u0440, \u044d\u0442\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0445 \u043f\u043e \u043d\u0443\u0436\u043d\u044b\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c). \u041e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044e \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 (handlers) \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0443\u0442\u0438 URL. \u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u0435\u0441\u0442\u044c \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0434\u043b\u044f \u043f\u0443\u0442\u0438\u00a0<em>\/hello<\/em>, \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a\u00a0<em>http:\/\/localhost:5000\/hello<\/em>\u00a0\u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430 \u044d\u0442\u043e\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a.<\/p>\n<\/li>\n<li>\n<p><em>TCP keep-alive<\/em> &#8212; \u044d\u0442\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0432 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0435 TCP, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c \u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f. \u041e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f &#171;\u043c\u0435\u0440\u0442\u0432\u044b\u0445&#187; \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0433\u0434\u0430 \u043e\u0434\u043d\u0430 \u0438\u0437 \u0441\u0442\u043e\u0440\u043e\u043d \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u043b\u0430\u0441\u044c \u0438\u043b\u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u0435\u043b \u0441\u0431\u043e\u0439 \u0441\u0435\u0442\u0438) \u0438 \u0438\u0445 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f. \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f  \u0432 \u0442\u043e\u043c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 TCP &#8212; \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c, \u043e\u0434\u043d\u0430\u043a\u043e, \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0432\u043e\u0434\u0443 \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0430\u0442\u0435\u0439 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/proglib.io\/p\/samouchitel-po-go-dlya-nachinayushchih-chast-17-osnovy-setevogo-programmirovaniya-stek-tcp-ip-sokety-paket-net-2024-11-15\" rel=\"noopener noreferrer nofollow\">\u0434\u0430\u043d\u043d\u0430\u044f<\/a>).<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u0443\u0442 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e\u00a0\u0432\u00a0\u0442\u0435\u043b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0442\u0438\u043f\u0430 <a href=\"https:\/\/pkg.go.dev\/net\/http#Server\" rel=\"noopener noreferrer nofollow\">Server<\/a>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u0434\u043b\u044f\u00a0\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f HTTP\u2011\u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c. \u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u0438\u0440\u0443\u0435\u0442 \u0432\u0441\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f\u00a0\u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a\u00a0\u0430\u0434\u0440\u0435\u0441, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438, \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u044b, TLS\u2011\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438. \u041a\u0430\u0436\u0434\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044f \u0433\u0438\u0431\u043a\u043e \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0435\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c.<\/p>\n<h4>\u0421\u0435\u0440\u0432\u0435\u0440<\/h4>\n<p>\u042f \u0434\u0443\u043c\u0430\u044e, \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043b\u0438\u0448\u043d\u0438\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u0441\u0435\u0440\u0432\u0435\u0440\u0430:<\/p>\n<pre><code class=\"go\">\/\/ A Server defines parameters for running an HTTP server. \/\/ The zero value for Server is a valid configuration. type Server struct { \/\/ Addr optionally specifies the TCP address for the server to listen on, \/\/ in the form \"host:port\". If empty, \":http\" (port 80) is used. \/\/ The service names are defined in RFC 6335 and assigned by IANA. \/\/ See net.Dial for details of the address format. Addr string  Handler Handler \/\/ handler to invoke, http.DefaultServeMux if nil  \/\/ DisableGeneralOptionsHandler, if true, passes \"OPTIONS *\" requests to the Handler, \/\/ otherwise responds with 200 OK and Content-Length: 0. DisableGeneralOptionsHandler bool  \/\/ TLSConfig optionally provides a TLS configuration for use \/\/ by ServeTLS and ListenAndServeTLS. Note that this value is \/\/ cloned by ServeTLS and ListenAndServeTLS, so it's not \/\/ possible to modify the configuration with methods like \/\/ tls.Config.SetSessionTicketKeys. To use \/\/ SetSessionTicketKeys, use Server.Serve with a TLS Listener \/\/ instead. TLSConfig *tls.Config  \/\/ ReadTimeout is the maximum duration for reading the entire \/\/ request, including the body. A zero or negative value means \/\/ there will be no timeout. \/\/ \/\/ Because ReadTimeout does not let Handlers make per-request \/\/ decisions on each request body's acceptable deadline or \/\/ upload rate, most users will prefer to use \/\/ ReadHeaderTimeout. It is valid to use them both. ReadTimeout time.Duration  \/\/ ReadHeaderTimeout is the amount of time allowed to read \/\/ request headers. The connection's read deadline is reset \/\/ after reading the headers and the Handler can decide what \/\/ is considered too slow for the body. If zero, the value of \/\/ ReadTimeout is used. If negative, or if zero and ReadTimeout \/\/ is zero or negative, there is no timeout. ReadHeaderTimeout time.Duration  \/\/ WriteTimeout is the maximum duration before timing out \/\/ writes of the response. It is reset whenever a new \/\/ request's header is read. Like ReadTimeout, it does not \/\/ let Handlers make decisions on a per-request basis. \/\/ A zero or negative value means there will be no timeout. WriteTimeout time.Duration  \/\/ IdleTimeout is the maximum amount of time to wait for the \/\/ next request when keep-alives are enabled. If zero, the value \/\/ of ReadTimeout is used. If negative, or if zero and ReadTimeout \/\/ is zero or negative, there is no timeout. IdleTimeout time.Duration  \/\/ MaxHeaderBytes controls the<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-463694","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/463694","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=463694"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/463694\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=463694"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=463694"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=463694"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}