socks4: add doc info and fix bug

This commit is contained in:
nadoo 2020-04-13 12:33:44 +08:00
parent fa3a7da859
commit d8b9e00025
3 changed files with 5 additions and 3 deletions

View File

@ -41,6 +41,7 @@ we can set up local listeners as proxy servers, and forward requests to internet
|Protocol | Listen/TCP | Listen/UDP | Forward/TCP | Forward/UDP | |Protocol | Listen/TCP | Listen/UDP | Forward/TCP | Forward/UDP |
| :-: | :-: | :-: | :-: | :-: | | :-: | :-: | :-: | :-: | :-: |
Socks5 | √ | √ | √ | √ Socks5 | √ | √ | √ | √
Socks4 | | | √ |
Http | √ | | √ | Http | √ | | √ |
SS | √ | √ | √ | √ SS | √ | √ | √ | √
Redir | √ | | | Redir | √ | | |
@ -125,6 +126,7 @@ glider 0.10.0 usage:
Available Schemes: Available Schemes:
mixed: serve as a http/socks5 proxy on the same port. (default) mixed: serve as a http/socks5 proxy on the same port. (default)
ss: ss proxy ss: ss proxy
socks4: socks4 proxy
socks5: socks5 proxy socks5: socks5 proxy
http: http proxy http: http proxy
ssr: ssr proxy ssr: ssr proxy

View File

@ -114,6 +114,7 @@ func usage() {
fmt.Fprintf(w, "Available Schemes:\n") fmt.Fprintf(w, "Available Schemes:\n")
fmt.Fprintf(w, " mixed: serve as a http/socks5 proxy on the same port. (default)\n") fmt.Fprintf(w, " mixed: serve as a http/socks5 proxy on the same port. (default)\n")
fmt.Fprintf(w, " ss: ss proxy\n") fmt.Fprintf(w, " ss: ss proxy\n")
fmt.Fprintf(w, " socks4: socks4 proxy\n")
fmt.Fprintf(w, " socks5: socks5 proxy\n") fmt.Fprintf(w, " socks5: socks5 proxy\n")
fmt.Fprintf(w, " http: http proxy\n") fmt.Fprintf(w, " http: http proxy\n")
fmt.Fprintf(w, " ssr: ssr proxy\n") fmt.Fprintf(w, " ssr: ssr proxy\n")

View File

@ -32,8 +32,7 @@ func init() {
proxy.RegisterDialer("socks4", NewSocks4Dialer) proxy.RegisterDialer("socks4", NewSocks4Dialer)
} }
// NewSOCKS4 returns a Proxy that makes SOCKS v5 connections to the given address // NewSOCKS4 returns a socks4 proxy.
// with an optional username and password. (RFC 1928)
func NewSOCKS4(s string, dialer proxy.Dialer) (*SOCKS4, error) { func NewSOCKS4(s string, dialer proxy.Dialer) (*SOCKS4, error) {
u, err := url.Parse(s) u, err := url.Parse(s)
if err != nil { if err != nil {
@ -161,5 +160,5 @@ func (s *SOCKS4) connect(conn net.Conn, target string) error {
err = errors.New("Socks connection request failed, unknown error") err = errors.New("Socks connection request failed, unknown error")
} }
return nil return err
} }