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'
Browse files Browse the repository at this point in the history
  • Loading branch information
cyfdecyf committed Jun 10, 2013
2 parents 189db43 + 2c1c359 commit 78809dd
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ install:
- go install ./cmd/shadowsocks-server
- popd
script:
- pushd $GOPATH/src/github.com/shadowsocks/shadowsocks-go
- PATH=$PATH:$GOPATH/bin/ bash -x ./script/test.sh
- pushd $TRAVIS_BUILD_DIR
- PATH=$PATH:$HOME/gopath/bin bash -x ./script/test.sh
- popd
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ The protocol is compatible with the origin shadowsocks (if both have been upgrad

**Note `server_password` option syntax changed in 0.6.2, the client now connects to servers in the order specified in the config.**

**Please develop on the latest develop branch if you want to send pull request.**

# Install

Compiled client binaries can be download [here](http://dl.chenyufei.info/shadowsocks/). (All compiled with cgo disabled, except the mac version.)
Expand Down
4 changes: 4 additions & 0 deletions shadowsocks/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ func UpdateConfig(old, new *Config) {
// log.Printf("%d: %s %s = %v\n", i,
// typeOfT.Field(i).Name, newField.Type(), newField.Interface())
switch newField.Kind() {
case reflect.Interface:
if fmt.Sprintf("%v", newField.Interface()) != "" {
oldField.Set(newField)
}
case reflect.String:
s := newField.String()
if s != "" {
Expand Down
16 changes: 8 additions & 8 deletions shadowsocks/encrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,6 @@ func newRC4Cipher(key []byte) (enc, dec cipher.Stream, err error) {
return rc4Enc, &rc4Dec, nil
}

type cipherInfo struct {
keyLen int
ivLen int
newBlock func([]byte) (cipher.Block, error)
}

// Ciphers from go.crypto has NewCipher returning specific type of cipher
// instead of cipher.Block, so we need to have the following adapter
// functions.
Expand All @@ -109,7 +103,13 @@ func newCast5Cipher(key []byte) (cipher.Block, error) {
return cast5.NewCipher(key)
}

var cipherMethod = map[string]cipherInfo{
type cipherInfo struct {
keyLen int
ivLen int
newBlock func([]byte) (cipher.Block, error)
}

var cipherMethod = map[string]*cipherInfo{
"aes-128-cfb": {16, 16, aes.NewCipher},
"aes-192-cfb": {24, 16, aes.NewCipher},
"aes-256-cfb": {32, 16, aes.NewCipher},
Expand Down Expand Up @@ -149,7 +149,7 @@ func NewCipher(method, password string) (c *Cipher, err error) {

key := evpBytesToKey(password, mi.keyLen)

c = &Cipher{key: key, info: &mi}
c = &Cipher{key: key, info: mi}

if mi.newBlock == nil {
if method == "" {
Expand Down

0 comments on commit 78809dd

Please sign in to comment.