Skip to content
This repository has been archived by the owner on Apr 9, 2020. It is now read-only.

Commit

Permalink
Merge branch 'develop', version 1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
cyfdecyf committed Jul 12, 2013
2 parents 78809dd + 9607c6b commit c33324b
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 21 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
language: go
go:
- 1.1
install:
- go get github.com/cyfdecyf/leakybuf
- go get code.google.com/p/go.crypto/blowfish
Expand Down
14 changes: 12 additions & 2 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
0.6.3 (not released)
* Support IPv6 server
1.1.1 (2013-07-12)
* Add -b option to limit listen address for client
* Fix can't override server address on command line

1.1 (2013-05-26)
* Add more encryption methods
* Enable CGO for OS X when building

1.0 (2013-05-17)
* Support specify servers with IPv6 address
* Support IPv6 address in socks requests
* Better handling of configuration file for debian package

0.6.2 (2013-03-15)
* Connect to multiple servers in the order specified in config
Expand Down
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# shadowsocks-go

Current version: 1.1 [![Build Status](https://travis-ci.org/shadowsocks/shadowsocks-go.png?branch=master)](https://travis-ci.org/shadowsocks/shadowsocks-go)
Current version: 1.1.1 [![Build Status](https://travis-ci.org/shadowsocks/shadowsocks-go.png?branch=master)](https://travis-ci.org/shadowsocks/shadowsocks-go)

shadowsocks-go is a lightweight tunnel proxy which can help you get through firewalls. It is a port of [shadowsocks](https://github.com/clowwindy/shadowsocks).

Expand Down Expand Up @@ -35,7 +35,7 @@ Configuration file is in json format and has the same syntax with [shadowsocks-n
server your server ip or hostname
server_port server port
local_port local socks5 proxy port
method encryption method, null by default, or use any of the following:
method encryption method, null by default, the following methods are supported:
aes-128-cfb, aes-192-cfb, aes-256-cfb, bf-cfb, cast5-cfb, des-cfb, rc4
password a password used to encrypt transfer
timeout server option, in seconds
Expand All @@ -49,18 +49,27 @@ On client, run `shadowsocks-local`. Change proxy settings of your browser to
SOCKS5 127.0.0.1:local_port
```

## About encryption methods

AES is recommended for shadowsocks-go. ([Intel AES Instruction Set](http://en.wikipedia.org/wiki/AES_instruction_set) will be used if available and can make encryption/decryption fast.)

**rc4 and table encryption methods are deprecated because they are not secure**.

## Command line options

Command line options can override settings from configuration files. Use `-h` option to see all available options.

```
shadowsocks-local -s server_name -p server_port -l local_port -k password -m rc4 -c config.json
shadowsocks-server -p server_port -k password -t timeout -m rc4 -c config.json
shadowsocks-local -s server_address -p server_port -k password
-m rc4 -c config.json
-b local_address -l local_port
shadowsocks-server -p server_port -k password
-m rc4 -c config.json
-t timeout
```

Use `-d` option to enable debug message.


## Use multiple servers on client

```
Expand Down
7 changes: 5 additions & 2 deletions cmd/shadowsocks-httpget/httpget.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func doOneRequest(client *http.Client, uri string, buf []byte) (err error) {
return
}

func get(connid int, uri, serverAddr string, rawAddr []byte, cipher ss.Cipher, done chan []time.Duration) {
func get(connid int, uri, serverAddr string, rawAddr []byte, cipher *ss.Cipher, done chan []time.Duration) {
reqDone := 0
reqTime := make([]time.Duration, config.nreq)
defer func() {
Expand Down Expand Up @@ -96,6 +96,10 @@ func main() {

runtime.GOMAXPROCS(config.core)
uri := flag.Arg(0)
if strings.HasPrefix(uri, "https://") {
fmt.Println("https not supported")
os.Exit(1)
}
if !strings.HasPrefix(uri, "http://") {
uri = "http://" + uri
}
Expand All @@ -122,7 +126,6 @@ func main() {
rawAddr, err := ss.RawAddr(host)
if err != nil {
panic("Error getting raw address.")
return
}

done := make(chan []time.Duration)
Expand Down
11 changes: 6 additions & 5 deletions cmd/shadowsocks-local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,12 +320,12 @@ func handleConnection(conn net.Conn) {
debug.Println("closed connection to", addr)
}

func run(port string) {
ln, err := net.Listen("tcp", ":"+port)
func run(listenAddr string) {
ln, err := net.Listen("tcp", listenAddr)
if err != nil {
log.Fatal(err)
}
log.Printf("starting local socks5 server at port %v ...\n", port)
log.Printf("starting local socks5 server at %v ...\n", listenAddr)
for {
conn, err := ln.Accept()
if err != nil {
Expand All @@ -344,13 +344,14 @@ func enoughOptions(config *ss.Config) bool {
func main() {
log.SetOutput(os.Stdout)

var configFile, cmdServer string
var configFile, cmdServer, cmdLocal string
var cmdConfig ss.Config
var printVer bool

flag.BoolVar(&printVer, "version", false, "print version")
flag.StringVar(&configFile, "c", "config.json", "specify config file")
flag.StringVar(&cmdServer, "s", "", "server address")
flag.StringVar(&cmdLocal, "b", "", "local address, listen only to this address if specified")
flag.StringVar(&cmdConfig.Password, "k", "", "password")
flag.IntVar(&cmdConfig.ServerPort, "p", 0, "server port")
flag.IntVar(&cmdConfig.LocalPort, "l", 0, "local socks5 proxy port")
Expand Down Expand Up @@ -405,5 +406,5 @@ func main() {

parseServerConfig(config)

run(strconv.Itoa(config.LocalPort))
run(cmdLocal + ":" + strconv.Itoa(config.LocalPort))
}
3 changes: 1 addition & 2 deletions sample-config/server-multi-port.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
"8387": "foobar",
"8388": "barfoo"
},
"timeout": 60,
"cache_enctable": true
"timeout": 600,
}
4 changes: 2 additions & 2 deletions script/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ build windows 386 win32 local
build linux amd64 linux64 server
build linux 386 linux32 server
#build darwin amd64 mac64 server
#build windows amd64 win64 server
#build windows 386 win32 server
build windows amd64 win64 server
build windows 386 win32 server

script/createdeb.sh amd64
script/createdeb.sh 386
Expand Down
8 changes: 8 additions & 0 deletions script/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ test_server_local_pair() {
echo "============================================================"
echo "server: $SERVER, local: $LOCAL"
echo "============================================================"

local url
if [[ -z "$TRAVIS" ]]; then
url="www.baidu.com"
else
# on travis
url="www.google.com"
fi
test_shadowsocks baidu.com table
test_shadowsocks baidu.com rc4
test_shadowsocks baidu.com aes-128-cfb
Expand Down
2 changes: 0 additions & 2 deletions shadowsocks/encrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,4 @@ func (c *Cipher) Copy() *Cipher {
nc.dec = nil
return &nc
}
// should not reach here, keep it to make go 1.0.x compiler happy
return nil
}
2 changes: 1 addition & 1 deletion shadowsocks/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

func PrintVersion() {
const version = "1.1"
const version = "1.1.1"
fmt.Println("shadowsocks-go version", version)
}

Expand Down

0 comments on commit c33324b

Please sign in to comment.