From 21923af1cd2f9f225ea8b0c0b002e64e0d2f9785 Mon Sep 17 00:00:00 2001 From: nadoo <287492+nadoo@users.noreply.github.com> Date: Wed, 25 Jul 2018 08:23:58 +0800 Subject: [PATCH] doc: update some descriptions --- README.md | 6 +++--- config/glider.conf.example | 23 +++++++++++++---------- proxy/vmess/chunk.go | 2 +- proxy/ws/client.go | 2 +- proxy/ws/frame.go | 3 --- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 1a375ab..00a739b 100644 --- a/README.md +++ b/README.md @@ -156,7 +156,7 @@ Available securities for vmess: TLS scheme: tls://host:port[?skipVerify=true] -TLS with a specified proxy protocol: +TLS with a specified proxy protocol(proxy over tls): tls://host:port[?skipVerify=true],scheme:// tls://host:port[?skipVerify=true],http://[user:pass@] tls://host:port[?skipVerify=true],socks5://[user:pass@] @@ -165,13 +165,13 @@ TLS with a specified proxy protocol: Websocket scheme: ws://host:port[/path] -Websocket with a specified proxy protocol: +Websocket with a specified proxy protocol(proxy over websocket): ws://host:port[/path],scheme:// ws://host:port[/path],http://[user:pass@] ws://host:port[/path],socks5://[user:pass@] ws://host:port[/path],vmess://[security:]uuid@?alterID=num -TLS and Websocket with a specified proxy protocol: +TLS and Websocket with a specified proxy protocol(proxy over websocket over tls): tls://host:port[?skipVerify=true],ws://[@/path],scheme:// tls://host:port[?skipVerify=true],ws://[@/path],http://[user:pass@] tls://host:port[?skipVerify=true],ws://[@/path],socks5://[user:pass@] diff --git a/config/glider.conf.example b/config/glider.conf.example index b4fc2d7..46a52d6 100644 --- a/config/glider.conf.example +++ b/config/glider.conf.example @@ -66,7 +66,7 @@ listen=socks5://:1080 # Forwarders, we can setup multiple forwarders. # Socks5 proxy as forwarder -#forward=socks5://192.168.1.10:1080 +# forward=socks5://192.168.1.10:1080 # SS proxy as forwarder # forward=ss://method:pass@1.1.1.1:8443 @@ -77,18 +77,21 @@ listen=socks5://:1080 # http proxy as forwarder # forward=http://1.1.1.1:8080 -# vmess proxy as forwarder -# forward=vmess://security:5a146038-0b56-4e95-b1dc-5c6f5a32cd98@1.1.1.1:443?alterID=2 +# vmess with none security +# forward=vmess://5a146038-0b56-4e95-b1dc-5c6f5a32cd98@1.1.1.1:443?alterID=2 -# vmess proxy with tls as forwarder -# forward=tls://1.1.1.1:443,vmess://security:5a146038-0b56-4e95-b1dc-5c6f5a32cd98@?alterID=2 +# vmess with aes-128-gcm security +# forward=vmess://aes-128-gcm:5a146038-0b56-4e95-b1dc-5c6f5a32cd98@1.1.1.1:443?alterID=2 -# vmess proxy with ws as forwarder -# forward=ws://1.1.1.1:80,vmess://security:5a146038-0b56-4e95-b1dc-5c6f5a32cd98@?alterID=2 +# vmess over tls +# forward=tls://1.1.1.1:443,vmess://5a146038-0b56-4e95-b1dc-5c6f5a32cd98@?alterID=2 -# vmess proxy with ws and tls as forwarder -# forward=tls://1.1.1.1:443,ws://,vmess://security:5a146038-0b56-4e95-b1dc-5c6f5a32cd98@?alterID=2 -# forward=tls://1.1.1.1:443,ws://@path,vmess://security:5a146038-0b56-4e95-b1dc-5c6f5a32cd98@?alterID=2 +# vmess over websocket +# forward=ws://1.1.1.1:80/path,vmess://chacha20-poly1305:5a146038-0b56-4e95-b1dc-5c6f5a32cd98@?alterID=2 + +# vmess over ws over tls +# forward=tls://1.1.1.1:443,ws://,vmess://5a146038-0b56-4e95-b1dc-5c6f5a32cd98@?alterID=2 +# forward=tls://1.1.1.1:443,ws://@/path,vmess://5a146038-0b56-4e95-b1dc-5c6f5a32cd98@?alterID=2 # FORWARDER CHAIN # --------------- diff --git a/proxy/vmess/chunk.go b/proxy/vmess/chunk.go index 89b71bc..6acd145 100644 --- a/proxy/vmess/chunk.go +++ b/proxy/vmess/chunk.go @@ -81,9 +81,9 @@ func (r *chunkedReader) Read(b []byte) (int, error) { if err != nil { return 0, err } + r.leftBytes = int(binary.BigEndian.Uint16(r.buf[:lenSize])) // if length == 0, then this is the end - r.leftBytes = int(binary.BigEndian.Uint16(r.buf[:lenSize])) if r.leftBytes == 0 { return 0, nil } diff --git a/proxy/ws/client.go b/proxy/ws/client.go index 44ae373..0c7ccdd 100644 --- a/proxy/ws/client.go +++ b/proxy/ws/client.go @@ -98,7 +98,7 @@ func (c *Conn) Read(b []byte) (n int, err error) { } // parseFirstLine parses "GET /foo HTTP/1.1" OR "HTTP/1.1 200 OK" into its three parts. -// TODO: move to seperate http lib package for reuse(also for http proxy module) +// TODO: move to separate http lib package for reuse(also for http proxy module) func parseFirstLine(tp *textproto.Reader) (r1, r2, r3 string, ok bool) { line, err := tp.ReadLine() // log.F("first line: %s", line) diff --git a/proxy/ws/frame.go b/proxy/ws/frame.go index 3d5b675..a70779f 100644 --- a/proxy/ws/frame.go +++ b/proxy/ws/frame.go @@ -33,13 +33,10 @@ const ( defaultFrameSize = 4096 maxFrameHeaderSize = 2 + 8 + 4 // Fixed header + length + mask maskKeyLen = 4 -) -const ( finalBit byte = 1 << 7 maskBit byte = 1 << 7 opCodeBinary byte = 2 - opClose byte = 8 ) type frameWriter struct {