在 linux 上用 systemtap 是一个比较好的选择。 SystemTap 的工作方式是将脚本转换成 C 语言, 再将 C 编译成内核模块。当内核模块加载时,会 将 hooks 挂载到内核中的 probe,当卸载时,会同时 卸载 hooks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var defaultTransport = &http.Transport{ | |
| Proxy: http.ProxyFromEnvironment, | |
| Dial: (&net.Dialer{ | |
| Timeout: 30 * time.Second, | |
| KeepAlive: 30 * time.Second, | |
| }).Dial, | |
| TLSHandshakeTimeout: 10 * time.Second, | |
| TLSClientConfig: &tls.Config{ | |
| InsecureSkipVerify: true, | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "bytes" | |
| ) | |
| func encode(ss []string) string { | |
| bs := [][]byte{} | |
| for _, s := range ss { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ( | |
| "encoding/base64" | |
| "fmt" | |
| "net/http" | |
| ) | |
| type BasicAuthTransport struct { | |
| Username string | |
| Password string | |
| } |