Reformat code

This commit is contained in:
世界 2022-05-18 15:29:01 +08:00
parent 778992eeb9
commit f046feb9ca
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
153 changed files with 82 additions and 229 deletions

View file

@ -5,7 +5,6 @@ import (
"testing"
"github.com/google/go-cmp/cmp"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/testing/servers/tcp"

View file

@ -10,14 +10,13 @@ import (
"strings"
goxtls "github.com/xtls/go"
"golang.org/x/sys/unix"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/transport/internet"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/transport/internet/tls"
"github.com/xtls/xray-core/transport/internet/xtls"
"golang.org/x/sys/unix"
)
type Listener struct {

View file

@ -6,12 +6,6 @@ import (
"sync"
"time"
"google.golang.org/grpc"
"google.golang.org/grpc/backoff"
"google.golang.org/grpc/connectivity"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/keepalive"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/session"
@ -19,6 +13,11 @@ import (
"github.com/xtls/xray-core/transport/internet/grpc/encoding"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/transport/internet/tls"
"google.golang.org/grpc"
"google.golang.org/grpc/backoff"
"google.golang.org/grpc/connectivity"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/keepalive"
)
func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.MemoryStreamConfig) (stat.Connection, error) {

View file

@ -5,13 +5,12 @@ import (
"io"
"net"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/peer"
"github.com/xtls/xray-core/common/buf"
xnet "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/net/cnc"
"github.com/xtls/xray-core/common/signal/done"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/peer"
)
type HunkConn interface {

View file

@ -5,13 +5,12 @@ import (
"io"
"net"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/peer"
"github.com/xtls/xray-core/common/buf"
xnet "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/net/cnc"
"github.com/xtls/xray-core/common/signal/done"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/peer"
)
type MultiHunkConn interface {

View file

@ -4,16 +4,15 @@ import (
"context"
"time"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/keepalive"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/session"
"github.com/xtls/xray-core/transport/internet"
"github.com/xtls/xray-core/transport/internet/grpc/encoding"
"github.com/xtls/xray-core/transport/internet/tls"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/keepalive"
)
type Listener struct {

View file

@ -3,7 +3,6 @@ package http
import (
"bufio"
"net/http"
// required to use go:linkname
_ "unsafe"
)

View file

@ -8,8 +8,6 @@ import (
"sync"
"time"
"golang.org/x/net/http2"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/common/net"
@ -19,6 +17,7 @@ import (
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/transport/internet/tls"
"github.com/xtls/xray-core/transport/pipe"
"golang.org/x/net/http2"
)
type dialerConf struct {

View file

@ -7,7 +7,6 @@ import (
"time"
"github.com/google/go-cmp/cmp"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/common/net"

View file

@ -7,9 +7,6 @@ import (
"strings"
"time"
"golang.org/x/net/http2"
"golang.org/x/net/http2/h2c"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/net/cnc"
@ -19,6 +16,8 @@ import (
"github.com/xtls/xray-core/common/signal/done"
"github.com/xtls/xray-core/transport/internet"
"github.com/xtls/xray-core/transport/internet/tls"
"golang.org/x/net/http2"
"golang.org/x/net/http2/h2c"
)
type Listener struct {

View file

@ -4,7 +4,6 @@ import (
"testing"
"github.com/google/go-cmp/cmp"
"github.com/xtls/xray-core/common"
. "github.com/xtls/xray-core/transport/internet/kcp"
)

View file

@ -8,14 +8,13 @@ import (
"time"
"github.com/google/go-cmp/cmp"
"golang.org/x/sync/errgroup"
"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"
"github.com/xtls/xray-core/transport/internet/stat"
"golang.org/x/sync/errgroup"
)
func TestDialAndListen(t *testing.T) {

View file

@ -7,7 +7,6 @@ import (
"sync"
goxtls "github.com/xtls/go"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/common/net"

View file

@ -5,7 +5,6 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
. "github.com/xtls/xray-core/transport/internet/kcp"
)

View file

@ -5,11 +5,10 @@ import (
"crypto/cipher"
"crypto/sha256"
"golang.org/x/crypto/chacha20poly1305"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/protocol"
"github.com/xtls/xray-core/transport/internet"
"golang.org/x/crypto/chacha20poly1305"
)
func getAuth(config *Config) (cipher.AEAD, error) {

View file

@ -8,7 +8,6 @@ import (
"time"
"github.com/lucas-clemente/quic-go"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/common/net"

View file

@ -9,7 +9,6 @@ import (
"github.com/lucas-clemente/quic-go"
"github.com/lucas-clemente/quic-go/logging"
"github.com/lucas-clemente/quic-go/qlog"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/task"

View file

@ -8,7 +8,6 @@ import (
"github.com/lucas-clemente/quic-go"
"github.com/lucas-clemente/quic-go/logging"
"github.com/lucas-clemente/quic-go/qlog"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/protocol/tls/cert"

View file

@ -7,7 +7,6 @@ import (
"time"
"github.com/google/go-cmp/cmp"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/common/net"

View file

@ -5,7 +5,6 @@ import (
"testing"
"github.com/google/go-cmp/cmp"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/testing/servers/tcp"

View file

@ -9,7 +9,6 @@ import (
"syscall"
"github.com/pires/go-proxyproto"
"github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/session"
)

View file

@ -7,7 +7,6 @@ import (
"time"
goxtls "github.com/xtls/go"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/session"
@ -39,8 +38,7 @@ func ListenTCP(ctx context.Context, address net.Address, port net.Port, streamSe
if streamSettings.SocketSettings == nil {
streamSettings.SocketSettings = &internet.SocketConfig{}
}
streamSettings.SocketSettings.AcceptProxyProtocol =
l.config.AcceptProxyProtocol || streamSettings.SocketSettings.AcceptProxyProtocol
streamSettings.SocketSettings.AcceptProxyProtocol = l.config.AcceptProxyProtocol || streamSettings.SocketSettings.AcceptProxyProtocol
}
var listener net.Listener
var err error

View file

@ -4,7 +4,6 @@ import (
"crypto/tls"
utls "github.com/refraction-networking/utls"
"github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/common/net"
)

View file

@ -6,9 +6,8 @@ package udp
import (
"syscall"
"golang.org/x/sys/unix"
"github.com/xtls/xray-core/common/net"
"golang.org/x/sys/unix"
)
func RetrieveOriginalDest(oob []byte) net.Destination {

View file

@ -6,7 +6,6 @@ import (
"time"
"github.com/gorilla/websocket"
"github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/common/serial"

View file

@ -11,7 +11,6 @@ import (
"time"
"github.com/gorilla/websocket"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/session"

View file

@ -12,7 +12,6 @@ import (
"time"
"github.com/gorilla/websocket"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/net"
http_proto "github.com/xtls/xray-core/common/protocol/http"
@ -89,8 +88,7 @@ func ListenWS(ctx context.Context, address net.Address, port net.Port, streamSet
if streamSettings.SocketSettings == nil {
streamSettings.SocketSettings = &internet.SocketConfig{}
}
streamSettings.SocketSettings.AcceptProxyProtocol =
l.config.AcceptProxyProtocol || streamSettings.SocketSettings.AcceptProxyProtocol
streamSettings.SocketSettings.AcceptProxyProtocol = l.config.AcceptProxyProtocol || streamSettings.SocketSettings.AcceptProxyProtocol
}
var listener net.Listener
var err error

View file

@ -9,7 +9,6 @@ import (
"time"
xtls "github.com/xtls/go"
"github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/ocsp"
"github.com/xtls/xray-core/common/platform/filesystem"

View file

@ -6,7 +6,6 @@ import (
"time"
xtls "github.com/xtls/go"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/protocol/tls/cert"
. "github.com/xtls/xray-core/transport/internet/xtls"