chore: doc updates

This commit is contained in:
nadoo committed 2022-03-14 13:06:26 +08:00
1 parent 420ec26368
commit 3740375569
7 files changed
+69 -21

No files matched your search

+7
View File
@@ -112,3 +112,10 @@ func extractUserPass(auth string) (username, password string, ok bool) {
return s[:idx], s[idx+1:], true
}
func init() {
proxy.AddUsage("http", `
Http scheme:
http://[user:pass@]host:port
`)
}
+9 -7
View File
@@ -20,19 +20,21 @@ type Proxy interface {
Record(dialer Dialer, success bool)
}
var usages = make(map[string]string)
var (
msg strings.Builder
usages = make(map[string]string)
)
// AddUsage adds help message for the named proxy.
func AddUsage(name, usage string) { usages[name] = usage }
func AddUsage(name, usage string) {
usages[name] = usage
msg.WriteString(usage)
msg.WriteString("\n--")
}
// Usage returns help message of the named proxy.
func Usage(name string) string {
if name == "all" {
var msg strings.Builder
for _, usage := range usages {
msg.WriteString(usage)
msg.WriteString("\n--")
}
return msg.String()
}
+7
View File
@@ -189,3 +189,10 @@ func (s *SOCKS4) connect(conn net.Conn, target string) error {
return err
}
func init() {
proxy.AddUsage("socks4", `
Socks4 scheme:
socks4://host:port
`)
}
+1 -1
View File
@@ -55,6 +55,6 @@ func NewSocks5(s string, d proxy.Dialer, p proxy.Proxy) (*Socks5, error) {
func init() {
proxy.AddUsage("socks5", `
Socks5 scheme:
socks://[user:pass@]host:port
socks5://[user:pass@]host:port
`)
}