Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add KCP(UDPSession) as a transport for v2ray, reslove #162 #170

Merged
merged 34 commits into from
Jun 13, 2016

Conversation

xiaokangwang
Copy link
Contributor

TCP连接在高延迟,高带宽,较高丢包环境下,不能有效利用带宽。目前TCP连接下的VMess协议在这种网络环境下速度缓慢,甚至出现连接超时错误。

KCP可以更加有效的利用带宽降低延迟,很大程度上减少因为恶劣的网络环境导致的连接不稳。

通过提高代理连接的速度,可以有效的改善使用v2ray的体验。

新增加了一部分API,请查看 #162 了解详情。

需要注意的是:引入了 github.com/xtaci/kcp-go 库, 这个库的API的稳定性值得怀疑,在合并时可以考虑将该库的地址替换为V2ray可以有效控制的地址。

…fig, jsonConfig.KcpConfig.AdvancedConfig == nil>
@xiaokangwang
Copy link
Contributor Author

KCP连接不会自行关闭,如果proxy声明支持KCP,应该自行调用Close。

未来的proxy如果想使用KCP协议,需要双向同时调用Close

@xiaokangwang
Copy link
Contributor Author

我先看一下失败的测试

@xiaokangwang
Copy link
Contributor Author

go test -tags json github.com/v2ray/v2ray-core/...
# github.com/v2ray/v2ray-core/testing/scenarios
testing/scenarios/shadowsocks_test.go:11:2: cannot find package "github.com/shadowsocks/shadowsocks-go/shadowsocks" in any of:
    ------/github.com/shadowsocks/shadowsocks-go/shadowsocks (from $GOROOT)
    ------/src/github.com/shadowsocks/shadowsocks-go/shadowsocks (from $GOPATH)
