diff --git a/README.md b/README.md index 8199897da..a678af06d 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,22 @@ [![Build Status](https://travis-ci.org/txthinking/brook.svg?branch=master)](https://travis-ci.org/txthinking/brook) [![Go Report Card](https://goreportcard.com/badge/github.com/txthinking/brook)](https://goreportcard.com/report/github.com/txthinking/brook) [![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](http://www.gnu.org/licenses/gpl-3.0) [![Wiki](https://img.shields.io/badge/docs-wiki-blue.svg)](https://github.com/txthinking/brook/wiki)

- Brook + Brook

-### Table of Content +### NEW FEATURES v20171111 + +* **New Brook Protocol, TCP/UDP full supported** +* Brook Stream Protocol, TCP/UDP full supported +* Shadowsocks Protocol, TCP/UDP full supported + +### BREAKING CHANGE v20171111 + +* Rename orignal brook protocol to `Brook Stream`, `$ brook streamserver`, `$ brook streamclient`. Music removed +* Many command arguments changed +* If you use shadowsocks protocol on Brook Android, your shadowsocks server must full support UDP + +### Table of Contents * [What is Brook](#what-is-brook) * [Download](#download) @@ -30,20 +42,20 @@ Brook's goal is to reduce the configuration steps. Keep it simple, stupid. | Download | Server/Client | OS | Arch | Remark | | --- | --- | --- | --- | --- | -| [brook](https://github.com/txthinking/brook/releases/download/v20170909/brook) | Server & Client | Linux | amd64 | CLI | -| [brook_linux_386](https://github.com/txthinking/brook/releases/download/v20170909/brook_linux_386) | Server & Client | Linux | 386 | CLI | -| [brook_linux_arm64](https://github.com/txthinking/brook/releases/download/v20170909/brook_linux_arm64) | Server & Client | Linux | arm64 | CLI | -| [brook_linux_arm5](https://github.com/txthinking/brook/releases/download/v20170909/brook_linux_arm5) | Server & Client | Linux | arm5 | CLI | -| [brook_linux_arm6](https://github.com/txthinking/brook/releases/download/v20170909/brook_linux_arm6) | Server & Client | Linux | arm6 | CLI | -| [brook_linux_arm7](https://github.com/txthinking/brook/releases/download/v20170909/brook_linux_arm7) | Server & Client | Linux | arm7 | CLI | -| [brook_macos_amd64](https://github.com/txthinking/brook/releases/download/v20170909/brook_macos_amd64) | Server & Client | MacOS | amd64 | CLI | -| [brook_windows_amd64.exe](https://github.com/txthinking/brook/releases/download/v20170909/brook_windows_amd64.exe) | Server & Client | Windows | amd64 | CLI | -| [brook_windows_386.exe](https://github.com/txthinking/brook/releases/download/v20170909/brook_windows_386.exe) | Server & Client | Windows | 386 | CLI | -| [Brook.app.zip](https://github.com/txthinking/brook/releases/download/v20170909/Brook.app.zip) | Client | MacOS | amd64 | GUI | -| [Brook.exe](https://github.com/txthinking/brook/releases/download/v20170909/Brook.exe) | Client | Windows | amd64 | GUI | -| [Brook.386.exe](https://github.com/txthinking/brook/releases/download/v20170909/Brook.386.exe) | Client | Windows | 386 | GUI | +| [brook](https://github.com/txthinking/brook/releases/download/v20171111/brook) | Server & Client | Linux | amd64 | CLI | +| [brook_linux_386](https://github.com/txthinking/brook/releases/download/v20171111/brook_linux_386) | Server & Client | Linux | 386 | CLI | +| [brook_linux_arm64](https://github.com/txthinking/brook/releases/download/v20171111/brook_linux_arm64) | Server & Client | Linux | arm64 | CLI | +| [brook_linux_arm5](https://github.com/txthinking/brook/releases/download/v20171111/brook_linux_arm5) | Server & Client | Linux | arm5 | CLI | +| [brook_linux_arm6](https://github.com/txthinking/brook/releases/download/v20171111/brook_linux_arm6) | Server & Client | Linux | arm6 | CLI | +| [brook_linux_arm7](https://github.com/txthinking/brook/releases/download/v20171111/brook_linux_arm7) | Server & Client | Linux | arm7 | CLI | +| [brook_macos_amd64](https://github.com/txthinking/brook/releases/download/v20171111/brook_macos_amd64) | Server & Client | MacOS | amd64 | CLI | +| [brook_windows_amd64.exe](https://github.com/txthinking/brook/releases/download/v20171111/brook_windows_amd64.exe) | Server & Client | Windows | amd64 | CLI | +| [brook_windows_386.exe](https://github.com/txthinking/brook/releases/download/v20171111/brook_windows_386.exe) | Server & Client | Windows | 386 | CLI | +| [Brook.app.zip](https://github.com/txthinking/brook/releases/download/v20171111/Brook.app.zip) | Client | MacOS | amd64 | GUI | +| [Brook.exe](https://github.com/txthinking/brook/releases/download/v20171111/Brook.exe) | Client | Windows | amd64 | GUI | +| [Brook.386.exe](https://github.com/txthinking/brook/releases/download/v20171111/Brook.386.exe) | Client | Windows | 386 | GUI | | [App Store](https://itunes.apple.com/us/app/brook-brook-shadowsocks-vpn-proxy/id1216002642) | Client | iOS | - | GUI | -| [Google Play](https://play.google.com/store/apps/details?id=com.txthinking.brook) / [Brook.apk](https://github.com/txthinking/brook/releases/download/v20170909/Brook.apk) | Client | Android | - | GUI | +| [Google Play](https://play.google.com/store/apps/details?id=com.txthinking.brook) / [Brook.apk](https://github.com/txthinking/brook/releases/download/v20171111/Brook.apk) | Client | Android | - | GUI | MacOS GUI Client @@ -61,7 +73,6 @@ Windows GUI Client Android Client -* Need Android version >= 5.0 * Follow this [pac white list](https://github.com/txthinking/pac) auto proxy rule * Not tested on IPv6 @@ -80,27 +91,30 @@ USAGE: brook [global options] command [command options] [arguments...] VERSION: - 20170909 + 20171111 AUTHOR: Cloud COMMANDS: - server Run as server mode - servers Run as multiple servers mode - client Run as client mode - ssserver Run as shadowsocks server mode, fixed method is aes-256-cfb - ssservers Run as shadowsocks multiple servers mode, fixed method is aes-256-cfb - ssclient Run as shadowsocks client mode, fixed method is aes-256-cfb - relay Run as relay mode - relays Run as multiple relays mode - qr Print brook server QR code - socks5 Run as raw socks5 server - socks5tohttp Convert socks5 to http proxy - help, h Shows a list of commands or help for one command + server Run as server mode + servers Run as multiple servers mode + client Run as client mode + streamserver Run as server mode + streamservers Run as multiple servers mode + streamclient Run as client mode + ssserver Run as shadowsocks server mode, fixed method is aes-256-cfb + ssservers Run as shadowsocks multiple servers mode, fixed method is aes-256-cfb + ssclient Run as shadowsocks client mode, fixed method is aes-256-cfb + socks5 Run as raw socks5 server + relay Run as relay mode + relays Run as multiple relays mode + qr Print brook server QR code + socks5tohttp Convert socks5 to http proxy + help, h Shows a list of commands or help for one command GLOBAL OPTIONS: - --debug, -d Enable debug, more logs + --debug, -d Enable debug --listen value, -l value Listen address for debug (default: ":6060") --help, -h show help --version, -v print the version @@ -110,12 +124,12 @@ GLOBAL OPTIONS: ``` # Run as a brook server -$ brook bkserver -l :9999 -p password -t 10 +$ brook server -l :9999 -p password ``` ``` -# Run as a brook server with music -$ brook bkserver -l :9999 -p password -t 10 -m music_name +# Run as a brook stream server +$ brook streamserver -l :9999 -p password ``` ``` @@ -123,33 +137,26 @@ $ brook bkserver -l :9999 -p password -t 10 -m music_name $ brook bkservers \ -l ":9999 password" \ -l ":8888 password" \ - -l ":7777 password music_name" \ - -l ":6666 password music_name" \ -t 10 ``` -[More about Brook Music](https://github.com/txthinking/brook/wiki/Music-List) - -> If you run a public/shared server, do not forget this parameter --deadline 60 or -d 60 - #### Shadowsocks Server ``` # Run as a shadowsocks server -$ brook ssserver -l :9999 -p password -t 10 +$ brook ssserver -l :9999 -p password ``` ``` # Run as multiple shadowsocks servers $ brook ssservers \ -l ":9999 password" \ - -l ":8888 password" \ - -t 10 + -l ":8888 password" ``` Fixed method is aes-256-cfb -> If you run a public/shared server, do not forget this parameter --deadline 60 or -d 60 +> If you run a public/shared server, do not forget this parameter --tcpDeadline #### Run as Daemon @@ -157,7 +164,7 @@ With nohup ``` # Start -$ nohup brook bkserver -l :9999 -p password -t 10 & +$ nohup brook server -l :9999 -p password & # Stop $ killall brook @@ -197,15 +204,14 @@ Relay Server ``` # Run as a relay server -$ brook relay -l :9999 -s server_address:port -t 10 +$ brook relay -l :9999 -r server_address:port ``` ``` # Run as multiple relay servers $ brook relays \ -l ":9999 server1_address:port" \ - -l ":8888 server2_address:port" \ - -t 10 + -l ":8888 server2_address:port" ``` ## Client (CLI) @@ -214,36 +220,35 @@ $ brook relays \ ``` # Run as brook client, start a socks5 proxy -$ brook bkclient -l 127.0.0.1:1080 -s server_address:port -p password +$ brook client -t 127.0.0.1:1080 -u 127.0.0.1:1080 -s server_address:port -p password ``` ``` # Run as brook client, start a http(s) proxy -$ brook bkclient -l 127.0.0.1:8080 -s server_address:port -p password --http +$ brook client -t 127.0.0.1:1080 -u 127.0.0.1:1080 -s server_address:port -p password --http ``` ``` -# Run as brook client with music, music must be same as server's -$ brook bkclient -l 127.0.0.1:1080 -s server_address:port -p password -m muisc_name +# Run as brook stream client, start a socks5 proxy +$ brook streamclient -t 127.0.0.1:1080 -u 127.0.0.1:1080 -s server_address:port -p password ``` +``` +# Run as brook stream client, start a http(s) proxy +$ brook streamclient -t 127.0.0.1:1080 -u 127.0.0.1:1080 -s server_address:port -p password --http +``` + + #### Shadowsocks Client ``` # Run as shadowsocks client, start a socks5 proxy -$ brook ssclient -l 127.0.0.1:1080 -s server_address:port -p password +$ brook ssclient -t 127.0.0.1:1080 -u 127.0.0.1:1080 -s server_address:port -p password ``` ``` # Run as shadowsocks client, start a http(s) proxy -$ brook ssclient -l 127.0.0.1:8080 -s server_address:port -p password --http -``` - -## Developer - -``` -$ go get github.com/txthinking/brook/cli/brook -$ brook -h +$ brook ssclient -t 127.0.0.1:1080 -u 127.0.0.1:1080 -s server_address:port -p password --http ``` #### Contributing diff --git a/cli/brook/main.go b/cli/brook/main.go index 9baefafde..1d10dfee4 100644 --- a/cli/brook/main.go +++ b/cli/brook/main.go @@ -19,7 +19,7 @@ var debugAddress string func main() { app := cli.NewApp() app.Name = "Brook" - app.Version = "20170909" + app.Version = "20171111" app.Usage = "A Cross-Platform Proxy Software" app.Author = "Cloud" app.Email = "cloud@txthinking.com" @@ -50,17 +50,17 @@ func main() { Usage: "Server password", }, cli.IntFlag{ - Name: "tcpTimeout, t", + Name: "tcpTimeout", Value: 60, Usage: "connection tcp keepalive timeout (s)", }, cli.IntFlag{ - Name: "tcpDeadline, d", + Name: "tcpDeadline", Value: 60, Usage: "connection deadline time (s)", }, cli.IntFlag{ - Name: "udpDeadline, u", + Name: "udpDeadline", Value: 60, Usage: "connection deadline time (s)", }, @@ -85,17 +85,17 @@ func main() { Usage: "server and password, like '0.0.0.0:1080 password'", }, cli.IntFlag{ - Name: "tcpTimeout, t", + Name: "tcpTimeout", Value: 60, Usage: "connection tcp keepalive timeout (s)", }, cli.IntFlag{ - Name: "tcpDeadline, d", + Name: "tcpDeadline", Value: 60, Usage: "connection deadline time (s)", }, cli.IntFlag{ - Name: "udpDeadline, u", + Name: "udpDeadline", Value: 60, Usage: "connection deadline time (s)", }, @@ -129,7 +129,11 @@ func main() { Usage: "Run as client mode", Flags: []cli.Flag{ cli.StringFlag{ - Name: "listen, l", + Name: "tcpListen, t", + Usage: "Client listen address: like: 127.0.0.1:1080", + }, + cli.StringFlag{ + Name: "udpListen, u", Usage: "Client listen address: like: 127.0.0.1:1080", }, cli.StringFlag{ @@ -141,22 +145,22 @@ func main() { Usage: "Server password", }, cli.IntFlag{ - Name: "tcpTimeout, t", + Name: "tcpTimeout", Value: 60, Usage: "connection tcp keepalive timeout (s)", }, cli.IntFlag{ - Name: "tcpDeadline, d", + Name: "tcpDeadline", Value: 60, Usage: "connection deadline time (s)", }, cli.IntFlag{ - Name: "udpDeadline, u", + Name: "udpDeadline", Value: 60, Usage: "connection deadline time (s)", }, cli.IntFlag{ - Name: "udpSessionTime, i", + Name: "udpSessionTime", Value: 60, Usage: "udp session time (s), in most cases need this", }, @@ -166,7 +170,7 @@ func main() { }, }, Action: func(c *cli.Context) error { - if c.String("listen") == "" || c.String("server") == "" || c.String("password") == "" { + if c.String("tcpListen") == "" || c.String("udpListen") == "" || c.String("server") == "" || c.String("password") == "" { cli.ShowCommandHelp(c, "client") return nil } @@ -174,9 +178,9 @@ func main() { enableDebug() } if c.Bool("http") { - return brook.RunClientAsHTTP(c.String("listen"), c.String("server"), c.String("password"), c.Int("tcpTimeout"), c.Int("tcpDeadline"), c.Int("udpDeadline"), c.Int("udpSessionTime")) + return brook.RunClientAsHTTP(c.String("tcpListen"), c.String("udpListen"), c.String("server"), c.String("password"), c.Int("tcpTimeout"), c.Int("tcpDeadline"), c.Int("udpDeadline"), c.Int("udpSessionTime")) } - return brook.RunClient(c.String("listen"), c.String("server"), c.String("password"), c.Int("tcpTimeout"), c.Int("tcpDeadline"), c.Int("udpDeadline"), c.Int("udpSessionTime")) + return brook.RunClient(c.String("tcpListen"), c.String("udpListen"), c.String("server"), c.String("password"), c.Int("tcpTimeout"), c.Int("tcpDeadline"), c.Int("udpDeadline"), c.Int("udpSessionTime")) }, }, cli.Command{ @@ -192,17 +196,17 @@ func main() { Usage: "Server password", }, cli.IntFlag{ - Name: "tcpTimeout, t", + Name: "tcpTimeout", Value: 60, Usage: "connection tcp keepalive timeout (s)", }, cli.IntFlag{ - Name: "tcpDeadline, d", + Name: "tcpDeadline", Value: 0, Usage: "connection deadline time (s)", }, cli.IntFlag{ - Name: "udpDeadline, u", + Name: "udpDeadline", Value: 60, Usage: "connection deadline time (s)", }, @@ -227,17 +231,17 @@ func main() { Usage: "server and password, like '0.0.0.0:1080 password'", }, cli.IntFlag{ - Name: "tcpTimeout, t", + Name: "tcpTimeout", Value: 60, Usage: "connection tcp keepalive timeout (s)", }, cli.IntFlag{ - Name: "tcpDeadline, d", + Name: "tcpDeadline", Value: 0, Usage: "connection deadline time (s)", }, cli.IntFlag{ - Name: "udpDeadline, u", + Name: "udpDeadline", Value: 60, Usage: "connection deadline time (s)", }, @@ -271,7 +275,11 @@ func main() { Usage: "Run as client mode", Flags: []cli.Flag{ cli.StringFlag{ - Name: "listen, l", + Name: "tcpListen, t", + Usage: "Client listen address: like: 127.0.0.1:1080", + }, + cli.StringFlag{ + Name: "udpListen, u", Usage: "Client listen address: like: 127.0.0.1:1080", }, cli.StringFlag{ @@ -283,22 +291,22 @@ func main() { Usage: "Server password", }, cli.IntFlag{ - Name: "tcpTimeout, t", + Name: "tcpTimeout", Value: 60, Usage: "connection tcp keepalive timeout (s)", }, cli.IntFlag{ - Name: "tcpDeadline, d", + Name: "tcpDeadline", Value: 0, Usage: "connection deadline time (s)", }, cli.IntFlag{ - Name: "udpDeadline, u", + Name: "udpDeadline", Value: 60, Usage: "connection deadline time (s)", }, cli.IntFlag{ - Name: "udpSessionTime, i", + Name: "udpSessionTime", Value: 60, Usage: "udp session time (s), in most cases need this", }, @@ -308,7 +316,7 @@ func main() { }, }, Action: func(c *cli.Context) error { - if c.String("listen") == "" || c.String("server") == "" || c.String("password") == "" { + if c.String("tcpListen") == "" || c.String("udpListen") == "" || c.String("server") == "" || c.String("password") == "" { cli.ShowCommandHelp(c, "streamclient") return nil } @@ -316,9 +324,9 @@ func main() { enableDebug() } if c.Bool("http") { - return brook.RunStreamClientAsHTTP(c.String("listen"), c.String("server"), c.String("password"), c.Int("tcpTimeout"), c.Int("tcpDeadline"), c.Int("udpDeadline"), c.Int("udpSessionTime")) + return brook.RunStreamClientAsHTTP(c.String("tcpListen"), c.String("udpListen"), c.String("server"), c.String("password"), c.Int("tcpTimeout"), c.Int("tcpDeadline"), c.Int("udpDeadline"), c.Int("udpSessionTime")) } - return brook.RunStreamClient(c.String("listen"), c.String("server"), c.String("password"), c.Int("tcpTimeout"), c.Int("tcpDeadline"), c.Int("udpDeadline"), c.Int("udpSessionTime")) + return brook.RunStreamClient(c.String("tcpListen"), c.String("udpListen"), c.String("server"), c.String("password"), c.Int("tcpTimeout"), c.Int("tcpDeadline"), c.Int("udpDeadline"), c.Int("udpSessionTime")) }, }, cli.Command{ @@ -334,17 +342,17 @@ func main() { Usage: "Server password", }, cli.IntFlag{ - Name: "tcpTimeout, t", + Name: "tcpTimeout", Value: 60, Usage: "connection tcp keepalive timeout (s)", }, cli.IntFlag{ - Name: "tcpDeadline, d", + Name: "tcpDeadline", Value: 0, Usage: "connection deadline time (s)", }, cli.IntFlag{ - Name: "udpDeadline, u", + Name: "udpDeadline", Value: 60, Usage: "connection deadline time (s)", }, @@ -369,17 +377,17 @@ func main() { Usage: "server address and password, like '0.0.0.0:1080 password'", }, cli.IntFlag{ - Name: "tcpTimeout, t", + Name: "tcpTimeout", Value: 60, Usage: "connection tcp keepalive timeout (s)", }, cli.IntFlag{ - Name: "tcpDeadline, d", + Name: "tcpDeadline", Value: 0, Usage: "connection deadline time (s)", }, cli.IntFlag{ - Name: "udpDeadline, u", + Name: "udpDeadline", Value: 60, Usage: "connection deadline time (s)", }, @@ -413,7 +421,11 @@ func main() { Usage: "Run as shadowsocks client mode, fixed method is aes-256-cfb", Flags: []cli.Flag{ cli.StringFlag{ - Name: "listen, l", + Name: "tcpListen, t", + Usage: "Client listen address: like: 127.0.0.1:1080", + }, + cli.StringFlag{ + Name: "udpListen, u", Usage: "Client listen address: like: 127.0.0.1:1080", }, cli.StringFlag{ @@ -425,22 +437,22 @@ func main() { Usage: "Server password", }, cli.IntFlag{ - Name: "tcpTimeout, t", + Name: "tcpTimeout", Value: 60, Usage: "connection tcp keepalive timeout (s)", }, cli.IntFlag{ - Name: "tcpDeadline, d", + Name: "tcpDeadline", Value: 0, Usage: "connection deadline time (s)", }, cli.IntFlag{ - Name: "udpDeadline, u", + Name: "udpDeadline", Value: 60, Usage: "connection deadline time (s)", }, cli.IntFlag{ - Name: "udpSessionTime, i", + Name: "udpSessionTime", Value: 60, Usage: "udp session time (s), in most cases need this", }, @@ -450,7 +462,7 @@ func main() { }, }, Action: func(c *cli.Context) error { - if c.String("listen") == "" || c.String("server") == "" || c.String("password") == "" { + if c.String("tcpListen") == "" || c.String("udpListen") == "" || c.String("server") == "" || c.String("password") == "" { cli.ShowCommandHelp(c, "ssclient") return nil } @@ -458,9 +470,9 @@ func main() { enableDebug() } if c.Bool("http") { - return brook.RunSSClientAsHTTP(c.String("listen"), c.String("server"), c.String("password"), c.Int("tcpTimeout"), c.Int("tcpDeadline"), c.Int("udpDeadline"), c.Int("udpSessionTime")) + return brook.RunSSClientAsHTTP(c.String("tcpListen"), c.String("udpListen"), c.String("server"), c.String("password"), c.Int("tcpTimeout"), c.Int("tcpDeadline"), c.Int("udpDeadline"), c.Int("udpSessionTime")) } - return brook.RunSSClient(c.String("listen"), c.String("server"), c.String("password"), c.Int("tcpTimeout"), c.Int("tcpDeadline"), c.Int("udpDeadline"), c.Int("udpSessionTime")) + return brook.RunSSClient(c.String("tcpListen"), c.String("udpListen"), c.String("server"), c.String("password"), c.Int("tcpTimeout"), c.Int("tcpDeadline"), c.Int("udpDeadline"), c.Int("udpSessionTime")) }, }, cli.Command{ @@ -468,47 +480,51 @@ func main() { Usage: "Run as raw socks5 server", Flags: []cli.Flag{ cli.StringFlag{ - Name: "listen, l", + Name: "tcpListen, t", Usage: "Client listen address: like: 127.0.0.1:1080", }, cli.StringFlag{ - Name: "username, u", + Name: "udpListen, u", + Usage: "Client listen address: like: 127.0.0.1:1080", + }, + cli.StringFlag{ + Name: "username", Usage: "User name, optional", }, cli.StringFlag{ - Name: "password, p", + Name: "password", Usage: "Password, optional", }, cli.IntFlag{ - Name: "tcpTimeout, t", + Name: "tcpTimeout", Value: 60, Usage: "connection tcp keepalive timeout (s)", }, cli.IntFlag{ - Name: "tcpDeadline, d", + Name: "tcpDeadline", Value: 0, Usage: "connection deadline time (s)", }, cli.IntFlag{ - Name: "udpDeadline, e", + Name: "udpDeadline", Value: 60, Usage: "connection deadline time (s)", }, cli.IntFlag{ - Name: "udpSessionTime, i", + Name: "udpSessionTime", Value: 60, Usage: "udp session time (s), in most cases need this", }, }, Action: func(c *cli.Context) error { - if c.String("listen") == "" { + if c.String("tcpListen") == "" || c.String("udpListen") == "" { cli.ShowCommandHelp(c, "socks5") return nil } if debug { enableDebug() } - return brook.RunSocks5Server(c.String("listen"), c.String("username"), c.String("password"), c.Int("tcpTimeout"), c.Int("tcpDeadline"), c.Int("udpDeadline"), c.Int("udpSessionTime")) + return brook.RunSocks5Server(c.String("tcpListen"), c.String("udpListen"), c.String("username"), c.String("password"), c.Int("tcpTimeout"), c.Int("tcpDeadline"), c.Int("udpDeadline"), c.Int("udpSessionTime")) }, }, cli.Command{ @@ -524,17 +540,17 @@ func main() { Usage: "Server address, like: 1.2.3.4:1080", }, cli.IntFlag{ - Name: "tcpTimeout, t", + Name: "tcpTimeout", Value: 60, Usage: "connection tcp keepalive timeout (s)", }, cli.IntFlag{ - Name: "tcpDeadline, d", + Name: "tcpDeadline", Value: 0, Usage: "connection deadline time (s)", }, cli.IntFlag{ - Name: "udpDeadline, u", + Name: "udpDeadline", Value: 60, Usage: "connection deadline time (s)", }, @@ -559,17 +575,17 @@ func main() { Usage: "listen address and server address, like '0.0.0.0:1080 1.2.3.4:1080'", }, cli.IntFlag{ - Name: "tcpTimeout, t", + Name: "tcpTimeout", Value: 60, Usage: "connection tcp keepalive timeout (s)", }, cli.IntFlag{ - Name: "tcpDeadline, d", + Name: "tcpDeadline", Value: 0, Usage: "connection deadline time (s)", }, cli.IntFlag{ - Name: "udpDeadline, u", + Name: "udpDeadline", Value: 60, Usage: "connection deadline time (s)", }, @@ -610,13 +626,17 @@ func main() { Name: "password, p", Usage: "Server password", }, + cli.BoolFlag{ + Name: "stream", + Usage: "Brook stream or not", + }, }, Action: func(c *cli.Context) error { if c.String("server") == "" || c.String("password") == "" { cli.ShowCommandHelp(c, "qr") return nil } - brook.QR(c.String("server"), c.String("password")) + brook.QR(c.Bool("stream"), c.String("server"), c.String("password")) return nil }, }, @@ -633,12 +653,12 @@ func main() { Usage: "Socks5 address", }, cli.IntFlag{ - Name: "timeout, t", + Name: "timeout", Value: 60, Usage: "connection tcp keepalive timeout (s)", }, cli.IntFlag{ - Name: "deadline, d", + Name: "deadline", Value: 0, Usage: "connection deadline time (s)", }, diff --git a/client.go b/client.go index 37a310db1..99c810240 100644 --- a/client.go +++ b/client.go @@ -27,8 +27,8 @@ type Client struct { } // NewClient returns a new Client -func NewClient(addr, server, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) (*Client, error) { - s5, err := socks5.NewClassicServer(addr, "", "", tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime) +func NewClient(addr, udpAddr, server, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) (*Client, error) { + s5, err := socks5.NewClassicServer(addr, udpAddr, "", "", tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime) if err != nil { return nil, err } @@ -114,7 +114,6 @@ func (x *Client) TCPHandle(s *socks5.Server, c *net.TCPConn, r *socks5.Request) go func() { n := make([]byte, 12) if _, err := io.ReadFull(rc, n); err != nil { - log.Println(err) return } k, err := GetKey(x.Password, n) @@ -126,17 +125,14 @@ func (x *Client) TCPHandle(s *socks5.Server, c *net.TCPConn, r *socks5.Request) for { if x.TCPDeadline != 0 { if err := rc.SetDeadline(time.Now().Add(time.Duration(x.TCPDeadline) * time.Second)); err != nil { - log.Println(err) return } } b, n, err = ReadFrom(rc, k, n, false) if err != nil { - log.Println(err) return } if _, err := c.Write(b); err != nil { - log.Println(err) return } } @@ -146,25 +142,22 @@ func (x *Client) TCPHandle(s *socks5.Server, c *net.TCPConn, r *socks5.Request) for { if x.TCPDeadline != 0 { if err := c.SetDeadline(time.Now().Add(time.Duration(x.TCPDeadline) * time.Second)); err != nil { - log.Println(err) return nil } } i, err := c.Read(b[:]) if err != nil { - log.Println(err) return nil } n, err = WriteTo(rc, b[0:i], k, n, false) if err != nil { - log.Println(err) return nil } } return nil } if r.Cmd == socks5.CmdUDP { - caddr, err := r.UDP(c, x.Server.ServerAddr) + caddr, err := r.UDP(c, x.Server.UDPAddr) if err != nil { return err } @@ -302,6 +295,7 @@ func (x *Client) ListenAndServeHTTP(m HTTPMiddleman) error { // HTTPHandle handle http request func (x *Client) HTTPHandle(c *net.TCPConn) error { + log.Println("Got http connection") b := make([]byte, 0, 1024) for { var b1 [1024]byte @@ -394,7 +388,6 @@ func (x *Client) HTTPHandle(c *net.TCPConn) error { go func() { n := make([]byte, 12) if _, err := io.ReadFull(rc, n); err != nil { - log.Println(err) return } k, err := GetKey(x.Password, n) @@ -406,17 +399,14 @@ func (x *Client) HTTPHandle(c *net.TCPConn) error { for { if x.TCPDeadline != 0 { if err := rc.SetDeadline(time.Now().Add(time.Duration(x.TCPDeadline) * time.Second)); err != nil { - log.Println(err) return } } b, n, err = ReadFrom(rc, k, n, false) if err != nil { - log.Println(err) return } if _, err := c.Write(b); err != nil { - log.Println(err) return } } @@ -426,18 +416,15 @@ func (x *Client) HTTPHandle(c *net.TCPConn) error { for { if x.TCPDeadline != 0 { if err := c.SetDeadline(time.Now().Add(time.Duration(x.TCPDeadline) * time.Second)); err != nil { - log.Println(err) return nil } } i, err := c.Read(bf[:]) if err != nil { - log.Println(err) return nil } n, err = WriteTo(rc, bf[0:i], k, n, false) if err != nil { - log.Println(err) return nil } } diff --git a/encrypt.go b/encrypt.go index e25c1d480..0b8314c81 100644 --- a/encrypt.go +++ b/encrypt.go @@ -51,6 +51,7 @@ func ReadFrom(c *net.TCPConn, k, n []byte, hasTime bool) ([]byte, []byte, error) return nil, nil, err } if time.Now().Unix()-int64(i) > 90 { + time.Sleep(time.Duration(ant.Random(1, 60*10)) * time.Second) return nil, nil, errors.New("Expired request") } d = d[10:] @@ -128,6 +129,7 @@ func Decrypt(p, b []byte) (a byte, addr, port, data []byte, err error) { return } if time.Now().Unix()-int64(i) > 90 { + time.Sleep(time.Duration(ant.Random(1, 60*10)) * time.Second) err = errors.New("Expired request") return } diff --git a/gui/bindata_assetfs.go b/gui/bindata_assetfs.go index 881c948a7..b330943a6 100644 --- a/gui/bindata_assetfs.go +++ b/gui/bindata_assetfs.go @@ -35709,7 +35709,7 @@ func publicBower_componentsWebcomponentsjsWebcomponentsMinJs() (*asset, error) { return a, nil } -var _publicComponentsXSettingHtml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xd4\x57\xdf\x8f\xe2\x36\x10\x7e\xdf\xbf\xc2\xb5\x2a\x6d\xd0\x6d\xc2\xde\xf6\x87\x4e\x1c\xa1\x6a\xef\xa9\x6a\x4f\x3d\x95\x3e\x9e\x54\x99\x78\x02\x2e\x8e\x6d\x79\x06\x58\xb4\xe2\x7f\xaf\x9c\x90\x25\x90\x04\xd8\x6d\x55\xf5\xf2\xb2\x76\xfc\xcd\x37\x33\x9f\x67\x26\xec\x58\x2b\xb3\x64\x1e\x74\xca\x55\xe1\xac\x27\xce\x16\x1e\xf2\x94\x0f\x67\x76\x03\xfe\xcf\xcc\x16\xce\x1a\x30\x84\x43\x67\xf5\xb6\x00\x5f\xff\x4d\x16\x54\x68\x3e\xb9\x79\x09\x83\x70\xe0\x63\xe9\xad\x93\x76\x63\xe2\x02\xcc\xaa\xeb\xdd\xab\x99\x1b\x84\xff\x88\x47\x11\x14\x8d\xe5\xab\x79\x66\x2b\x22\x6b\x8e\x36\xaf\x8f\xc9\xb8\x15\x35\xd7\xaf\x66\x22\x2b\x90\x9a\xeb\x67\x26\x69\x8b\xb8\xb0\x72\xa5\x81\x29\x99\xf2\xc7\x18\x81\x48\x99\x39\x9f\xdc\x30\xc6\xd8\x98\xa0\x70\x5a\x10\x54\xdb\xf2\x55\xc7\xf5\x31\x2d\x66\x21\x9a\x3f\xb6\x0e\xf8\x01\xda\x80\x97\xa8\x4c\x0b\xc4\x94\x3f\x9b\x66\xd6\x10\x18\xe2\x4c\x10\xf9\x38\xb7\x3e\x46\xd0\x90\x11\xc8\x94\x1b\x51\x00\x67\x87\xfd\xd3\x93\x4d\x02\xfd\x6e\x77\xe2\xa0\xe1\x24\xdc\x1c\x0b\x86\x29\x9f\x2d\xf9\xe4\x27\x6f\xed\x72\xdc\xb8\xd5\x6b\x0c\x11\xf9\x64\xba\x10\xd2\x6e\xd0\x66\x4b\xec\x37\x1f\x37\xca\xae\xa1\x4e\x57\x75\xb7\xc4\x2b\x6f\xb3\x16\x6d\x0a\x7e\x0d\x9e\x33\x85\x29\x57\xde\x9a\xea\x94\xb3\xb5\xd0\x2b\xa8\x12\xaf\x20\xbb\x1d\x67\x4e\x8b\x0c\x16\x56\x4b\xf0\x29\x7f\x9b\x3c\x24\xdf\x24\xdf\x8e\xde\xdd\xbf\xbb\xe7\x93\x71\xb3\x54\xce\xbb\xfc\x24\x10\x37\xd6\xcb\xb3\x4e\x6b\x50\xcb\xed\xd6\xae\x3c\xc3\x32\x24\xe6\x6a\xa6\x5e\xf7\x75\x05\x95\xae\x42\xb9\xa9\x9c\x33\x95\x07\x1f\x0a\xa7\xd3\xa8\xba\xd6\xc1\xd1\xbd\x76\xc5\xfc\x11\x68\x61\x25\x67\x52\xa1\x98\x69\x90\x7d\xa1\x0b\xc0\xf8\xe1\xbb\xef\xe3\x2c\x9f\xf5\x07\x35\xec\xa8\x6b\xa9\xd6\x0c\x69\xab\x21\xe5\x04\x8f\x14\x0b\xad\xe6\x66\x94\x81\x21\xf0\xdd\x45\x5d\xf5\x37\xf3\x42\x21\x48\x66\x4d\x9c\x69\x95\x2d\x53\x3e\xb7\x7c\x32\x15\x6b\x18\x1f\xcd\x81\xa6\x7b\xa9\xd6\xad\x6c\xcb\xc6\x2c\xbb\xb0\x5c\xf1\x49\xf3\xfd\xbe\x1d\x4f\xe2\x1e\x63\xe6\x95\x6b\x24\xf6\xa9\x1a\xd4\xd1\xd3\x51\xb8\x0a\x47\xac\xd1\xda\x77\x47\x87\xce\x5b\x07\x9e\x14\xe0\x88\x1d\x9b\xed\x8e\x81\x1e\x84\xdc\x8e\x58\xbe\x32\x19\x29\x6b\xa2\xc1\x53\xab\x9d\x68\xa1\x30\xb1\x2c\x65\xed\xa3\xf0\x54\xf3\x61\xc4\x42\x77\xde\x75\x23\xf6\xcd\x30\x62\xbc\x0f\xf1\x5c\xbb\x67\x30\xbf\xda\x4c\xe8\x00\xd0\x61\x91\xd0\x23\x2d\x94\x59\x2a\x33\x4f\x32\x5b\x8c\xde\x86\x76\x69\x5b\xee\xde\x77\xe7\xa3\x8c\xa2\x68\xf0\xfe\x9c\x34\x01\x72\x85\x32\x01\x36\xad\x2e\xe1\x12\x21\x96\xc3\xab\xc1\x49\xae\x83\xd5\x03\xad\xbc\x61\xe4\x58\x9a\xa6\xa5\xac\x17\x58\xa7\xd3\x17\x52\x22\x5e\xa0\x3c\xa4\x74\x5e\x80\xb5\x08\x33\x43\xe7\x2c\x2d\xb5\x68\x6b\xfd\x7b\x32\x07\x8a\x6e\x87\xfb\x2a\xbd\x1d\xb4\x10\x09\x06\xc0\x8f\x59\x06\x8e\x6e\xef\xd8\xad\x70\x4e\xab\x4c\x04\x8f\xc3\xbf\xd0\x9a\x5e\x93\x0f\xd5\x77\x26\x0e\xe5\x77\xad\xe1\x46\xd1\xe2\x83\x07\x09\x86\x94\xd0\x18\x75\x40\xc0\xc8\xe8\x39\x65\xf0\xfe\x8e\x79\xc0\x8e\xd4\xc3\x83\x1b\x45\xd9\x22\xf2\x80\x09\x92\xa0\x15\x0e\x7a\x7a\x24\x13\x08\xec\xe1\xfe\x7e\xd4\x79\x5a\x52\x81\xce\xcb\x26\x0b\x64\x33\x2b\xb7\x6d\x2d\x8f\xa1\x49\xd9\x0e\x2c\x3d\xd7\x0e\xfd\x1c\x2a\x8f\xf6\x34\x41\xbe\xaa\x2a\x78\x4f\x96\x27\x7e\x2b\x83\x8e\xba\x6c\x3e\xbb\xde\x93\x99\x07\xb1\xec\x36\x94\x90\x8b\x95\xa6\x0b\x22\x7d\x9d\x54\x3f\x76\xc2\x38\xdf\xeb\x15\x96\x17\xf4\xaa\xad\xac\x03\x73\xda\xa6\x57\x86\xd7\xce\x69\x77\xbe\xdf\xe7\xf6\x9a\xc1\x5a\x0b\xda\xd8\x25\xe4\x55\xd1\x15\xe5\x1e\x53\xcd\xd3\x83\x4d\xb5\xef\xb5\x52\x79\xf4\xd5\x30\x79\xf3\xc3\xe7\xd1\x67\xf9\x66\x98\x10\x20\x45\x47\x96\x83\x9e\x9b\x2f\x41\x27\x7a\xef\x87\x39\xfb\xd9\xac\x85\x56\xb2\xa7\x06\x8e\x2c\xcf\x69\x5e\x4d\xa6\xf6\x59\x5b\xec\x7d\xc4\xf5\x97\xe2\x90\x7d\xfd\xe6\x6c\xfe\x27\xd8\x97\x24\xfc\x51\x21\x22\x7b\xfe\x42\xfd\xd7\x09\xd7\x7d\xde\xdc\xf6\xa6\x7a\xc5\x40\x76\x16\xbf\xac\x89\x8c\x61\x24\x57\xd9\xff\xcf\xe6\xf5\x69\xa5\xfc\xf6\xcb\x99\x91\xf8\x6f\x8d\xa1\x2f\x7f\x4a\xde\x9c\x9e\x8c\x87\xf5\x4f\xde\xf1\xf0\xf0\xbf\xeb\xe4\xe6\xe6\xef\x00\x00\x00\xff\xff\xb2\xc7\xf2\xaa\xd6\x10\x00\x00") +var _publicComponentsXSettingHtml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xd4\x58\xdd\x8e\xdb\x36\x13\xbd\xdf\xa7\x98\x8f\x5f\x81\x95\x91\xb5\xec\xa4\xed\x22\x50\x2c\x07\x69\xf6\x26\x28\x92\x2e\xea\xe4\x2e\x40\x41\x8b\x63\x9b\x35\x45\x0a\x24\x65\xc7\x48\xfc\xee\x05\x25\xd9\xa6\xac\x9f\xf5\x6e\x80\xa2\xe1\x8d\x45\xf1\xcc\x99\x21\x39\x73\x66\xb5\x13\xc1\xe5\x1a\x34\x8a\x98\xf0\x34\x53\xda\x12\x58\x69\x5c\xc4\x64\x34\x57\x5b\xd4\x7f\x25\x2a\xcd\x94\x44\x69\xcd\x28\x53\x62\x97\xa2\x3e\xfc\x86\x2b\x9b\x0a\x32\xbd\x7a\x0c\x03\xcd\x50\x0f\x99\x56\x19\x53\x5b\x39\x4c\x51\xe6\x6d\xef\x9e\xcc\xec\x11\x7e\x17\x0f\xb7\x98\x7a\x8f\x4f\xe6\x99\xe7\xd6\x2a\x59\x9b\x3c\x3d\x26\x99\xe5\xd6\x7f\x7e\x32\x93\x55\xd4\x58\xff\xf9\xc8\xc4\x54\x3a\x4c\x15\xcb\x05\x02\x67\x31\xf9\x32\x34\x68\x2d\x97\x4b\x32\xbd\x02\x00\x98\x58\x4c\x33\x41\x2d\x96\xd3\xe2\x95\xb1\x3b\xe1\xcd\xdd\xf0\xb7\x0b\x5f\x6b\x4b\x6e\xcc\x69\xb2\x5e\x6a\x95\x4b\x36\x4c\x94\x50\x3a\x82\xff\x8f\x8b\xf1\xaa\x01\x3d\xac\x2f\x8a\x51\x5f\xdf\x9f\x62\x18\x9d\x05\x31\x69\xc9\x29\x10\x74\xee\x8e\xe8\xe3\x2e\x43\x52\x8f\x77\x72\xca\x18\x48\x04\x35\x26\x26\x47\xd3\x44\x49\x8b\xd2\x12\xa0\xd6\xea\xe1\x42\xe9\xa1\x41\x81\x89\x45\x16\x13\x49\x53\x24\x70\x9a\x7f\xfd\xaa\x42\x47\xbf\xdf\x9f\x39\xf0\x9c\xb8\x74\x02\x67\x18\x93\xdf\xb4\x52\x6b\x32\x2d\x7e\x26\x5e\xb6\x5d\x6c\x0b\x33\xab\x91\xa6\x15\x45\x35\x7b\x2c\xd3\x6c\x45\x99\xda\x1a\x95\xac\x0d\x99\x7a\x93\x6e\x9e\x89\x57\x61\xde\x99\xb7\x15\x72\xe3\x4a\x8a\xc4\x3d\x5c\xc5\x0c\xf5\x06\x35\x01\x6e\x62\xc2\xb5\x92\xe5\x2a\x81\x0d\x15\x39\x96\xc7\x59\x42\xf6\x7b\x02\x99\xa0\x09\xae\x94\x60\xa8\x63\xf2\x3c\x7c\x11\xfe\x1c\xfe\x12\xbd\x1c\xbf\x1c\x93\xe9\xc4\xaf\x8a\x7e\x97\xf7\xd4\x98\xad\xd2\xac\xd7\xe9\x01\xd4\x70\xbb\x53\xb9\x06\x53\x84\x04\xd9\x81\xe9\x31\xee\x3f\xdd\xdd\xc3\x0c\x8d\xe1\x4a\xc2\x47\x9e\x62\x60\x06\x04\xec\x2e\xc3\x98\xc8\x3c\x9d\x3f\x70\x18\x9f\xee\xee\x2b\x63\x67\xdb\x88\xee\xb6\xe7\x28\x0e\x85\x5b\xd0\xbb\x2a\xe7\x0b\x02\x7c\xe1\x78\xb9\x99\xcd\x82\x32\x71\x07\xb5\xcc\x6d\xdb\xc0\x7b\xb4\x2b\xc5\x08\x30\x6e\xe8\x5c\x20\xeb\x0a\x97\xa2\x19\xbe\xf8\xf5\x76\x98\x2c\xe6\xdd\x41\x8d\x5a\xe4\x84\xf1\x0d\x14\xd5\x1c\x13\x8b\x5f\xec\x90\x0a\xbe\x94\x51\x82\xd2\xa2\x6e\x2f\xdb\x4a\x67\x34\xe5\x06\x19\x28\x39\x4c\x04\x4f\xd6\x31\x59\x2a\x32\x9d\xd1\x0d\x4e\x6a\xf2\xeb\xbb\x67\x7c\xd3\xd8\x6d\xa1\x87\x85\xf8\x15\x4f\x64\xea\xbf\xaf\x54\xf0\x2c\xee\x89\x49\x34\xcf\xbc\x8d\xdd\x97\xfd\x31\xa8\x4b\x1f\x37\x11\x78\x8a\x7a\x53\x97\x4c\xad\x32\xd4\x96\xa3\x89\xce\x14\x73\x5f\x07\x6a\xa4\x6c\x17\xc1\x22\x97\x89\xe5\x4a\x06\x83\xa6\xbe\xda\x15\x37\xa1\x82\xb8\x45\x7a\xdd\x28\x15\x30\x82\x4a\x7f\x6e\xda\x41\x6f\x18\xd3\x68\x8c\xc3\x09\x95\x50\x11\xda\x2f\x76\xc5\xe5\x9a\xcb\x65\x98\xa8\x34\x7a\xee\x2a\xaf\xc3\xb6\xaa\xeb\x08\x48\x17\xe2\x58\x86\x3d\x98\x8f\x6f\xef\x5d\x9a\xab\xdc\x92\x08\x6e\xc7\xdd\xa8\x3b\xa4\x4c\x70\xe9\xf6\xd4\x85\xfa\x74\xe7\xa3\x3a\xc9\xea\x05\xd6\x81\xdc\x37\xdb\x54\x71\xe2\x5c\x72\x1b\x0c\x5e\xf5\x5d\x9e\x83\x5c\x70\x77\x0e\x36\x2b\xd3\xe4\x21\x42\x33\x9b\x79\x84\x36\x6b\xa1\xd4\x68\x73\x2d\xc1\x66\x10\xc7\x31\xd4\xf4\xfe\xc1\x60\xab\x28\xfa\x63\xde\x50\x27\x8a\x62\x01\x71\x11\x7e\xf3\x78\xfe\x0c\x97\x68\x83\xeb\x51\x95\xfa\xd7\x83\x06\x22\x34\x0e\xf0\x26\x49\x30\xb3\xd7\x37\x70\x4d\xb3\x4c\xf0\x84\x3a\x8f\xa3\xbf\x8d\x92\x9d\x26\x6f\xcb\xf6\x3c\x74\x39\x7d\xa9\xe1\x96\xdb\xd5\x5b\x8d\x0c\xa5\xe5\x54\x98\xa0\x05\x82\x92\x05\xc7\x2d\xa3\xd6\x37\xa0\xd1\xb4\x6c\xdd\x0d\xb3\xe5\x36\x59\x05\x1a\x4d\x68\x2c\xb5\xb9\x19\x74\x14\x5e\x42\x0d\xc2\x8b\xf1\x38\x6a\x5d\x2d\xa8\x50\x2c\x8a\xca\x75\x64\x73\xc5\x76\xcd\xb3\x3c\x8c\xb9\x46\xba\x6e\x5f\x66\xb8\xa0\xb9\xb0\x0f\xb8\xf9\x29\x2c\xff\xf4\x73\x2a\x5b\x79\x74\x8f\xdd\x1e\x6b\x56\x2a\x43\x79\x9e\x9b\x17\x86\xb7\x6f\x56\x54\x7f\x92\x2f\xd5\x25\x7a\x57\x34\xb0\x2a\x05\xab\x59\x68\x35\x4f\xdb\xa2\xac\x30\x95\xc6\x9d\x8c\xaa\x17\x0f\xd9\x95\xfa\x76\x32\x2b\xe7\x9d\x56\x7c\x11\xfc\x6f\x14\x3e\x7b\xfd\x39\xfa\xcc\x9e\x8d\x42\x8b\xc6\x06\x35\xcb\x41\x47\x66\x15\xa0\xb3\x7b\xaa\xc4\x15\xde\xc9\x0d\x15\x9c\x91\xf6\x33\xae\x59\xf6\xdd\x55\x29\x0e\xcd\xb5\xe6\x25\x55\x11\x1f\x94\xfb\xb4\xfb\xc3\x9b\xde\xfd\x9f\x61\x1f\xb3\xe1\xf7\xdc\x18\x03\xc7\x8e\xf1\x6f\x6f\xf8\xd4\x86\x20\x06\x6e\x3e\xd0\x0f\x41\x46\xb5\xc1\x77\xf2\x78\x8b\x27\xc8\x60\x00\xaf\x61\x0c\x11\xf4\x40\x3a\xd3\xca\x6b\x65\x7d\xae\x0e\x98\x3e\x5f\x47\x4c\xa7\x33\xaf\x23\x42\xdc\xa0\xf0\x56\x2f\xa5\x68\x8f\xd7\x27\xea\x8a\xf7\x52\x67\x5e\x6b\x6e\x0f\xd9\x03\xb4\xa6\x21\x04\x65\x90\xed\x16\xf0\xed\x5b\x97\xb3\x38\x86\x71\x5f\xca\xb6\x84\x77\xdb\xf2\x35\xdb\xcc\xb1\x0b\x5a\x67\xa6\xcc\x8f\xd5\x3b\x8d\x6b\x9e\xe5\xb1\xfc\xc7\x3a\xeb\xb9\xb2\xfc\xf1\x7b\x87\x9a\x34\x2c\xbe\xa3\xdd\xfd\xf8\xdd\xf8\xea\x7c\x65\x32\x3a\x7c\xf1\x4c\x46\xa7\xff\x18\x4d\xaf\xae\xfe\x09\x00\x00\xff\xff\xda\x25\xab\x9f\x4c\x14\x00\x00") func publicComponentsXSettingHtmlBytes() ([]byte, error) { return bindataRead( @@ -35724,12 +35724,12 @@ func publicComponentsXSettingHtml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "public/components/x-setting.html", size: 4310, mode: os.FileMode(420), modTime: time.Unix(1509262674, 0)} + info := bindataFileInfo{name: "public/components/x-setting.html", size: 5196, mode: os.FileMode(420), modTime: time.Unix(1509549649, 0)} a := &asset{bytes: bytes, info: info} return a, nil } -var _publicIndexHtml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x94\xc1\x92\xd3\x30\x0c\x86\xef\x3c\x85\xf1\x65\x97\x99\x75\x03\x1c\x18\x66\xb0\x3b\x0c\x8f\xc0\x0b\x30\xae\xa3\x36\xea\x3a\xb6\x91\x95\x76\x03\xc3\xbb\x33\x49\xb6\x8d\xdb\x6e\x97\x1e\xf0\xa5\xfd\x65\xe9\x93\x2a\xb9\xd2\x6f\xeb\xe8\xb8\x4f\x20\x1a\x6e\xfd\xf2\x8d\x9e\x3e\x84\x10\x42\x37\x60\xeb\xe9\xeb\x28\x19\xd9\xc3\xf2\x1b\xc5\xf8\xa8\xab\x49\xcc\x97\x2d\xb0\x15\xae\xb1\x94\x81\x8d\xec\x78\xad\x3e\xcb\xf3\xeb\x60\x5b\x30\x72\x87\xb0\x4f\x91\x58\x0a\x17\x03\x43\x60\x23\xf7\x58\x73\x63\x6a\xd8\xa1\x03\x35\x8a\x07\xd1\x62\xc0\xb6\x6b\x55\x76\xd6\x83\xf9\xb0\x78\xff\x20\x30\x20\xa3\xf5\xa5\xa9\xcb\x40\xa3\xb6\x2b\x0f\xa6\x87\x5c\x26\xcd\x8e\x30\xb1\xc8\xe4\x8c\xac\x56\x71\x0f\xf4\xc3\xc5\x36\xc5\x00\x81\x73\xb5\x87\xd5\xac\xb6\x67\x5a\x79\x64\x58\xb4\x18\x16\xdb\x2c\x97\xba\x9a\x50\xd7\xd8\xdb\x5c\xe5\x2e\x01\xd9\x0d\x04\x7e\x3d\x62\x36\x0c\x67\x67\x49\x7c\x17\x46\x10\xfc\xec\x90\xe0\xfe\x6e\xc6\xdc\xbd\xfb\x32\xc7\x1e\x69\xb3\xc9\x63\x78\x14\x04\xde\x48\x6c\xa7\x76\x36\x04\xeb\x97\x7e\x68\xb2\x09\x48\x71\x8c\x7e\x65\xe9\x54\x2d\x86\x69\x97\x2d\xbb\x46\xbd\x80\x22\xc5\xa0\xd6\x1e\x9e\x94\xb7\x7d\xec\xf8\xc2\x70\x40\xdf\x50\x71\x81\x7d\x52\x19\x98\x31\x6c\x2e\x2a\xcb\xdc\x7b\x10\x98\x8d\x74\x5d\xe6\xd8\xaa\xd1\x20\x4f\xfb\xb9\x18\x0b\x68\x22\xe1\xaf\x18\xd8\x7a\xb5\x47\x6e\x14\x59\xc6\x98\xc5\xef\x13\xd7\xe1\x7c\xb5\x29\xf9\xfe\x5e\x3d\x97\x5c\x04\x16\xcd\x1f\xce\x9f\x17\xb2\x78\x58\xf3\x0d\xcc\xd1\xf7\xe3\x0d\x3c\x07\x81\x81\x6e\x25\x7e\xba\x81\x48\xb8\x69\xfe\x43\x89\xba\x1a\x5b\xfd\xbc\x14\xaa\x79\x2b\xe8\x55\xac\xfb\x62\x44\x27\x4f\x6b\x79\x96\x56\xe7\x64\x83\x70\xde\xe6\x6c\xe4\xb8\x3d\xe4\x61\x97\x0c\x37\x05\xa6\xba\xc2\xd1\x35\xee\x0e\x80\x61\x75\x58\x0c\x40\xe2\x95\x89\x9f\x3d\x8e\x32\xfe\x38\xc1\xe1\xaf\x5a\xe3\xee\xcc\xf3\xf8\x0c\x4f\xfc\xa7\x09\x0d\x11\xc7\xfb\x7f\x64\x18\x27\x70\x91\xa2\x90\xba\x9a\x7a\xa8\xab\x69\xef\xfe\x0d\x00\x00\xff\xff\x51\x9a\x3e\x33\x8f\x05\x00\x00") +var _publicIndexHtml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x94\xcd\x6e\xdb\x30\x0c\xc7\xef\x7b\x0a\x4d\x3b\xb4\x05\xaa\xb8\xdb\x61\x18\x56\x29\x18\xf6\x08\x7b\x81\x41\x96\x99\x98\x8d\x2c\x79\x14\x9d\xd4\x1b\xf6\xee\x83\xed\x26\xb6\xf3\xd1\xe6\x30\x5d\xec\x3f\x29\xfe\x28\x91\x02\xf5\xfb\x22\x3a\x6e\x6b\x10\x25\x57\x7e\xf9\x4e\x0f\x1f\x21\x84\xd0\x25\xd8\x62\xf8\xed\x25\x23\x7b\x58\x7e\xa7\x18\x37\x3a\x1b\xc4\xe8\xac\x80\xad\x70\xa5\xa5\x04\x6c\x64\xc3\x2b\xf5\x45\x1e\xbb\x83\xad\xc0\xc8\x2d\xc2\xae\x8e\xc4\x52\xb8\x18\x18\x02\x1b\xb9\xc3\x82\x4b\x53\xc0\x16\x1d\xa8\x5e\xdc\x8b\x0a\x03\x56\x4d\xa5\x92\xb3\x1e\xcc\xc7\xc5\xc3\xbd\xc0\x80\x8c\xd6\x4f\x4d\x4d\x02\xea\xb5\xcd\x3d\x98\x16\xd2\x34\x69\x72\x84\x35\x8b\x44\xce\xc8\x2c\x8f\x3b\xa0\x9f\x2e\x56\x75\x0c\x10\x38\x65\x3b\xc8\x47\xf5\x74\xa4\x95\x47\x86\x45\x85\x61\xf1\x94\xe4\x52\x67\x03\xea\x12\xfb\x29\x65\xa9\xa9\x81\xec\x1a\x02\xbf\x1e\x31\x1a\xba\xb5\xb5\x24\x7e\x08\x23\x08\x7e\x35\x48\x70\x7b\x33\x62\x6e\xee\x1e\xc7\xd8\x03\x6d\x34\x79\x0c\x1b\x41\xe0\x8d\xc4\x6a\x28\x67\x49\xb0\x3a\x77\xd1\xda\xd6\x40\x8a\x63\xf4\xb9\xa5\xb9\x5a\x74\xdd\x9e\x96\xec\x12\xf5\x04\x8a\x14\x83\x5a\x79\x78\x56\xde\xb6\xb1\xe1\x13\xc3\x1e\x7d\xc5\x89\x27\xd8\x67\x95\x80\x19\xc3\xfa\xe4\x64\x89\x5b\x0f\x02\x93\x91\xae\x49\x1c\x2b\xd5\x1b\xe4\xbc\x9e\xb3\xcb\x89\x3f\x33\x5f\xb7\x94\x9a\xed\x50\xb9\x75\x9b\x35\xc5\x26\x14\x5f\xc5\x87\x87\x7e\x3d\xce\x82\xfe\xce\xd4\xa2\xbf\x5f\x19\x09\x7f\xc7\xc0\xd6\xab\x1d\x72\xa9\xc8\x32\xc6\x74\x26\xdb\x37\x5b\xd7\xbe\xbd\x55\x2f\x15\x99\x04\xde\xbd\x9d\xc5\xc3\x8a\xaf\x60\xf6\x7b\x3f\x5d\xc1\x73\x10\x18\xce\xd5\xe4\x2c\xf1\xf3\x15\x44\xc2\x75\xf9\x1f\x8e\xa8\xb3\xbe\x93\x2f\x33\x27\x1b\x87\x8e\xce\x63\xd1\x4e\x5e\xc0\xac\x75\xcb\xa3\xb4\x3a\xd5\x36\x08\xe7\x6d\x4a\x46\xf6\xc3\x49\xee\x47\x55\xe7\x99\x60\xb2\x0b\x1c\x5d\xe0\x76\x0f\xe8\x26\x93\xc5\x00\x24\x5e\xe9\xf8\xd1\xdb\x9b\xc6\x1f\x3a\xd8\x4d\x82\x02\xb7\x47\x3b\x0f\xaf\x7c\xb6\x7f\xe8\x50\x17\x71\xf0\xbf\x91\xa1\xef\xc0\x49\x8a\x89\xd4\xd9\x50\x43\x9d\x0d\x63\xfd\x5f\x00\x00\x00\xff\xff\xea\x43\x43\xa4\xee\x05\x00\x00") func publicIndexHtmlBytes() ([]byte, error) { return bindataRead( @@ -35744,7 +35744,7 @@ func publicIndexHtml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "public/index.html", size: 1423, mode: os.FileMode(420), modTime: time.Unix(1489297444, 0)} + info := bindataFileInfo{name: "public/index.html", size: 1518, mode: os.FileMode(420), modTime: time.Unix(1509549584, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/gui/main.go b/gui/main.go index d68d72894..b94ec6c37 100644 --- a/gui/main.go +++ b/gui/main.go @@ -39,13 +39,14 @@ func run() { systray.AddMenuItem("---------", "").Disable() mGithub := systray.AddMenuItem("Upgrade", "") mEmail := systray.AddMenuItem("Contact: cloud@txthinking.com", "") - systray.AddMenuItem("Version: 20170909", "") + systray.AddMenuItem("Version: 20171111", "") systray.AddMenuItem("---------", "").Disable() mQuit := systray.AddMenuItem("Quit", "") showNotice("Status", "stopped") mStop.Disable() var bk *brook.Client + var bs *brook.StreamClient var ss *brook.SSClient var quitTimes int quit := make(chan struct{}) @@ -67,8 +68,8 @@ func run() { showNotice("Error", err.Error()) return } - if st.Type == "bk" { - bk, err = brook.NewClient(st.Address, st.Server, st.Password, st.TCPTimeout, st.TCPDeadline, st.UDPDeadline, st.UDPSessionTime) + if st.Type == "Brook" { + bk, err = brook.NewClient(st.Address, st.Address, st.Server, st.Password, st.TCPTimeout, st.TCPDeadline, st.UDPDeadline, st.UDPSessionTime) if err != nil { showNotice("Error", err.Error()) return @@ -78,8 +79,19 @@ func run() { return } } - if st.Type == "ss" { - ss, err = brook.NewSSClient(st.Address, st.Server, st.Password, st.TCPTimeout, st.TCPDeadline, st.UDPDeadline, st.UDPSessionTime) + if st.Type == "Brook Stream" { + bs, err = brook.NewStreamClient(st.Address, st.Address, st.Server, st.Password, st.TCPTimeout, st.TCPDeadline, st.UDPDeadline, st.UDPSessionTime) + if err != nil { + showNotice("Error", err.Error()) + return + } + if err := bs.ListenAndServe(nil); err != nil { + showNotice("Status", "stopped") + return + } + } + if st.Type == "Shadowsocks" { + ss, err = brook.NewSSClient(st.Address, st.Address, st.Server, st.Password, st.TCPTimeout, st.TCPDeadline, st.UDPDeadline, st.UDPSessionTime) if err := ss.ListenAndServe(nil); err != nil { showNotice("Status", "stopped") return @@ -96,6 +108,10 @@ func run() { bk.Shutdown() bk = nil } + if bs != nil { + bs.Shutdown() + bs = nil + } if ss != nil { ss.Shutdown() ss = nil diff --git a/gui/public/components/x-setting.html b/gui/public/components/x-setting.html index 4070fdb9a..dabf04689 100644 --- a/gui/public/components/x-setting.html +++ b/gui/public/components/x-setting.html @@ -7,14 +7,22 @@