shadowsocks-go icon indicating copy to clipboard operation
shadowsocks-go copied to clipboard

多端口失效了吗?

Open 10N99 opened this issue 7 years ago • 6 comments

配置完多端口后连接不上,最初的那个端口也连不上了。。。

10N99 avatar Oct 23 '17 15:10 10N99

建议更换一下加密方式

arthurkiller avatar Oct 24 '17 12:10 arthurkiller

这个项目还在维护吗?

gxiaosong avatar Oct 25 '17 01:10 gxiaosong

我在维护, 不过我没有权限,可以用我的 fork

On 25 Oct 2017, at 9:39 AM, Gou.EZ [email protected] wrote:

这个项目还在维护吗?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/shadowsocks/shadowsocks-go/issues/249#issuecomment-339186811, or mute the thread https://github.com/notifications/unsubscribe-auth/AKnjrvDvEmioAe51pbjY7bGvWMPkS7Q1ks5svpFDgaJpZM4QDA-F.

arthurkiller avatar Oct 25 '17 01:10 arthurkiller

@arthurkiller Hi Arthur,

Pardon me for asking an irrevant question in this thread, as I cannot create a new issue under your fork.

I used your fork yesterday, trying to build a ss server to run on a Ubuntu 17 system with go1.7, but met the following panic:

panic: runtime error: slice bounds out of range [recovered] panic: runtime error: slice bounds out of range

This panic points to github.com/arthurkiller/shadowsocks-go/encrypt/aeadCipher.go line 152: destdata := dest[2+c.enc.Overhead() : 2+c.enc.Overhead()+msglen+c.enc.Overhead()] // data layout

Then I pulled your fork to my local computer (Win 10, go1.9.2) and wrote a quick file test for aeadCipher.go, but unfortunately, the test result failed with the same runtime error panic: runtime error: slice bounds out of range.

I noticed that the golang Crypto librarary is using a sliceForAppend(in []byte, n int) (head, tail []byte) method to avoid slice out of range issue. But I am not sure if this is the problem. Would you please kindly look into this at your earliest convenience?

As I am a newbie to golang, and not familiar with the field of cryptography, I am not in a position yet to solve this issue and send a pull request. Your help is very much appreciated.

Best Regards, Ken

Here is the test:

package encrypt
import "testing"

const txt = "Don't tell me the moon is shining; show me the glint of light on broken glass."

func testAEADCipher(t *testing.T, c Cipher, msg string) { // Passing a pointer of Cipher here will lead to Encrypt and Decrypt methods undefined
	n := len(txt)
	cipherBuf := make([]byte, n)
	originTxt := make([]byte, n)

	c.Encrypt(cipherBuf, []byte(txt))
	c.Decrypt(originTxt, cipherBuf)

	if string(originTxt) != txt {
		t.Errorf("%s: encrypt then decrytp does not get original text\n", msg)
                t.Errorf("Before:\t%s\nAfter:\t%s\n", msg, txt, string(originTxt))
	}

}

func testAEADBlockCipher(t *testing.T, method string) {
	var cipher Cipher
	var err error

	cipher, err = NewAEADCipher(method, "foo")
	if err != nil {
		t.Fatal(method, "NewAEADCipher: ", err)
	}

	cipherCopy := cipher.Copy()
	iv, err := cipher.InitEncryptor()
	if err != nil {
		t.Error(method, "InitEncrypt:", err)
	}

	if err = cipher.InitDecryptor(iv); err != nil {
		t.Error(method, "InitDecrypt:", err)
	}
	testAEADCipher(t, cipher, method)

	iv, err = cipherCopy.InitEncryptor()
	if err != nil {
		t.Error(method, "copy InitEncrypt:", err)
	}
	if err = cipherCopy.InitDecryptor(iv); err != nil {
		t.Error(method, "copy InitDecrypt:", err)
	}
	testAEADCipher(t, cipherCopy, method+" copy")

}

func TestChaCha20IETFPOLY1305(t *testing.T) {
	testAEADBlockCipher(t, "chacha20-ietf-poly1305")
}

func TestAES256GCM(t *testing.T) {
	testAEADBlockCipher(t, "aes-256-gcm")
}

func TestAES192GCM(t *testing.T) {
	testAEADBlockCipher(t, "aes-192-gcm")
}

func TestAES128GCM(t *testing.T) {
	testAEADBlockCipher(t, "aes-128-gcm")

}

Here is the test result:

Running tool: E:\Go\bin\go.exe test -timeout 30s github.com\arthurkiller\shadowsocks-go\encrypt -run ^TestChaCha20IETFPOLY1305|TestAES256GCM|TestAES192GCM|TestAES128GCM$

--- FAIL: TestChaCha20IETFPOLY1305 (0.00s)
panic: runtime error: slice bounds out of range [recovered]
	panic: runtime error: slice bounds out of range

goroutine 19 [running]:
testing.tRunner.func1(0xc0420b40f0)
	E:/Go/src/testing/testing.go:711 +0x2d9
panic(0x561f00, 0x6568d0)
	E:/Go/src/runtime/panic.go:491 +0x291
github.com/arthurkiller/shadowsocks-go/encrypt.(*aeadCipher).Encrypt(0xc0420c0000, 0xc0420780f0, 0x4e, 0x4e, 0xc042078190, 0x4e, 0x50, 0x20, 0xc04204c340, 0xc04204c2c0)
	E:/Gocode/src/github.com/arthurkiller/shadowsocks-go/encrypt/aeadCipher.go:166 +0x43d
github.com/arthurkiller/shadowsocks-go/encrypt.testAEADCipher(0xc0420b40f0, 0x642c40, 0xc0420c0000, 0x58f372, 0x16)
	E:/Gocode/src/github.com/arthurkiller/shadowsocks-go/encrypt/aeadCipher_test.go:12 +0x12e
github.com/arthurkiller/shadowsocks-go/encrypt.testAEADBlockCipher(0xc0420b40f0, 0x58f372, 0x16)
	E:/Gocode/src/github.com/arthurkiller/shadowsocks-go/encrypt/aeadCipher_test.go:39 +0x46f
github.com/arthurkiller/shadowsocks-go/encrypt.TestChaCha20IETFPOLY1305(0xc0420b40f0)
	E:/Gocode/src/github.com/arthurkiller/shadowsocks-go/encrypt/aeadCipher_test.go:53 +0x47
testing.tRunner(0xc0420b40f0, 0x595d98)
	E:/Go/src/testing/testing.go:746 +0xd7
created by testing.(*T).Run
	E:/Go/src/testing/testing.go:789 +0x2e5
FAIL	github.com/arthurkiller/shadowsocks-go/encrypt	0.033s
Error: Tests failed.

b2nil avatar Nov 03 '17 03:11 b2nil

@b2nil thanks for report, I am working on this problem. I will notice you after done thx again,

BTW, you can find me on the telegram group, contact me if bugs occurred

arthurkiller avatar Nov 06 '17 02:11 arthurkiller

@arthurkiller Thanks Arthur.

b2nil avatar Nov 12 '17 04:11 b2nil