FAIL    github.com/v2ray/v2ray-core/testing/scenarios [setup failed]
?       github.com/v2ray/v2ray-core [no test files]
?       github.com/v2ray/v2ray-core/app [no test files]
?       github.com/v2ray/v2ray-core/app/api [no test files]
?       github.com/v2ray/v2ray-core/app/dispatcher  [no test files]
?       github.com/v2ray/v2ray-core/app/dispatcher/impl [no test files]
?       github.com/v2ray/v2ray-core/app/dispatcher/testing  [no test files]
ok      github.com/v2ray/v2ray-core/app/dns 0.121s
?       github.com/v2ray/v2ray-core/app/proxyman    [no test files]
?       github.com/v2ray/v2ray-core/app/router  [no test files]
ok      github.com/v2ray/v2ray-core/app/router/rules    0.072s
?       github.com/v2ray/v2ray-core/common  [no test files]
ok      github.com/v2ray/v2ray-core/common/alloc    0.013s
ok      github.com/v2ray/v2ray-core/common/collect  0.015s
ok      github.com/v2ray/v2ray-core/common/crypto   0.004s
?       github.com/v2ray/v2ray-core/common/crypto/internal  [no test files]
?       github.com/v2ray/v2ray-core/common/dice [no test files]
ok      github.com/v2ray/v2ray-core/common/io   0.021s
?       github.com/v2ray/v2ray-core/common/loader   [no test files]
?       github.com/v2ray/v2ray-core/common/log  [no test files]
ok      github.com/v2ray/v2ray-core/common/log/internal 0.003s
ok      github.com/v2ray/v2ray-core/common/net  0.004s
?       github.com/v2ray/v2ray-core/common/net/testing  [no test files]
?       github.com/v2ray/v2ray-core/common/platform [no test files]
?       github.com/v2ray/v2ray-core/common/predicate    [no test files]
ok      github.com/v2ray/v2ray-core/common/protocol 0.006s
ok      github.com/v2ray/v2ray-core/common/protocol/raw 0.025s
ok      github.com/v2ray/v2ray-core/common/retry    8.023s
?       github.com/v2ray/v2ray-core/common/serial   [no test files]
?       github.com/v2ray/v2ray-core/common/signal   [no test files]
ok      github.com/v2ray/v2ray-core/common/uuid 0.010s
?       github.com/v2ray/v2ray-core/common/web  [no test files]
?       github.com/v2ray/v2ray-core/common/web/hooks    [no test files]
?       github.com/v2ray/v2ray-core/proxy   [no test files]
ok      github.com/v2ray/v2ray-core/proxy/blackhole 0.006s
ok      github.com/v2ray/v2ray-core/proxy/dokodemo  0.014s
ok      github.com/v2ray/v2ray-core/proxy/freedom   0.539s
ok      github.com/v2ray/v2ray-core/proxy/http  0.022s
?       github.com/v2ray/v2ray-core/proxy/internal  [no test files]
?       github.com/v2ray/v2ray-core/proxy/repo  [no test files]
ok      github.com/v2ray/v2ray-core/proxy/shadowsocks   0.003s
ok      github.com/v2ray/v2ray-core/proxy/socks 0.011s
ok      github.com/v2ray/v2ray-core/proxy/socks/protocol    0.005s
?       github.com/v2ray/v2ray-core/proxy/testing   [no test files]
?       github.com/v2ray/v2ray-core/proxy/testing/mocks [no test files]
ok      github.com/v2ray/v2ray-core/proxy/vmess 0.024s
?       github.com/v2ray/v2ray-core/proxy/vmess/inbound [no test files]
ok      github.com/v2ray/v2ray-core/proxy/vmess/io  0.469s
ok      github.com/v2ray/v2ray-core/proxy/vmess/outbound    0.003s
?       github.com/v2ray/v2ray-core/release/mobile  [no test files]
?       github.com/v2ray/v2ray-core/release/server  [no test files]
ok      github.com/v2ray/v2ray-core/shell/point 0.035s
?       github.com/v2ray/v2ray-core/testing/assert  [no test files]
?       github.com/v2ray/v2ray-core/testing/servers/http    [no test files]
?       github.com/v2ray/v2ray-core/testing/servers/tcp [no test files]
?       github.com/v2ray/v2ray-core/testing/servers/udp [no test files]
?       github.com/v2ray/v2ray-core/tools   [no test files]
ok      github.com/v2ray/v2ray-core/tools/build 40.259s
ok      github.com/v2ray/v2ray-core/tools/git   0.033s
?       github.com/v2ray/v2ray-core/transport   [no test files]
ok      github.com/v2ray/v2ray-core/transport/hub   0.375s
?       github.com/v2ray/v2ray-core/transport/hub/kcpv  [no test files]
?       github.com/v2ray/v2ray-core/transport/ray   [no test files]

我这里测试通过,不知道是什么原因。。。

@xiaokangwang
Copy link
Contributor Author

在检测问题

@xiaokangwang
Copy link
Contributor Author

xiaokangwang commented Jun 13, 2016

a8792b2 is the first bad commit
commit a8792b2
Author: Shelikhoo [email protected]
Date: Sat Jun 11 19:51:02 2016 +0800

Added Config for KCP connetions

:040000 040000 6c82ef1fa81091b0dfe30afb3125c5f9b2bda670 515f79c71edff5e1e84d6d535abb2d048fd6eecd M transport
用git找了一下问题,看看怎么解决

@xiaokangwang
Copy link
Contributor Author

我暂时无法确定到底是哪里出了问题。

@v2ray
Copy link
Collaborator

v2ray commented Jun 13, 2016

@xiaokangwang
Copy link
Contributor Author

你是通过什么看出来的?
难道是在自己没有启用KCP的配置文件上一运行就知道了。。。

@v2ray
Copy link
Collaborator

v2ray commented Jun 13, 2016

Travis 的 log 里面有:

/home/travis/gopath/src/github.com/v2ray/v2ray-core/transport/config_json.go:27 +0x106

@xiaokangwang
Copy link
Contributor Author

日志太多,眼花了😂

@v2ray v2ray merged commit 22ce652 into v2ray:master Jun 13, 2016
rosebe pushed a commit to rosebe/v2ray-core that referenced this pull request Sep 10, 2020
VMess AEAD will be used when alterId is 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants