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

Commit

Permalink
Use method-auth to enable OTA.
Browse files Browse the repository at this point in the history
  • Loading branch information
cyfdecyf committed May 4, 2016
1 parent 0206d55 commit 0fd1c39
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ AES is recommended for shadowsocks-go. [Intel AES Instruction Set](http://en.wik

### One Time Auth

Append `-ota` to the encryption method to enable [One Time Auth (OTA)](https://shadowsocks.org/en/spec/one-time-auth.html).
Append `-auth` to the encryption method to enable [One Time Auth (OTA)](https://shadowsocks.org/en/spec/one-time-auth.html).

- For server: this will **force client use OTA**, non-OTA connection will be dropped. Otherwise, both OTA and non-OTA clients can connect
- For client: the `-A` command line option can also enable OTA
Expand Down
4 changes: 2 additions & 2 deletions cmd/shadowsocks-local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func parseServerConfig(config *ss.Config) {
if len(config.ServerPassword) == 0 {
method := config.Method
if config.Auth {
method += "-ota"
method += "-auth"
}
// only one encryption table
cipher, err := ss.NewCipher(method, config.Password)
Expand Down Expand Up @@ -381,7 +381,7 @@ func main() {
cmdConfig.Server = cmdServer
ss.SetDebug(debug)

if strings.HasSuffix(cmdConfig.Method, "-ota") {
if strings.HasSuffix(cmdConfig.Method, "-auth") {
cmdConfig.Method = cmdConfig.Method[:len(cmdConfig.Method)-4]
cmdConfig.Auth = true
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/shadowsocks-server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ func main() {

ss.SetDebug(debug)

if strings.HasSuffix(cmdConfig.Method, "-ota") {
if strings.HasSuffix(cmdConfig.Method, "-auth") {
cmdConfig.Method = cmdConfig.Method[:len(cmdConfig.Method)-4]
cmdConfig.Auth = true
}
Expand Down
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"server_port":8388,
"local_port":1080,
"password":"barfoo!",
"method": "aes-128-cfb-ota",
"method": "aes-128-cfb-auth",
"timeout":600
}
4 changes: 2 additions & 2 deletions shadowsocks/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ func ParseConfig(path string) (config *Config, err error) {
return nil, err
}
readTimeout = time.Duration(config.Timeout) * time.Second
if strings.HasSuffix(strings.ToLower(config.Method), "-ota") {
config.Method = config.Method[:len(config.Method)-4]
if strings.HasSuffix(strings.ToLower(config.Method), "-auth") {
config.Method = config.Method[:len(config.Method)-5]
config.Auth = true
}
return
Expand Down
4 changes: 2 additions & 2 deletions shadowsocks/encrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ func NewCipher(method, password string) (c *Cipher, err error) {
return nil, errEmptyPassword
}
var ota bool
if strings.HasSuffix(strings.ToLower(method), "-ota") {
method = method[:len(method)-4] // len("-ota") = 4
if strings.HasSuffix(strings.ToLower(method), "-auth") {
method = method[:len(method)-5] // len("-auth") = 5
ota = true
} else {
ota = false
Expand Down

0 comments on commit 0fd1c39

Please sign in to comment.