Skip to content

Commit

Permalink
client: use -ip instead of -udpListen
Browse files Browse the repository at this point in the history
  • Loading branch information
txthinking committed Nov 4, 2017
1 parent 1fdcb90 commit ee598ba
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 90 deletions.
52 changes: 20 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,6 @@
<img style="float: right;" src="https://storage.googleapis.com/txthinking-file/_/brook_200x200.png" alt="Brook"/>
</p>

---
### 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
Expand All @@ -44,20 +32,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/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 |
| [brook](https://github.com/txthinking/brook/releases/download/v20171122/brook) | Server & Client | Linux | amd64 | CLI |
| [brook_linux_386](https://github.com/txthinking/brook/releases/download/v20171122/brook_linux_386) | Server & Client | Linux | 386 | CLI |
| [brook_linux_arm64](https://github.com/txthinking/brook/releases/download/v20171122/brook_linux_arm64) | Server & Client | Linux | arm64 | CLI |
| [brook_linux_arm5](https://github.com/txthinking/brook/releases/download/v20171122/brook_linux_arm5) | Server & Client | Linux | arm5 | CLI |
| [brook_linux_arm6](https://github.com/txthinking/brook/releases/download/v20171122/brook_linux_arm6) | Server & Client | Linux | arm6 | CLI |
| [brook_linux_arm7](https://github.com/txthinking/brook/releases/download/v20171122/brook_linux_arm7) | Server & Client | Linux | arm7 | CLI |
| [brook_macos_amd64](https://github.com/txthinking/brook/releases/download/v20171122/brook_macos_amd64) | Server & Client | MacOS | amd64 | CLI |
| [brook_windows_amd64.exe](https://github.com/txthinking/brook/releases/download/v20171122/brook_windows_amd64.exe) | Server & Client | Windows | amd64 | CLI |
| [brook_windows_386.exe](https://github.com/txthinking/brook/releases/download/v20171122/brook_windows_386.exe) | Server & Client | Windows | 386 | CLI |
| [Brook.app.zip](https://github.com/txthinking/brook/releases/download/v20171122/Brook.app.zip) | Client | MacOS | amd64 | GUI |
| [Brook.exe](https://github.com/txthinking/brook/releases/download/v20171122/Brook.exe) | Client | Windows | amd64 | GUI |
| [Brook.386.exe](https://github.com/txthinking/brook/releases/download/v20171122/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/v20171111/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/v20171122/Brook.apk) | Client | Android | - | GUI |

MacOS GUI Client

Expand Down Expand Up @@ -93,7 +81,7 @@ USAGE:
brook [global options] command [command options] [arguments...]
VERSION:
20171111
20171122
AUTHOR:
Cloud <cloud@txthinking.com>
Expand Down Expand Up @@ -221,35 +209,35 @@ $ brook relays \

```
# Run as brook client, start a socks5 proxy
$ brook client -t 127.0.0.1:1080 -u 127.0.0.1:1080 -s server_address:port -p password
$ brook client -l 127.0.0.1:1080 -i 127.0.0.1 -s server_address:port -p password
```

```
# Run as brook client, start a http(s) proxy
$ brook client -t 127.0.0.1:1080 -u 127.0.0.1:1080 -s server_address:port -p password --http
$ brook client -l 127.0.0.1:1080 -i 127.0.0.1 -s server_address:port -p password --http
```

```
# 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
$ brook streamclient -l 127.0.0.1:1080 -i 127.0.0.1 -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
$ brook streamclient -l 127.0.0.1:1080 -i 127.0.0.1 -s server_address:port -p password --http
```


#### Shadowsocks Client

```
# Run as shadowsocks client, start a socks5 proxy
$ brook ssclient -t 127.0.0.1:1080 -u 127.0.0.1:1080 -s server_address:port -p password
$ brook ssclient -l 127.0.0.1:1080 -i 127.0.0.1 -s server_address:port -p password
```

```
# Run as shadowsocks client, start a http(s) proxy
$ brook ssclient -t 127.0.0.1:1080 -u 127.0.0.1:1080 -s server_address:port -p password --http
$ brook ssclient -l 127.0.0.1:1080 -i 127.0.0.1 -s server_address:port -p password --http
```

#### Contributing
Expand Down
56 changes: 28 additions & 28 deletions cli/brook/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var debugAddress string
func main() {
app := cli.NewApp()
app.Name = "Brook"
app.Version = "20171111"
app.Version = "20171122"
app.Usage = "A Cross-Platform Proxy Software"
app.Author = "Cloud"
app.Email = "cloud@txthinking.com"
Expand Down Expand Up @@ -129,12 +129,12 @@ func main() {
Usage: "Run as client mode",
Flags: []cli.Flag{
cli.StringFlag{
Name: "tcpListen, t",
Usage: "Client listen address: like: 127.0.0.1:1080",
Name: "listen, l",
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",
Name: "ip, i",
Usage: "Client IP address, like: 127.0.0.1",
},
cli.StringFlag{
Name: "server, s",
Expand Down Expand Up @@ -170,17 +170,17 @@ func main() {
},
},
Action: func(c *cli.Context) error {
if c.String("tcpListen") == "" || c.String("udpListen") == "" || c.String("server") == "" || c.String("password") == "" {
if c.String("listen") == "" || c.String("ip") == "" || c.String("server") == "" || c.String("password") == "" {
cli.ShowCommandHelp(c, "client")
return nil
}
if debug {
enableDebug()
}
if c.Bool("http") {
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.RunClientAsHTTP(c.String("listen"), c.String("ip"), 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"))
return brook.RunClient(c.String("listen"), c.String("ip"), c.String("server"), c.String("password"), c.Int("tcpTimeout"), c.Int("tcpDeadline"), c.Int("udpDeadline"), c.Int("udpSessionTime"))
},
},
cli.Command{
Expand Down Expand Up @@ -275,12 +275,12 @@ func main() {
Usage: "Run as client mode",
Flags: []cli.Flag{
cli.StringFlag{
Name: "tcpListen, t",
Usage: "Client listen address: like: 127.0.0.1:1080",
Name: "listen, l",
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",
Name: "ip, i",
Usage: "Client IP address, like: 127.0.0.1",
},
cli.StringFlag{
Name: "server, s",
Expand Down Expand Up @@ -316,17 +316,17 @@ func main() {
},
},
Action: func(c *cli.Context) error {
if c.String("tcpListen") == "" || c.String("udpListen") == "" || c.String("server") == "" || c.String("password") == "" {
if c.String("listen") == "" || c.String("ip") == "" || c.String("server") == "" || c.String("password") == "" {
cli.ShowCommandHelp(c, "streamclient")
return nil
}
if debug {
enableDebug()
}
if c.Bool("http") {
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.RunStreamClientAsHTTP(c.String("listen"), c.String("ip"), 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"))
return brook.RunStreamClient(c.String("listen"), c.String("ip"), c.String("server"), c.String("password"), c.Int("tcpTimeout"), c.Int("tcpDeadline"), c.Int("udpDeadline"), c.Int("udpSessionTime"))
},
},
cli.Command{
Expand Down Expand Up @@ -421,12 +421,12 @@ func main() {
Usage: "Run as shadowsocks client mode, fixed method is aes-256-cfb",
Flags: []cli.Flag{
cli.StringFlag{
Name: "tcpListen, t",
Usage: "Client listen address: like: 127.0.0.1:1080",
Name: "listen, l",
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",
Name: "ip, i",
Usage: "Client IP address, like: 127.0.0.1",
},
cli.StringFlag{
Name: "server, s",
Expand Down Expand Up @@ -462,30 +462,30 @@ func main() {
},
},
Action: func(c *cli.Context) error {
if c.String("tcpListen") == "" || c.String("udpListen") == "" || c.String("server") == "" || c.String("password") == "" {
if c.String("listen") == "" || c.String("ip") == "" || c.String("server") == "" || c.String("password") == "" {
cli.ShowCommandHelp(c, "ssclient")
return nil
}
if debug {
enableDebug()
}
if c.Bool("http") {
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.RunSSClientAsHTTP(c.String("listen"), c.String("ip"), 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"))
return brook.RunSSClient(c.String("listen"), c.String("ip"), c.String("server"), c.String("password"), c.Int("tcpTimeout"), c.Int("tcpDeadline"), c.Int("udpDeadline"), c.Int("udpSessionTime"))
},
},
cli.Command{
Name: "socks5",
Usage: "Run as raw socks5 server",
Flags: []cli.Flag{
cli.StringFlag{
Name: "tcpListen, t",
Usage: "Client listen address: like: 127.0.0.1:1080",
Name: "listen, l",
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",
Name: "ip, i",
Usage: "Client IP address, like: 127.0.0.1",
},
cli.StringFlag{
Name: "username",
Expand Down Expand Up @@ -517,14 +517,14 @@ func main() {
},
},
Action: func(c *cli.Context) error {
if c.String("tcpListen") == "" || c.String("udpListen") == "" {
if c.String("listen") == "" || c.String("ip") == "" {
cli.ShowCommandHelp(c, "socks5")
return nil
}
if debug {
enableDebug()
}
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"))
return brook.RunSocks5Server(c.String("listen"), c.String("ip"), c.String("username"), c.String("password"), c.Int("tcpTimeout"), c.Int("tcpDeadline"), c.Int("udpDeadline"), c.Int("udpSessionTime"))
},
},
cli.Command{
Expand Down
6 changes: 3 additions & 3 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ type Client struct {
}

// NewClient returns a new Client
func NewClient(addr, udpAddr, server, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) (*Client, error) {
s5, err := socks5.NewClassicServer(addr, udpAddr, "", "", tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime)
func NewClient(addr, ip, server, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) (*Client, error) {
s5, err := socks5.NewClassicServer(addr, ip, "", "", tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -155,7 +155,7 @@ func (x *Client) TCPHandle(s *socks5.Server, c *net.TCPConn, r *socks5.Request)
return nil
}
if r.Cmd == socks5.CmdUDP {
caddr, err := r.UDP(c, x.Server.UDPAddr)
caddr, err := r.UDP(c, x.Server.ServerAddr)
if err != nil {
return err
}
Expand Down
8 changes: 4 additions & 4 deletions gui/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func run() {
systray.AddMenuItem("---------", "").Disable()
mGithub := systray.AddMenuItem("Upgrade", "")
mEmail := systray.AddMenuItem("Contact: cloud@txthinking.com", "")
systray.AddMenuItem("Version: 20171111", "")
systray.AddMenuItem("Version: 20171122", "")
systray.AddMenuItem("---------", "").Disable()
mQuit := systray.AddMenuItem("Quit", "")

Expand Down Expand Up @@ -69,7 +69,7 @@ func run() {
return
}
if st.Type == "Brook" {
bk, err = brook.NewClient(st.Address, st.Address, st.Server, st.Password, st.TCPTimeout, st.TCPDeadline, st.UDPDeadline, st.UDPSessionTime)
bk, err = brook.NewClient(st.Address, "local.txthinking.com", st.Server, st.Password, st.TCPTimeout, st.TCPDeadline, st.UDPDeadline, st.UDPSessionTime)
if err != nil {
showNotice("Error", err.Error())
return
Expand All @@ -80,7 +80,7 @@ func run() {
}
}
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)
bs, err = brook.NewStreamClient(st.Address, "local.txthinking.com", st.Server, st.Password, st.TCPTimeout, st.TCPDeadline, st.UDPDeadline, st.UDPSessionTime)
if err != nil {
showNotice("Error", err.Error())
return
Expand All @@ -91,7 +91,7 @@ func run() {
}
}
if st.Type == "Shadowsocks" {
ss, err = brook.NewSSClient(st.Address, st.Address, st.Server, st.Password, st.TCPTimeout, st.TCPDeadline, st.UDPDeadline, st.UDPSessionTime)
ss, err = brook.NewSSClient(st.Address, "local.txthinking.com", st.Server, st.Password, st.TCPTimeout, st.TCPDeadline, st.UDPDeadline, st.UDPSessionTime)
if err := ss.ListenAndServe(nil); err != nil {
showNotice("Status", "stopped")
return
Expand Down
Loading

0 comments on commit ee598ba

Please sign in to comment.