diff --git a/README.md b/README.md
index 86aaf51e..7085f95e 100644
--- a/README.md
+++ b/README.md
@@ -6,18 +6,6 @@
----
-### 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
@@ -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
@@ -93,7 +81,7 @@ USAGE:
brook [global options] command [command options] [arguments...]
VERSION:
- 20171111
+ 20171122
AUTHOR:
Cloud
@@ -221,22 +209,22 @@ $ 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
```
@@ -244,12 +232,12 @@ $ brook streamclient -t 127.0.0.1:1080 -u 127.0.0.1:1080 -s server_address:port
```
# 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
diff --git a/cli/brook/main.go b/cli/brook/main.go
index 1d10dfee..f743eb67 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 = "20171111"
+ app.Version = "20171122"
app.Usage = "A Cross-Platform Proxy Software"
app.Author = "Cloud"
app.Email = "cloud@txthinking.com"
@@ -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",
@@ -170,7 +170,7 @@ 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
}
@@ -178,9 +178,9 @@ func main() {
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{
@@ -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",
@@ -316,7 +316,7 @@ 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
}
@@ -324,9 +324,9 @@ func main() {
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{
@@ -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",
@@ -462,7 +462,7 @@ 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
}
@@ -470,9 +470,9 @@ func main() {
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{
@@ -480,12 +480,12 @@ func main() {
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",
@@ -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{
diff --git a/client.go b/client.go
index 3e8bc468..d386b677 100644
--- a/client.go
+++ b/client.go
@@ -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
}
@@ -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
}
diff --git a/gui/main.go b/gui/main.go
index b94ec6c3..4a78191b 100644
--- a/gui/main.go
+++ b/gui/main.go
@@ -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", "")
@@ -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
@@ -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
@@ -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
diff --git a/run.go b/run.go
index 1d663580..4816ee68 100644
--- a/run.go
+++ b/run.go
@@ -10,8 +10,8 @@ func RunServer(address, password string, tcpTimeout, tcpDeadline, udpDeadline in
}
// RunClient used to make a new Client and start a socks5 proxy to listen
-func RunClient(address, udpAddress, server, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) error {
- c, err := NewClient(address, udpAddress, server, password, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime)
+func RunClient(address, ip, server, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) error {
+ c, err := NewClient(address, ip, server, password, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime)
if err != nil {
return err
}
@@ -19,8 +19,8 @@ func RunClient(address, udpAddress, server, password string, tcpTimeout, tcpDead
}
// RunClientAsHTTP used to make a new Client and start a http proxy to listen
-func RunClientAsHTTP(address, udpAddress, server, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) error {
- c, err := NewClient(address, udpAddress, server, password, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime)
+func RunClientAsHTTP(address, ip, server, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) error {
+ c, err := NewClient(address, ip, server, password, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime)
if err != nil {
return err
}
@@ -37,8 +37,8 @@ func RunStreamServer(address, password string, tcpTimeout, tcpDeadline, udpDeadl
}
// RunStreamClient used to make a new StreamClient and start a socks5 proxy to listen
-func RunStreamClient(address, udpAddress, server, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) error {
- c, err := NewStreamClient(address, udpAddress, server, password, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime)
+func RunStreamClient(address, ip, server, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) error {
+ c, err := NewStreamClient(address, ip, server, password, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime)
if err != nil {
return err
}
@@ -46,8 +46,8 @@ func RunStreamClient(address, udpAddress, server, password string, tcpTimeout, t
}
// RunClientAsHTTP used to make a new StreamClient and start a http proxy to listen
-func RunStreamClientAsHTTP(address, udpAddress, server, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) error {
- c, err := NewStreamClient(address, udpAddress, server, password, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime)
+func RunStreamClientAsHTTP(address, ip, server, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) error {
+ c, err := NewStreamClient(address, ip, server, password, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime)
if err != nil {
return err
}
@@ -64,8 +64,8 @@ func RunSSServer(address, password string, tcpTimeout, tcpDeadline, udpDeadline
}
// RunSSClient used to make a new Client and start a socks5 proxy to listen
-func RunSSClient(address, udpAddress, server, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) error {
- c, err := NewSSClient(address, udpAddress, server, password, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime)
+func RunSSClient(address, ip, server, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) error {
+ c, err := NewSSClient(address, ip, server, password, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime)
if err != nil {
return err
}
@@ -73,8 +73,8 @@ func RunSSClient(address, udpAddress, server, password string, tcpTimeout, tcpDe
}
// RunSSClientAsHTTP used to make a new Client and start a http proxy to listen
-func RunSSClientAsHTTP(address, udpAddress, server, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) error {
- c, err := NewSSClient(address, udpAddress, server, password, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime)
+func RunSSClientAsHTTP(address, ip, server, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) error {
+ c, err := NewSSClient(address, ip, server, password, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime)
if err != nil {
return err
}
@@ -91,8 +91,8 @@ func RunRelay(address, remote string, tcpTimeout, tcpDeadline, udpDeadline int)
}
// RunSocks5Server used to make a new Socks5Server and start a raw socks5 proxy to listen
-func RunSocks5Server(address, udpAddress, username, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) error {
- s, err := NewSocks5Server(address, udpAddress, username, password, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime)
+func RunSocks5Server(address, ip, username, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) error {
+ s, err := NewSocks5Server(address, ip, username, password, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime)
if err != nil {
return err
}
diff --git a/socks5.go b/socks5.go
index d1e8db49..a6e09931 100644
--- a/socks5.go
+++ b/socks5.go
@@ -26,8 +26,8 @@ type Socks5Server struct {
}
// NewSocks5Server returns a new Socks5Server
-func NewSocks5Server(addr, udpAddr, userName, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) (*Socks5Server, error) {
- s5, err := socks5.NewClassicServer(addr, udpAddr, userName, password, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime)
+func NewSocks5Server(addr, ip, userName, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) (*Socks5Server, error) {
+ s5, err := socks5.NewClassicServer(addr, ip, userName, password, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime)
if err != nil {
return nil, err
}
@@ -115,7 +115,7 @@ func (x *Socks5Server) TCPHandle(s *socks5.Server, c *net.TCPConn, r *socks5.Req
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
}
diff --git a/ssclient.go b/ssclient.go
index 07d908cf..4dc6d06d 100644
--- a/ssclient.go
+++ b/ssclient.go
@@ -29,8 +29,8 @@ type SSClient struct {
}
// NewSSClient returns a new SSClient
-func NewSSClient(addr, udpAddr, server, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) (*SSClient, error) {
- s5, err := socks5.NewClassicServer(addr, udpAddr, "", "", tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime)
+func NewSSClient(addr, ip, server, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) (*SSClient, error) {
+ s5, err := socks5.NewClassicServer(addr, ip, "", "", tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime)
if err != nil {
return nil, err
}
@@ -117,7 +117,7 @@ func (x *SSClient) 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
}
diff --git a/stream_client.go b/stream_client.go
index a0325e29..c02d82b9 100644
--- a/stream_client.go
+++ b/stream_client.go
@@ -29,8 +29,8 @@ type StreamClient struct {
}
// NewStreamClient returns a new StreamClient
-func NewStreamClient(addr, udpAddr, server, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) (*StreamClient, error) {
- s5, err := socks5.NewClassicServer(addr, udpAddr, "", "", tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime)
+func NewStreamClient(addr, ip, server, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) (*StreamClient, error) {
+ s5, err := socks5.NewClassicServer(addr, ip, "", "", tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime)
if err != nil {
return nil, err
}
@@ -112,7 +112,7 @@ func (x *StreamClient) TCPHandle(s *socks5.Server, c *net.TCPConn, r *socks5.Req
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
}