目录
1. Go 常用库
1.1. HTTP
1.1.1. goproxy: An HTTP proxy library for Go
https://github.com/elazarl/goproxy
1.1.2. go-retryablehttp
The retryablehttp package provides a familiar HTTP client interface with automatic retries and exponential backoff. It is a thin wrapper over the standard net/http client library and exposes nearly the same public API. This makes retryablehttp very easy to drop into existing programs.
retryablehttp performs automatic retries under certain conditions. Mainly, if an error is returned by the client (connection errors, etc.), or if a 500-range response code is received (except 501), then a retry is invoked after a wait period. Otherwise, the response is returned and left to the caller to interpret.
The main difference from net/http is that requests which take a request body (POST/PUT et. al) can have the body provided in a number of ways (some more or less efficient) that allow “rewinding” the request body if the initial request fails so that the full request can be attempted again. See the godoc for more details.
Version 0.6.0 and before are compatible with Go prior to 1.12. From 0.6.1 onward, Go 1.12+ is required. From 0.6.7 onward, Go 1.13+ is required.
1.1.2.1. exponential backoff(指数退避)
from: 这里
指数退避是退避技术(backoff)中很常见的一种,它是处理重负荷的一个很有效的方法。指数退避中最常用的估计是二进制退避技术。根据百度百科,二进制退避技术(Binary Exponential Backoff)指在遇到重复的冲突时,站点将重复传输,但在每一次冲突之后,随着时延的平均值将加倍。二进制指数退避算法提供了一个处理重负荷的方法。尝试传输的重复失败导致更长的退避时间,这将有助于负荷的平滑。如果没有这样的退避,以下状况可能发生:两个或多站点同时尝试传输,这将导致冲突,之后这些站点又立即尝试重传,导致一个新冲突。
1.1.3. go-dnscache
go-dnscache is a Go package for caching DNS lookup results in memory. It asynchronously lookups DNS and refresh results. The main motivation of this package is to avoid too much DNS lookups for every request (DNS lookup sometimes makes request really slow and causes error). This can be mainly used for the targets which are running on non-dynamic environment where IP does not change often.
1.2. 替代库
1.2.1. 替代 git, go-git: A highly extensible Git implementation in pure Go.
https://github.com/go-git/go-git
1.3. 社交
1.3.1. 评论
1.4. binary
- gsv: A simple tool to view the size of a Go compiled binary.