From 86478d2c256d825c3374f7cdc5e54431da1579e0 Mon Sep 17 00:00:00 2001 From: nadoo <287492+nadoo@users.noreply.github.com> Date: Sun, 25 Nov 2018 22:21:23 +0800 Subject: [PATCH] doc: update document for tls and unix proxy --- README.md | 14 +++++++++++--- conf.go | 12 ++++++++++-- config/glider.conf.example | 6 ++++++ proxy/tls/tls.go | 5 +---- proxy/unix/unix.go | 5 +---- 5 files changed, 29 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 1e8d2a1..bd47525 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ glider -config CONFIGPATH -listen :8080 -verbose ## Usage ```bash -glider v0.6.8 usage: +glider v0.6.9 usage: -checkduration int proxy check interval(seconds) (default 30) -checkwebsite string @@ -160,13 +160,15 @@ Available Schemes: tls: tls transport ws: websocket transport redir: redirect proxy. (used on linux as a transparent proxy with iptables redirect rules) + redir6: redirect proxy(ipv6) tcptun: tcp tunnel udptun: udp tunnel uottun: udp over tcp tunnel + unix: unix domain socket Available schemes for different modes: - listen: mixed ss socks5 http redir tcptun udptun uottun - forward: ss socks5 http ssr vmess tls ws + listen: mixed ss socks5 http redir redir6 tcptun udptun uottun tls unix + forward: ss socks5 http ssr vmess tls ws unix SS scheme: ss://method:pass@host:port @@ -212,6 +214,9 @@ TLS and Websocket with a specified proxy protocol: tls://host:port[?skipVerify=true],ws://[@/path],socks5://[user:pass@] tls://host:port[?skipVerify=true],ws://[@/path],vmess://[security:]uuid@?alterID=num +Unix domain socket scheme: + unix://path + DNS forwarding server: dns=:53 dnsserver=8.8.8.8:53 @@ -257,6 +262,9 @@ Examples: glider -listen socks5://:1080 -verbose -listen on :1080 as a socks5 proxy server, in verbose mode. + glider -listen =tls://:443?cert=crtFilePath&key=keyFilePath,http:// -verbose + -listen on :443 as a https proxy server. + glider -listen http://:8080 -forward socks5://127.0.0.1:1080 -listen on :8080 as a http proxy server, forward all requests via socks5 server. diff --git a/conf.go b/conf.go index 4e0b74c..c323ef7 100644 --- a/conf.go +++ b/conf.go @@ -125,11 +125,12 @@ func usage() { fmt.Fprintf(os.Stderr, " tcptun: tcp tunnel\n") fmt.Fprintf(os.Stderr, " udptun: udp tunnel\n") fmt.Fprintf(os.Stderr, " uottun: udp over tcp tunnel\n") + fmt.Fprintf(os.Stderr, " unix: unix domain socket\n") fmt.Fprintf(os.Stderr, "\n") fmt.Fprintf(os.Stderr, "Available schemes for different modes:\n") - fmt.Fprintf(os.Stderr, " listen: mixed ss socks5 http redir redir6 tcptun udptun uottun\n") - fmt.Fprintf(os.Stderr, " forward: ss socks5 http ssr vmess tls ws\n") + fmt.Fprintf(os.Stderr, " listen: mixed ss socks5 http redir redir6 tcptun udptun uottun tls unix\n") + fmt.Fprintf(os.Stderr, " forward: ss socks5 http ssr vmess tls ws unix\n") fmt.Fprintf(os.Stderr, "\n") fmt.Fprintf(os.Stderr, "SS scheme:\n") @@ -186,6 +187,10 @@ func usage() { fmt.Fprintf(os.Stderr, " tls://host:port[?skipVerify=true],ws://[@/path],vmess://[security:]uuid@?alterID=num\n") fmt.Fprintf(os.Stderr, "\n") + fmt.Fprintf(os.Stderr, "Unix domain socket scheme:\n") + fmt.Fprintf(os.Stderr, " unix://path\n") + fmt.Fprintf(os.Stderr, "\n") + fmt.Fprintf(os.Stderr, "DNS forwarding server:\n") fmt.Fprintf(os.Stderr, " dns=:53\n") fmt.Fprintf(os.Stderr, " dnsserver=8.8.8.8:53\n") @@ -235,6 +240,9 @@ func usage() { fmt.Fprintf(os.Stderr, " "+app+" -listen socks5://:1080 -verbose\n") fmt.Fprintf(os.Stderr, " -listen on :1080 as a socks5 proxy server, in verbose mode.\n") fmt.Fprintf(os.Stderr, "\n") + fmt.Fprintf(os.Stderr, " "+app+" -listen =tls://:443?cert=crtFilePath&key=keyFilePath,http:// -verbose\n") + fmt.Fprintf(os.Stderr, " -listen on :443 as a https proxy server.\n") + fmt.Fprintf(os.Stderr, "\n") fmt.Fprintf(os.Stderr, " "+app+" -listen http://:8080 -forward socks5://127.0.0.1:1080\n") fmt.Fprintf(os.Stderr, " -listen on :8080 as a http proxy server, forward all requests via socks5 server.\n") fmt.Fprintf(os.Stderr, "\n") diff --git a/config/glider.conf.example b/config/glider.conf.example index 1449f11..23a2050 100644 --- a/config/glider.conf.example +++ b/config/glider.conf.example @@ -55,6 +55,12 @@ listen=socks5://:1080 # listen on 1084 as a udp over tcp tunnel, all requests to :1084 will be forward to 1.1.1.1:53 # listen=uottun://:1084=1.1.1.1:53 +# listen on 443 with tls security layer and serve as http proxy server (HTTPS proxy) +# listen=tls://:443?cert=crtFilePath&key=keyFilePath,http:// + +# listen on unix domain socket and serve as socks5 server +# listen=unix:///tmp/glider.socket,socks5:// + # FORWARDERS # ---------- # Forwarders, we can setup multiple forwarders. diff --git a/proxy/tls/tls.go b/proxy/tls/tls.go index 3e456f8..7e1a4b8 100644 --- a/proxy/tls/tls.go +++ b/proxy/tls/tls.go @@ -3,7 +3,6 @@ package tls import ( stdtls "crypto/tls" "errors" - "fmt" "net" "net/url" "strings" @@ -95,9 +94,7 @@ func NewTLSServer(s string, dialer proxy.Dialer) (proxy.Server, error) { // prepare transport listener // TODO: check here if len(transport) < 2 { - err := fmt.Errorf("[tls] malformd listener: %s", s) - log.F(err.Error()) - return nil, err + return nil, errors.New("[tls] malformd listener:" + s) } p, err := NewTLS(transport[0], dialer) diff --git a/proxy/unix/unix.go b/proxy/unix/unix.go index 90a913f..0395da1 100644 --- a/proxy/unix/unix.go +++ b/proxy/unix/unix.go @@ -2,7 +2,6 @@ package unix import ( "errors" - "fmt" "net" "net/url" "os" @@ -53,9 +52,7 @@ func NewUnixServer(s string, dialer proxy.Dialer) (proxy.Server, error) { // prepare transport listener // TODO: check here if len(transport) < 2 { - err := fmt.Errorf("[unix] malformd listener: %s", s) - log.F(err.Error()) - return nil, err + return nil, errors.New("[unix] malformd listener:" + s) } p, err := NewUnix(transport[0], dialer)