修订代码,文档,示例

This commit is contained in:
e1732a364fed
2000-01-01 00:00:00 +00:00
parent bdb73ffc9d
commit 78faa9ebae
7 changed files with 51 additions and 37 deletions

View File

@@ -105,6 +105,28 @@ func printSupportedProtocols() {
advLayer.PrintAllProtocolNames()
}
func printAllState(w io.Writer, withoutTProxy bool) {
fmt.Fprintln(w, "activeConnectionCount", vs.ActiveConnectionCount)
fmt.Fprintln(w, "allDownloadBytesSinceStart", vs.AllDownloadBytesSinceStart)
fmt.Fprintln(w, "allUploadBytesSinceStart", vs.AllUploadBytesSinceStart)
for i, s := range allServers {
fmt.Fprintln(w, "inServer", i, proxy.GetFullName(s), s.AddrStr())
}
if !withoutTProxy && len(tproxyList) > 0 {
for i, tc := range tproxyList {
fmt.Fprintln(w, "inServer", i+len(allServers), "tproxy", tc.String())
}
}
for i, c := range allClients {
fmt.Fprintln(w, "outClient", i, proxy.GetFullName(c), c.AddrStr())
}
}
//see https://dev.maxmind.com/geoip/geolite2-free-geolocation-data?lang=en
func tryDownloadMMDB() {
fp := utils.GetFilePath(netLayer.GeoipFileName)
@@ -171,28 +193,6 @@ func tryDownloadMMDB() {
}
func printAllState(w io.Writer, withoutTProxy bool) {
fmt.Fprintln(w, "activeConnectionCount", vs.ActiveConnectionCount)
fmt.Fprintln(w, "allDownloadBytesSinceStart", vs.AllDownloadBytesSinceStart)
fmt.Fprintln(w, "allUploadBytesSinceStart", vs.AllUploadBytesSinceStart)
for i, s := range allServers {
fmt.Fprintln(w, "inServer", i, proxy.GetFullName(s), s.AddrStr())
}
if !withoutTProxy && len(tproxyList) > 0 {
for i, tc := range tproxyList {
fmt.Fprintln(w, "inServer", i+len(allServers), "tproxy", tc.String())
}
}
for i, c := range allClients {
fmt.Fprintln(w, "outClient", i, proxy.GetFullName(c), c.AddrStr())
}
}
//试图从自己已经配置好的节点去下载geosite源码文件, 如果没有节点则直连下载。
// 我们只需要一个dial配置即可. listen我们不使用配置文件的配置而是自行监听一个随机端口用于http代理
func tryDownloadGeositeSource() {