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

@ -1,4 +1,4 @@
// Package buf provides a light-weight memory allocation mechanism.
package buf // import "github.com/xtls/xray-core/v1/common/buf"
package buf // import "github.com/xtls/xray-core/common/buf"
//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

@ -3,7 +3,7 @@ package buf
import (
"io"
"github.com/xtls/xray-core/v1/common/bytespool"
"github.com/xtls/xray-core/common/bytespool"
)
const (

View file

@ -6,8 +6,8 @@ import (
"testing"
"github.com/google/go-cmp/cmp"
"github.com/xtls/xray-core/v1/common"
. "github.com/xtls/xray-core/v1/common/buf"
"github.com/xtls/xray-core/common"
. "github.com/xtls/xray-core/common/buf"
)
func TestBufferClear(t *testing.T) {

View file

@ -4,8 +4,8 @@ import (
"io"
"time"
"github.com/xtls/xray-core/v1/common/errors"
"github.com/xtls/xray-core/v1/common/signal"
"github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/common/signal"
)
type dataHandler func(MultiBuffer)

View file

@ -7,9 +7,9 @@ import (
"github.com/golang/mock/gomock"
"github.com/xtls/xray-core/v1/common/buf"
"github.com/xtls/xray-core/v1/common/errors"
"github.com/xtls/xray-core/v1/testing/mocks"
"github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/testing/mocks"
)
func TestReadError(t *testing.T) {

View file

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

View file

@ -5,9 +5,9 @@ import (
"io"
"testing"
. "github.com/xtls/xray-core/v1/common/buf"
"github.com/xtls/xray-core/v1/common/net"
"github.com/xtls/xray-core/v1/testing/servers/tcp"
. "github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/testing/servers/tcp"
)
func TestWriterCreation(t *testing.T) {

View file

@ -3,9 +3,9 @@ package buf
import (
"io"
"github.com/xtls/xray-core/v1/common"
"github.com/xtls/xray-core/v1/common/errors"
"github.com/xtls/xray-core/v1/common/serial"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/common/serial"
)
// ReadAllToBytes reads all content from the reader into a byte array, until EOF.

View file

@ -9,8 +9,8 @@ import (
"testing"
"github.com/google/go-cmp/cmp"
"github.com/xtls/xray-core/v1/common"
. "github.com/xtls/xray-core/v1/common/buf"
"github.com/xtls/xray-core/common"
. "github.com/xtls/xray-core/common/buf"
)
func TestMultiBufferRead(t *testing.T) {

View file

@ -3,8 +3,8 @@ package buf
import (
"io"
"github.com/xtls/xray-core/v1/common"
"github.com/xtls/xray-core/v1/common/errors"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/errors"
)
func readOneUDP(r io.Reader) (*Buffer, error) {

View file

@ -6,9 +6,9 @@ import (
"strings"
"testing"
"github.com/xtls/xray-core/v1/common"
. "github.com/xtls/xray-core/v1/common/buf"
"github.com/xtls/xray-core/v1/transport/pipe"
"github.com/xtls/xray-core/common"
. "github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/transport/pipe"
)
func TestBytesReaderWriteTo(t *testing.T) {

View file

@ -7,7 +7,7 @@ import (
"runtime"
"syscall"
"github.com/xtls/xray-core/v1/common/platform"
"github.com/xtls/xray-core/common/platform"
)
type allocStrategy struct {

View file

@ -9,9 +9,9 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/xtls/xray-core/v1/common"
. "github.com/xtls/xray-core/v1/common/buf"
"github.com/xtls/xray-core/v1/testing/servers/tcp"
"github.com/xtls/xray-core/common"
. "github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/testing/servers/tcp"
"golang.org/x/sync/errgroup"
)

View file

@ -5,8 +5,8 @@ import (
"net"
"sync"
"github.com/xtls/xray-core/v1/common"
"github.com/xtls/xray-core/v1/common/errors"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/errors"
)
// BufferToBytesWriter is a Writer that writes alloc.Buffer into underlying writer.

View file

@ -9,9 +9,9 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/xtls/xray-core/v1/common"
. "github.com/xtls/xray-core/v1/common/buf"
"github.com/xtls/xray-core/v1/transport/pipe"
"github.com/xtls/xray-core/common"
. "github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/transport/pipe"
)
func TestWriter(t *testing.T) {