Skip to content

Commit

Permalink
Add cache_enctable option.
Browse files Browse the repository at this point in the history
  • Loading branch information
cyfdecyf committed Dec 23, 2012
1 parent d6dc84f commit 3ae3646
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
13 changes: 7 additions & 6 deletions shadowsocks/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ import (
)

type Config struct {
Server string `json:"server"`
ServerPort int `json:"server_port"`
LocalPort int `json:"local_port"`
Password string `json:"password"`
PortPassword map[string]string `json:"port_password"`
Timeout int `json:"timeout"`
Server string `json:"server"`
ServerPort int `json:"server_port"`
LocalPort int `json:"local_port"`
Password string `json:"password"`
PortPassword map[string]string `json:"port_password"`
Timeout int `json:"timeout"`
CacheEncTable bool `json:"cache_enctable"`
}

var readTimeout time.Duration
Expand Down
16 changes: 11 additions & 5 deletions shadowsocks/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,27 @@ import (
)

func TestParseConfig1Password(t *testing.T) {
config := ParseConfig("testdata/config-one-passwd.json")
config, err := ParseConfig("testdata/config-one-passwd.json")
if err != nil {
t.Error("error parsing single password config:", err)
}

if config.Password != "barfoo!" {
t.Error("wrong password from config")
}
if config.Debug != true {
t.Error("debug option wrong")
}
if config.Timeout != 60 {
t.Error("tiemout wrong")
}
if !config.CacheEncTable {
t.Error("cache_enctable should be true")
}
}

func TestParseConfigMultiPassword(t *testing.T) {
config := ParseConfig("testdata/config-multi-passwd.json")
config, err := ParseConfig("testdata/config-multi-passwd.json")
if err != nil {
t.Error("error parsing multi password config:", err)
}

if config.Password != "barfoo!" {
t.Error("wrong password from config")
Expand Down
2 changes: 1 addition & 1 deletion shadowsocks/testdata/config-one-passwd.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"local_port":1081,
"password":"barfoo!",
"timeout":60,
"debug": true
"cache_enctable": true
}

0 comments on commit 3ae3646

Please sign in to comment.