1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-04-24 06:29:10 -04:00

refine kcp header and security

This commit is contained in:
Darien Raymond
2016-12-08 16:27:41 +01:00
parent 0ad629ca31
commit 0917866f38
39 changed files with 530 additions and 393 deletions

View File

@@ -4,14 +4,18 @@ import (
"net"
"testing"
"time"
"v2ray.com/core/testing/assert"
"v2ray.com/core/transport/internet"
"v2ray.com/core/transport/internet/internal"
. "v2ray.com/core/transport/internet/kcp"
)
type NoOpConn struct{}
func (o *NoOpConn) Overhead() int {
return 0
}
func (o *NoOpConn) Write(b []byte) (int, error) {
return len(b), nil
}
@@ -48,7 +52,7 @@ func (o *NoOpConn) Id() internal.ConnectionId {
return internal.ConnectionId{}
}
func (o *NoOpConn) Reset(auth internet.Authenticator, input func([]byte)) {}
func (o *NoOpConn) Reset(input func([]Segment)) {}
type NoOpRecycler struct{}
@@ -57,7 +61,7 @@ func (o *NoOpRecycler) Put(internal.ConnectionId, net.Conn) {}
func TestConnectionReadTimeout(t *testing.T) {
assert := assert.On(t)
conn := NewConnection(1, &NoOpConn{}, &NoOpRecycler{}, NewSimpleAuthenticator(), &Config{})
conn := NewConnection(1, &NoOpConn{}, &NoOpRecycler{}, &Config{})
conn.SetReadDeadline(time.Now().Add(time.Second))
b := make([]byte, 1024)