This commit is contained in:
RPRX 2020-12-04 09:36:16 +08:00
parent ed8d6d743c
commit 16544c18ab
627 changed files with 3247 additions and 2635 deletions

View file

@ -5,8 +5,8 @@ package kcp
import (
"crypto/cipher"
"github.com/xtls/xray-core/v1/common"
"github.com/xtls/xray-core/v1/transport/internet"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/transport/internet"
)
const protocolName = "mkcp"

View file

@ -8,7 +8,7 @@ package kcp
import (
proto "github.com/golang/protobuf/proto"
serial "github.com/xtls/xray-core/v1/common/serial"
serial "github.com/xtls/xray-core/common/serial"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
@ -586,15 +586,14 @@ var file_transport_internet_kcp_config_proto_rawDesc = []byte{
0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e,
0x65, 0x74, 0x2e, 0x6b, 0x63, 0x70, 0x2e, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f,
0x6e, 0x53, 0x65, 0x65, 0x64, 0x52, 0x04, 0x73, 0x65, 0x65, 0x64, 0x4a, 0x04, 0x08, 0x09, 0x10,
0x0a, 0x42, 0x76, 0x0a, 0x1f, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x74, 0x72,
0x0a, 0x42, 0x73, 0x0a, 0x1f, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x74, 0x72,
0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, 0x74,
0x2e, 0x6b, 0x63, 0x70, 0x50, 0x01, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
0x2e, 0x6b, 0x63, 0x70, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d, 0x63, 0x6f, 0x72,
0x65, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2f, 0x69,
0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x2f, 0x6b, 0x63, 0x70, 0xaa, 0x02, 0x1b, 0x58, 0x72,
0x61, 0x79, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x49, 0x6e, 0x74,
0x65, 0x72, 0x6e, 0x65, 0x74, 0x2e, 0x4b, 0x63, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
0x65, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2f, 0x69, 0x6e, 0x74, 0x65,
0x72, 0x6e, 0x65, 0x74, 0x2f, 0x6b, 0x63, 0x70, 0xaa, 0x02, 0x1b, 0x58, 0x72, 0x61, 0x79, 0x2e,
0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e,
0x65, 0x74, 0x2e, 0x4b, 0x63, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

View file

@ -2,7 +2,7 @@ syntax = "proto3";
package xray.transport.internet.kcp;
option csharp_namespace = "Xray.Transport.Internet.Kcp";
option go_package = "github.com/xtls/xray-core/v1/transport/internet/kcp";
option go_package = "github.com/xtls/xray-core/transport/internet/kcp";
option java_package = "com.xray.transport.internet.kcp";
option java_multiple_files = true;

View file

@ -11,9 +11,9 @@ import (
"sync/atomic"
"time"
"github.com/xtls/xray-core/v1/common/buf"
"github.com/xtls/xray-core/v1/common/signal"
"github.com/xtls/xray-core/v1/common/signal/semaphore"
"github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/common/signal"
"github.com/xtls/xray-core/common/signal/semaphore"
)
var (

View file

@ -5,8 +5,8 @@ import (
"testing"
"time"
"github.com/xtls/xray-core/v1/common/buf"
. "github.com/xtls/xray-core/v1/transport/internet/kcp"
"github.com/xtls/xray-core/common/buf"
. "github.com/xtls/xray-core/transport/internet/kcp"
)
type NoOpCloser int

View file

@ -7,7 +7,7 @@ import (
"encoding/binary"
"hash/fnv"
"github.com/xtls/xray-core/v1/common"
"github.com/xtls/xray-core/common"
)
// SimpleAuthenticator is a legacy AEAD used for KCP encryption.

View file

@ -5,8 +5,8 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/xtls/xray-core/v1/common"
. "github.com/xtls/xray-core/v1/transport/internet/kcp"
"github.com/xtls/xray-core/common"
. "github.com/xtls/xray-core/transport/internet/kcp"
)
func TestSimpleAuthenticator(t *testing.T) {

View file

@ -5,7 +5,7 @@ import (
"crypto/cipher"
"crypto/sha256"
"github.com/xtls/xray-core/v1/common"
"github.com/xtls/xray-core/common"
)
func NewAEADAESGCMBasedOnSeed(seed string) cipher.AEAD {

View file

@ -7,13 +7,13 @@ import (
"io"
"sync/atomic"
"github.com/xtls/xray-core/v1/common"
"github.com/xtls/xray-core/v1/common/buf"
"github.com/xtls/xray-core/v1/common/dice"
"github.com/xtls/xray-core/v1/common/net"
"github.com/xtls/xray-core/v1/transport/internet"
"github.com/xtls/xray-core/v1/transport/internet/tls"
"github.com/xtls/xray-core/v1/transport/internet/xtls"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/common/dice"
"github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/transport/internet"
"github.com/xtls/xray-core/transport/internet/tls"
"github.com/xtls/xray-core/transport/internet/xtls"
)
var (

View file

@ -1,6 +1,6 @@
package kcp
import "github.com/xtls/xray-core/v1/common/errors"
import "github.com/xtls/xray-core/common/errors"
type errPathObjHolder struct{}

View file

@ -7,9 +7,9 @@ import (
"crypto/rand"
"io"
"github.com/xtls/xray-core/v1/common"
"github.com/xtls/xray-core/v1/common/buf"
"github.com/xtls/xray-core/v1/transport/internet"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/transport/internet"
)
type PacketReader interface {

View file

@ -3,7 +3,7 @@ package kcp_test
import (
"testing"
. "github.com/xtls/xray-core/v1/transport/internet/kcp"
. "github.com/xtls/xray-core/transport/internet/kcp"
)
func TestKCPPacketReader(t *testing.T) {

View file

@ -5,4 +5,4 @@
// xtaci@github for translating to Golang
package kcp
//go:generate go run github.com/xtls/xray-core/v1/common/errors/errorgen
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen

View file

@ -10,11 +10,11 @@ import (
"github.com/google/go-cmp/cmp"
"golang.org/x/sync/errgroup"
"github.com/xtls/xray-core/v1/common"
"github.com/xtls/xray-core/v1/common/errors"
"github.com/xtls/xray-core/v1/common/net"
"github.com/xtls/xray-core/v1/transport/internet"
. "github.com/xtls/xray-core/v1/transport/internet/kcp"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/transport/internet"
. "github.com/xtls/xray-core/transport/internet/kcp"
)
func TestDialAndListen(t *testing.T) {

View file

@ -10,13 +10,13 @@ import (
goxtls "github.com/xtls/go"
"github.com/xtls/xray-core/v1/common"
"github.com/xtls/xray-core/v1/common/buf"
"github.com/xtls/xray-core/v1/common/net"
"github.com/xtls/xray-core/v1/transport/internet"
"github.com/xtls/xray-core/v1/transport/internet/tls"
"github.com/xtls/xray-core/v1/transport/internet/udp"
"github.com/xtls/xray-core/v1/transport/internet/xtls"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/transport/internet"
"github.com/xtls/xray-core/transport/internet/tls"
"github.com/xtls/xray-core/transport/internet/udp"
"github.com/xtls/xray-core/transport/internet/xtls"
)
type ConnectionID struct {

View file

@ -6,9 +6,9 @@ import (
"io"
"sync"
"github.com/xtls/xray-core/v1/common/retry"
"github.com/xtls/xray-core/common/retry"
"github.com/xtls/xray-core/v1/common/buf"
"github.com/xtls/xray-core/common/buf"
)
type SegmentWriter interface {

View file

@ -5,7 +5,7 @@ package kcp
import (
"sync"
"github.com/xtls/xray-core/v1/common/buf"
"github.com/xtls/xray-core/common/buf"
)
type ReceivingWindow struct {

View file

@ -5,7 +5,7 @@ package kcp
import (
"encoding/binary"
"github.com/xtls/xray-core/v1/common/buf"
"github.com/xtls/xray-core/common/buf"
)
// Command is a KCP command that indicate the purpose of a Segment.

View file

@ -6,7 +6,7 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
. "github.com/xtls/xray-core/v1/transport/internet/kcp"
. "github.com/xtls/xray-core/transport/internet/kcp"
)
func TestBadSegment(t *testing.T) {

View file

@ -6,7 +6,7 @@ import (
"container/list"
"sync"
"github.com/xtls/xray-core/v1/common/buf"
"github.com/xtls/xray-core/common/buf"
)
type SendingWindow struct {