Skip to content

Commit 14d5347

Browse files
committedDec 25, 2014
Added remote_port, local_address options.
1 parent 3d397bb commit 14d5347

11 files changed

+86
-83
lines changed
 

‎Cakefile

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{print} = require 'util'
21
{spawn} = require 'child_process'
32

43
build = (callback) ->
@@ -11,7 +10,7 @@ build = (callback) ->
1110
coffee.stderr.on 'data', (data) ->
1211
process.stderr.write data.toString()
1312
coffee.stdout.on 'data', (data) ->
14-
print data.toString()
13+
console.log data.toString()
1514
coffee.on 'exit', (code) ->
1615
console.log 'build completed'
1716
callback?() if code is 0
@@ -23,7 +22,7 @@ test = (callback) ->
2322
coffee.stderr.on 'data', (data) ->
2423
process.stderr.write data.toString()
2524
coffee.stdout.on 'data', (data) ->
26-
print data.toString()
25+
console.log data.toString()
2726
coffee.on 'exit', (code) ->
2827
callback?() if code is 0
2928
process.exit code

‎args.js

+4-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎encrypt.js

+3-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎local.js

+23-21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎merge_sort.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎server.js

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/args.coffee

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11

22
exports.parseArgs = ->
33
defination =
4+
'-b': 'local_address'
45
'-l': 'local_port'
56
'-s': 'server'
7+
'-r': 'remote_port'
68
'-k': 'password',
79
'-c': 'config_file',
810
'-m': 'method'
911

10-
1112
result = {}
1213
nextIsValue = false
1314
lastKey = null
@@ -20,4 +21,4 @@ exports.parseArgs = ->
2021
nextIsValue = true
2122
result
2223

23-
exports.version = "shadowsocks-heroku v0.9.6"
24+
exports.version = "shadowsocks-heroku v0.9.7"

‎src/encrypt.coffee

+6-7
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
# SOFTWARE.
2020

2121
crypto = require("crypto")
22-
util = require("util")
2322
merge_sort = require("./merge_sort").merge_sort
2423
int32Max = Math.pow(2, 32)
2524

@@ -28,7 +27,7 @@ cachedTables = {} # password: [encryptTable, decryptTable]
2827
getTable = (key) ->
2928
if cachedTables[key]
3029
return cachedTables[key]
31-
util.log "calculating ciphers"
30+
console.log "calculating ciphers"
3231
table = new Array(256)
3332
decrypt_table = new Array(256)
3433
md5sum = crypto.createHash("md5")
@@ -55,15 +54,15 @@ getTable = (key) ->
5554
result = [table, decrypt_table]
5655
cachedTables[key] = result
5756
result
58-
57+
5958
encrypt = (table, buf) ->
6059
i = 0
6160

6261
while i < buf.length
6362
buf[i] = table[buf[i]]
6463
i++
6564
buf
66-
65+
6766

6867
class Encryptor
6968
constructor: (key, @method) ->
@@ -72,20 +71,20 @@ class Encryptor
7271
@decipher = crypto.createDecipher @method, key
7372
else
7473
[@encryptTable, @decryptTable] = getTable(key)
75-
74+
7675
encrypt: (buf) ->
7776
if @method?
7877
result = new Buffer(@cipher.update(buf.toString('binary')), 'binary')
7978
result
8079
else
8180
encrypt @encryptTable, buf
82-
81+
8382
decrypt: (buf) ->
8483
if @method?
8584
result = new Buffer(@decipher.update(buf.toString('binary')), 'binary')
8685
result
8786
else
8887
encrypt @decryptTable, buf
89-
88+
9089
exports.Encryptor = Encryptor
9190
exports.getTable = getTable

0 commit comments

Comments
 (0)