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

@ -2,7 +2,7 @@
package commander package commander
//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
import ( import (
"context" "context"
@ -11,10 +11,10 @@ import (
"google.golang.org/grpc" "google.golang.org/grpc"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/common/signal/done" "github.com/xtls/xray-core/common/signal/done"
core "github.com/xtls/xray-core/v1/core" core "github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/v1/features/outbound" "github.com/xtls/xray-core/features/outbound"
) )
// Commander is a Xray feature that provides gRPC methods to external clients. // Commander is a Xray feature that provides gRPC methods to external clients.

View file

@ -8,7 +8,7 @@ package commander
import ( import (
proto "github.com/golang/protobuf/proto" 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" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl" protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect" reflect "reflect"
@ -139,13 +139,13 @@ var file_app_commander_config_proto_rawDesc = []byte{
0x65, 0x72, 0x69, 0x61, 0x6c, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61,
0x67, 0x65, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x22, 0x12, 0x0a, 0x10, 0x52, 0x67, 0x65, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x22, 0x12, 0x0a, 0x10, 0x52,
0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42,
0x5b, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x58, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e,
0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x65, 0x72, 0x50, 0x01, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x65, 0x72, 0x50, 0x01, 0x5a, 0x27, 0x67, 0x69, 0x74,
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 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, 0x61, 0x70, 0x70, 0x2f, 0x63, 0x6f, 0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x61,
0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x65, 0x72, 0xaa, 0x02, 0x12, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x41, 0x6e, 0x64, 0x65, 0x72, 0xaa, 0x02, 0x12, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x41, 0x70, 0x70, 0x2e,
0x70, 0x70, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x6f, 0x74, 0x6f, 0x33, 0x33,
} }
var ( var (

View file

@ -2,7 +2,7 @@ syntax = "proto3";
package xray.app.commander; package xray.app.commander;
option csharp_namespace = "Xray.App.Commander"; option csharp_namespace = "Xray.App.Commander";
option go_package = "github.com/xtls/xray-core/v1/app/commander"; option go_package = "github.com/xtls/xray-core/app/commander";
option java_package = "com.xray.app.commander"; option java_package = "com.xray.app.commander";
option java_multiple_files = true; option java_multiple_files = true;

View file

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

View file

@ -6,10 +6,10 @@ import (
"context" "context"
"sync" "sync"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/v1/common/signal/done" "github.com/xtls/xray-core/common/signal/done"
"github.com/xtls/xray-core/v1/transport" "github.com/xtls/xray-core/transport"
) )
// OutboundListener is a net.Listener for listening gRPC connections. // OutboundListener is a net.Listener for listening gRPC connections.

View file

@ -5,7 +5,7 @@ package commander
import ( import (
"context" "context"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/reflection" "google.golang.org/grpc/reflection"
) )

View file

@ -122,13 +122,13 @@ var file_app_dispatcher_config_proto_rawDesc = []byte{
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70,
0x2e, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x73, 0x73,
0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69,
0x6e, 0x67, 0x73, 0x42, 0x5e, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x6e, 0x67, 0x73, 0x42, 0x5b, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e,
0x61, 0x70, 0x70, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x50, 0x01, 0x61, 0x70, 0x70, 0x2e, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x50, 0x01,
0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x5a, 0x28, 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, 0x61, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70, 0x70, 0x2f,
0x70, 0x70, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0xaa, 0x02, 0x13, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0xaa, 0x02, 0x13, 0x58, 0x72, 0x61,
0x58, 0x72, 0x61, 0x79, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x79, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72,
0x68, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

View file

@ -2,7 +2,7 @@ syntax = "proto3";
package xray.app.dispatcher; package xray.app.dispatcher;
option csharp_namespace = "Xray.App.Dispatcher"; option csharp_namespace = "Xray.App.Dispatcher";
option go_package = "github.com/xtls/xray-core/v1/app/dispatcher"; option go_package = "github.com/xtls/xray-core/app/dispatcher";
option java_package = "com.xray.app.dispatcher"; option java_package = "com.xray.app.dispatcher";
option java_multiple_files = true; option java_multiple_files = true;

View file

@ -2,7 +2,7 @@
package dispatcher package dispatcher
//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
import ( import (
"context" "context"
@ -10,20 +10,20 @@ import (
"sync" "sync"
"time" "time"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/common/buf" "github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/v1/common/log" "github.com/xtls/xray-core/common/log"
"github.com/xtls/xray-core/v1/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/v1/common/protocol" "github.com/xtls/xray-core/common/protocol"
"github.com/xtls/xray-core/v1/common/session" "github.com/xtls/xray-core/common/session"
"github.com/xtls/xray-core/v1/core" "github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/v1/features/outbound" "github.com/xtls/xray-core/features/outbound"
"github.com/xtls/xray-core/v1/features/policy" "github.com/xtls/xray-core/features/policy"
"github.com/xtls/xray-core/v1/features/routing" "github.com/xtls/xray-core/features/routing"
routing_session "github.com/xtls/xray-core/v1/features/routing/session" routing_session "github.com/xtls/xray-core/features/routing/session"
"github.com/xtls/xray-core/v1/features/stats" "github.com/xtls/xray-core/features/stats"
"github.com/xtls/xray-core/v1/transport" "github.com/xtls/xray-core/transport"
"github.com/xtls/xray-core/v1/transport/pipe" "github.com/xtls/xray-core/transport/pipe"
) )
var ( var (

View file

@ -2,4 +2,4 @@
package dispatcher package dispatcher
//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

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

View file

@ -3,10 +3,10 @@
package dispatcher package dispatcher
import ( import (
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/common/protocol/bittorrent" "github.com/xtls/xray-core/common/protocol/bittorrent"
"github.com/xtls/xray-core/v1/common/protocol/http" "github.com/xtls/xray-core/common/protocol/http"
"github.com/xtls/xray-core/v1/common/protocol/tls" "github.com/xtls/xray-core/common/protocol/tls"
) )
type SniffResult interface { type SniffResult interface {

View file

@ -3,9 +3,9 @@
package dispatcher package dispatcher
import ( import (
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/common/buf" "github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/v1/features/stats" "github.com/xtls/xray-core/features/stats"
) )
type SizeStatWriter struct { type SizeStatWriter struct {

View file

@ -3,9 +3,9 @@ package dispatcher_test
import ( import (
"testing" "testing"
. "github.com/xtls/xray-core/v1/app/dispatcher" . "github.com/xtls/xray-core/app/dispatcher"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/common/buf" "github.com/xtls/xray-core/common/buf"
) )
type TestCounter int64 type TestCounter int64

View file

@ -8,8 +8,8 @@ package dns
import ( import (
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
router "github.com/xtls/xray-core/v1/app/router" router "github.com/xtls/xray-core/app/router"
net "github.com/xtls/xray-core/v1/common/net" net "github.com/xtls/xray-core/common/net"
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl" protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect" reflect "reflect"
@ -511,13 +511,12 @@ var file_app_dns_config_proto_rawDesc = []byte{
0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a,
0x04, 0x46, 0x75, 0x6c, 0x6c, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x75, 0x62, 0x64, 0x6f, 0x04, 0x46, 0x75, 0x6c, 0x6c, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x75, 0x62, 0x64, 0x6f,
0x6d, 0x61, 0x69, 0x6e, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x4b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x6d, 0x61, 0x69, 0x6e, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x4b, 0x65, 0x79, 0x77, 0x6f, 0x72,
0x64, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x65, 0x67, 0x65, 0x78, 0x10, 0x03, 0x42, 0x49, 0x64, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x65, 0x67, 0x65, 0x78, 0x10, 0x03, 0x42, 0x46,
0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x64, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x64,
0x6e, 0x73, 0x50, 0x01, 0x5a, 0x24, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6e, 0x73, 0x50, 0x01, 0x5a, 0x21, 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, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f,
0x76, 0x31, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x64, 0x6e, 0x73, 0xaa, 0x02, 0x0c, 0x58, 0x72, 0x61, 0x61, 0x70, 0x70, 0x2f, 0x64, 0x6e, 0x73, 0xaa, 0x02, 0x0c, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x41,
0x79, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x44, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x70, 0x70, 0x2e, 0x44, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x33,
} }
var ( var (

View file

@ -2,7 +2,7 @@ syntax = "proto3";
package xray.app.dns; package xray.app.dns;
option csharp_namespace = "Xray.App.Dns"; option csharp_namespace = "Xray.App.Dns";
option go_package = "github.com/xtls/xray-core/v1/app/dns"; option go_package = "github.com/xtls/xray-core/app/dns";
option java_package = "com.xray.app.dns"; option java_package = "com.xray.app.dns";
option java_multiple_files = true; option java_multiple_files = true;

View file

@ -1,4 +1,4 @@
// Package dns is an implementation of core.DNS feature. // Package dns is an implementation of core.DNS feature.
package dns package dns
//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

@ -6,10 +6,10 @@ import (
"encoding/binary" "encoding/binary"
"time" "time"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/common/errors" "github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/v1/common/net" "github.com/xtls/xray-core/common/net"
dns_feature "github.com/xtls/xray-core/v1/features/dns" dns_feature "github.com/xtls/xray-core/features/dns"
"golang.org/x/net/dns/dnsmessage" "golang.org/x/net/dns/dnsmessage"
) )

View file

@ -9,8 +9,8 @@ import (
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/miekg/dns" "github.com/miekg/dns"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/common/net" "github.com/xtls/xray-core/common/net"
"golang.org/x/net/dns/dnsmessage" "golang.org/x/net/dns/dnsmessage"
) )

View file

@ -14,15 +14,15 @@ import (
"sync/atomic" "sync/atomic"
"time" "time"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/v1/common/protocol/dns" "github.com/xtls/xray-core/common/protocol/dns"
"github.com/xtls/xray-core/v1/common/session" "github.com/xtls/xray-core/common/session"
"github.com/xtls/xray-core/v1/common/signal/pubsub" "github.com/xtls/xray-core/common/signal/pubsub"
"github.com/xtls/xray-core/v1/common/task" "github.com/xtls/xray-core/common/task"
dns_feature "github.com/xtls/xray-core/v1/features/dns" dns_feature "github.com/xtls/xray-core/features/dns"
"github.com/xtls/xray-core/v1/features/routing" "github.com/xtls/xray-core/features/routing"
"github.com/xtls/xray-core/v1/transport/internet" "github.com/xtls/xray-core/transport/internet"
"golang.org/x/net/dns/dnsmessage" "golang.org/x/net/dns/dnsmessage"
) )

View file

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

View file

@ -3,10 +3,10 @@
package dns package dns
import ( import (
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/v1/common/strmatcher" "github.com/xtls/xray-core/common/strmatcher"
"github.com/xtls/xray-core/v1/features" "github.com/xtls/xray-core/features"
) )
// StaticHosts represents static domain-ip mapping in DNS server. // StaticHosts represents static domain-ip mapping in DNS server.

View file

@ -5,9 +5,9 @@ import (
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
. "github.com/xtls/xray-core/v1/app/dns" . "github.com/xtls/xray-core/app/dns"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/common/net" "github.com/xtls/xray-core/common/net"
) )
func TestStaticHosts(t *testing.T) { func TestStaticHosts(t *testing.T) {

View file

@ -5,8 +5,8 @@ package dns
import ( import (
"context" "context"
"github.com/xtls/xray-core/v1/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/v1/features/dns/localdns" "github.com/xtls/xray-core/features/dns/localdns"
) )
// IPOption is an object for IP query options. // IPOption is an object for IP query options.

View file

@ -5,8 +5,8 @@ import (
"testing" "testing"
"time" "time"
. "github.com/xtls/xray-core/v1/app/dns" . "github.com/xtls/xray-core/app/dns"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
) )
func TestLocalNameServer(t *testing.T) { func TestLocalNameServer(t *testing.T) {

View file

@ -2,7 +2,7 @@
package dns package dns
//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
import ( import (
"context" "context"
@ -13,17 +13,17 @@ import (
"sync" "sync"
"time" "time"
"github.com/xtls/xray-core/v1/app/router" "github.com/xtls/xray-core/app/router"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/common/errors" "github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/v1/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/v1/common/session" "github.com/xtls/xray-core/common/session"
"github.com/xtls/xray-core/v1/common/strmatcher" "github.com/xtls/xray-core/common/strmatcher"
"github.com/xtls/xray-core/v1/common/uuid" "github.com/xtls/xray-core/common/uuid"
core "github.com/xtls/xray-core/v1/core" core "github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/v1/features" "github.com/xtls/xray-core/features"
"github.com/xtls/xray-core/v1/features/dns" "github.com/xtls/xray-core/features/dns"
"github.com/xtls/xray-core/v1/features/routing" "github.com/xtls/xray-core/features/routing"
) )
// Server is a DNS rely server. // Server is a DNS rely server.

View file

@ -7,19 +7,19 @@ import (
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/miekg/dns" "github.com/miekg/dns"
"github.com/xtls/xray-core/v1/app/dispatcher" "github.com/xtls/xray-core/app/dispatcher"
. "github.com/xtls/xray-core/v1/app/dns" . "github.com/xtls/xray-core/app/dns"
"github.com/xtls/xray-core/v1/app/policy" "github.com/xtls/xray-core/app/policy"
"github.com/xtls/xray-core/v1/app/proxyman" "github.com/xtls/xray-core/app/proxyman"
_ "github.com/xtls/xray-core/v1/app/proxyman/outbound" _ "github.com/xtls/xray-core/app/proxyman/outbound"
"github.com/xtls/xray-core/v1/app/router" "github.com/xtls/xray-core/app/router"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/v1/common/serial" "github.com/xtls/xray-core/common/serial"
"github.com/xtls/xray-core/v1/core" "github.com/xtls/xray-core/core"
feature_dns "github.com/xtls/xray-core/v1/features/dns" feature_dns "github.com/xtls/xray-core/features/dns"
"github.com/xtls/xray-core/v1/proxy/freedom" "github.com/xtls/xray-core/proxy/freedom"
"github.com/xtls/xray-core/v1/testing/servers/udp" "github.com/xtls/xray-core/testing/servers/udp"
) )
type staticHandler struct { type staticHandler struct {

View file

@ -9,16 +9,16 @@ import (
"sync/atomic" "sync/atomic"
"time" "time"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/v1/common/protocol/dns" "github.com/xtls/xray-core/common/protocol/dns"
udp_proto "github.com/xtls/xray-core/v1/common/protocol/udp" udp_proto "github.com/xtls/xray-core/common/protocol/udp"
"github.com/xtls/xray-core/v1/common/session" "github.com/xtls/xray-core/common/session"
"github.com/xtls/xray-core/v1/common/signal/pubsub" "github.com/xtls/xray-core/common/signal/pubsub"
"github.com/xtls/xray-core/v1/common/task" "github.com/xtls/xray-core/common/task"
dns_feature "github.com/xtls/xray-core/v1/features/dns" dns_feature "github.com/xtls/xray-core/features/dns"
"github.com/xtls/xray-core/v1/features/routing" "github.com/xtls/xray-core/features/routing"
"github.com/xtls/xray-core/v1/transport/internet/udp" "github.com/xtls/xray-core/transport/internet/udp"
"golang.org/x/net/dns/dnsmessage" "golang.org/x/net/dns/dnsmessage"
) )

View file

@ -2,16 +2,16 @@
package command package command
//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
import ( import (
"context" "context"
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
"github.com/xtls/xray-core/v1/app/log" "github.com/xtls/xray-core/app/log"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/core" "github.com/xtls/xray-core/core"
) )
type LoggerServer struct { type LoggerServer struct {

View file

@ -4,15 +4,15 @@ import (
"context" "context"
"testing" "testing"
"github.com/xtls/xray-core/v1/app/dispatcher" "github.com/xtls/xray-core/app/dispatcher"
"github.com/xtls/xray-core/v1/app/log" "github.com/xtls/xray-core/app/log"
. "github.com/xtls/xray-core/v1/app/log/command" . "github.com/xtls/xray-core/app/log/command"
"github.com/xtls/xray-core/v1/app/proxyman" "github.com/xtls/xray-core/app/proxyman"
_ "github.com/xtls/xray-core/v1/app/proxyman/inbound" _ "github.com/xtls/xray-core/app/proxyman/inbound"
_ "github.com/xtls/xray-core/v1/app/proxyman/outbound" _ "github.com/xtls/xray-core/app/proxyman/outbound"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/common/serial" "github.com/xtls/xray-core/common/serial"
"github.com/xtls/xray-core/v1/core" "github.com/xtls/xray-core/core"
) )
func TestLoggerRestart(t *testing.T) { func TestLoggerRestart(t *testing.T) {

View file

@ -156,14 +156,14 @@ var file_app_log_command_config_proto_rawDesc = []byte{
0x4c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e,
0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x6c, 0x6f, 0x67, 0x2e, 0x63, 0x6f, 0x6d, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x6c, 0x6f, 0x67, 0x2e, 0x63, 0x6f, 0x6d,
0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x52, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x4c, 0x6f, 0x67, 0x67, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x52, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x4c, 0x6f, 0x67, 0x67,
0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x61, 0x0a, 0x18, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x5e, 0x0a, 0x18,
0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x6c, 0x6f, 0x67, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x6c, 0x6f, 0x67,
0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x50, 0x01, 0x5a, 0x2c, 0x67, 0x69, 0x74, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68,
0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 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, 0x61, 0x70, 0x70, 0x2f, 0x6c, 0x6f, 0x67, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x6c, 0x6f, 0x67, 0x2f, 0x63, 0x6f,
0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0xaa, 0x02, 0x14, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0xaa, 0x02, 0x14, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x41, 0x70, 0x70,
0x41, 0x70, 0x70, 0x2e, 0x4c, 0x6f, 0x67, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x62, 0x2e, 0x4c, 0x6f, 0x67, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x62, 0x06, 0x70, 0x72,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

View file

@ -2,7 +2,7 @@ syntax = "proto3";
package xray.app.log.command; package xray.app.log.command;
option csharp_namespace = "Xray.App.Log.Command"; option csharp_namespace = "Xray.App.Log.Command";
option go_package = "github.com/xtls/xray-core/v1/app/log/command"; option go_package = "github.com/xtls/xray-core/app/log/command";
option java_package = "com.xray.app.log.command"; option java_package = "com.xray.app.log.command";
option java_multiple_files = true; option java_multiple_files = true;

View file

@ -63,6 +63,7 @@ type UnsafeLoggerServiceServer interface {
func RegisterLoggerServiceServer(s grpc.ServiceRegistrar, srv LoggerServiceServer) { func RegisterLoggerServiceServer(s grpc.ServiceRegistrar, srv LoggerServiceServer) {
s.RegisterService(&_LoggerService_serviceDesc, srv) s.RegisterService(&_LoggerService_serviceDesc, srv)
s.RegisterService(&_LoggerService_serviceDesc2, srv)
} }
func _LoggerService_RestartLogger_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _LoggerService_RestartLogger_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
@ -95,3 +96,16 @@ var _LoggerService_serviceDesc = grpc.ServiceDesc{
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "app/log/command/config.proto", Metadata: "app/log/command/config.proto",
} }
var _LoggerService_serviceDesc2 = grpc.ServiceDesc{
ServiceName: "v2ray.core.app.log.command.LoggerService",
HandlerType: (*LoggerServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "RestartLogger",
Handler: _LoggerService_RestartLogger_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "app/log/command/config.proto",
}

View file

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

View file

@ -8,7 +8,7 @@ package log
import ( import (
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
log "github.com/xtls/xray-core/v1/common/log" log "github.com/xtls/xray-core/common/log"
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl" protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect" reflect "reflect"
@ -184,12 +184,12 @@ var file_app_log_config_proto_rawDesc = []byte{
0x74, 0x68, 0x2a, 0x35, 0x0a, 0x07, 0x4c, 0x6f, 0x67, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x74, 0x68, 0x2a, 0x35, 0x0a, 0x07, 0x4c, 0x6f, 0x67, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a,
0x04, 0x4e, 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x73, 0x6f, 0x04, 0x4e, 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x73, 0x6f,
0x6c, 0x65, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x10, 0x02, 0x12, 0x09, 0x6c, 0x65, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x10, 0x02, 0x12, 0x09,
0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x10, 0x03, 0x42, 0x49, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x10, 0x03, 0x42, 0x46, 0x0a, 0x10, 0x63, 0x6f, 0x6d,
0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x6c, 0x6f, 0x67, 0x50, 0x01, 0x5a, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x6c, 0x6f, 0x67, 0x50, 0x01, 0x5a,
0x24, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x21, 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, 0x61, 0x70, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x6c,
0x70, 0x2f, 0x6c, 0x6f, 0x67, 0xaa, 0x02, 0x0c, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x41, 0x70, 0x70, 0x6f, 0x67, 0xaa, 0x02, 0x0c, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x4c, 0x6f,
0x2e, 0x4c, 0x6f, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

View file

@ -2,7 +2,7 @@ syntax = "proto3";
package xray.app.log; package xray.app.log;
option csharp_namespace = "Xray.App.Log"; option csharp_namespace = "Xray.App.Log";
option go_package = "github.com/xtls/xray-core/v1/app/log"; option go_package = "github.com/xtls/xray-core/app/log";
option java_package = "com.xray.app.log"; option java_package = "com.xray.app.log";
option java_multiple_files = true; option java_multiple_files = true;

View file

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

View file

@ -2,14 +2,14 @@
package log package log
//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
import ( import (
"context" "context"
"sync" "sync"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/common/log" "github.com/xtls/xray-core/common/log"
) )
// Instance is a log.Handler that handles logs. // Instance is a log.Handler that handles logs.

View file

@ -3,8 +3,8 @@
package log package log
import ( import (
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/common/log" "github.com/xtls/xray-core/common/log"
) )
type HandlerCreatorOptions struct { type HandlerCreatorOptions struct {

View file

@ -5,10 +5,10 @@ import (
"testing" "testing"
"github.com/golang/mock/gomock" "github.com/golang/mock/gomock"
"github.com/xtls/xray-core/v1/app/log" "github.com/xtls/xray-core/app/log"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
clog "github.com/xtls/xray-core/v1/common/log" clog "github.com/xtls/xray-core/common/log"
"github.com/xtls/xray-core/v1/testing/mocks" "github.com/xtls/xray-core/testing/mocks"
) )
func TestCustomLogHandler(t *testing.T) { func TestCustomLogHandler(t *testing.T) {

View file

@ -3,7 +3,7 @@ package policy
import ( import (
"time" "time"
"github.com/xtls/xray-core/v1/features/policy" "github.com/xtls/xray-core/features/policy"
) )
// Duration converts Second to time.Duration. // Duration converts Second to time.Duration.

View file

@ -554,12 +554,12 @@ var file_app_policy_config_proto_rawDesc = []byte{
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x78, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x78,
0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x50,
0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01,
0x42, 0x52, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x42, 0x4f, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70,
0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x50, 0x01, 0x5a, 0x27, 0x67, 0x69, 0x74, 0x68, 0x75, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x50, 0x01, 0x5a, 0x24, 0x67, 0x69, 0x74, 0x68, 0x75,
0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d,
0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0xaa,
0x63, 0x79, 0xaa, 0x02, 0x0f, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x50, 0x6f, 0x02, 0x0f, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63,
0x6c, 0x69, 0x63, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

View file

@ -2,7 +2,7 @@ syntax = "proto3";
package xray.app.policy; package xray.app.policy;
option csharp_namespace = "Xray.App.Policy"; option csharp_namespace = "Xray.App.Policy";
option go_package = "github.com/xtls/xray-core/v1/app/policy"; option go_package = "github.com/xtls/xray-core/app/policy";
option java_package = "com.xray.app.policy"; option java_package = "com.xray.app.policy";
option java_multiple_files = true; option java_multiple_files = true;

View file

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

View file

@ -3,8 +3,8 @@ package policy
import ( import (
"context" "context"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/features/policy" "github.com/xtls/xray-core/features/policy"
) )
// Instance is an instance of Policy manager. // Instance is an instance of Policy manager.

View file

@ -5,9 +5,9 @@ import (
"testing" "testing"
"time" "time"
. "github.com/xtls/xray-core/v1/app/policy" . "github.com/xtls/xray-core/app/policy"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/features/policy" "github.com/xtls/xray-core/features/policy"
) )
func TestPolicy(t *testing.T) { func TestPolicy(t *testing.T) {

View file

@ -1,4 +1,4 @@
// Package policy is an implementation of policy.Manager feature. // Package policy is an implementation of policy.Manager feature.
package policy package policy
//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

@ -7,11 +7,11 @@ import (
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/core" "github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/v1/features/inbound" "github.com/xtls/xray-core/features/inbound"
"github.com/xtls/xray-core/v1/features/outbound" "github.com/xtls/xray-core/features/outbound"
"github.com/xtls/xray-core/v1/proxy" "github.com/xtls/xray-core/proxy"
) )
// InboundOperation is the interface for operations that applies to inbound handlers. // InboundOperation is the interface for operations that applies to inbound handlers.

View file

@ -8,9 +8,9 @@ package command
import ( import (
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
protocol "github.com/xtls/xray-core/v1/common/protocol" protocol "github.com/xtls/xray-core/common/protocol"
serial "github.com/xtls/xray-core/v1/common/serial" serial "github.com/xtls/xray-core/common/serial"
core "github.com/xtls/xray-core/v1/core" core "github.com/xtls/xray-core/core"
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl" protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect" reflect "reflect"
@ -788,14 +788,14 @@ var file_app_proxyman_command_command_proto_rawDesc = []byte{
0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61,
0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x41, 0x6c, 0x74, 0x65, 0x72, 0x4f, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x41, 0x6c, 0x74, 0x65, 0x72, 0x4f,
0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
0x00, 0x42, 0x70, 0x0a, 0x1d, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x00, 0x42, 0x6d, 0x0a, 0x1d, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70,
0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61,
0x6e, 0x64, 0x50, 0x01, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6e, 0x64, 0x50, 0x01, 0x5a, 0x2e, 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, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f,
0x76, 0x31, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2f, 0x63, 0x6f, 0x6d,
0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0xaa, 0x02, 0x19, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x41, 0x6d, 0x61, 0x6e, 0x64, 0xaa, 0x02, 0x19, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x41, 0x70, 0x70, 0x2e,
0x70, 0x70, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64,
0x61, 0x6e, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

View file

@ -2,7 +2,7 @@ syntax = "proto3";
package xray.app.proxyman.command; package xray.app.proxyman.command;
option csharp_namespace = "Xray.App.Proxyman.Command"; option csharp_namespace = "Xray.App.Proxyman.Command";
option go_package = "github.com/xtls/xray-core/v1/app/proxyman/command"; option go_package = "github.com/xtls/xray-core/app/proxyman/command";
option java_package = "com.xray.app.proxyman.command"; option java_package = "com.xray.app.proxyman.command";
option java_multiple_files = true; option java_multiple_files = true;

View file

@ -133,6 +133,7 @@ type UnsafeHandlerServiceServer interface {
func RegisterHandlerServiceServer(s grpc.ServiceRegistrar, srv HandlerServiceServer) { func RegisterHandlerServiceServer(s grpc.ServiceRegistrar, srv HandlerServiceServer) {
s.RegisterService(&_HandlerService_serviceDesc, srv) s.RegisterService(&_HandlerService_serviceDesc, srv)
s.RegisterService(&_HandlerService_serviceDesc2, srv)
} }
func _HandlerService_AddInbound_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _HandlerService_AddInbound_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
@ -275,3 +276,36 @@ var _HandlerService_serviceDesc = grpc.ServiceDesc{
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "app/proxyman/command/command.proto", Metadata: "app/proxyman/command/command.proto",
} }
var _HandlerService_serviceDesc2 = grpc.ServiceDesc{
ServiceName: "v2ray.core.app.proxyman.command.HandlerService",
HandlerType: (*HandlerServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "AddInbound",
Handler: _HandlerService_AddInbound_Handler,
},
{
MethodName: "RemoveInbound",
Handler: _HandlerService_RemoveInbound_Handler,
},
{
MethodName: "AlterInbound",
Handler: _HandlerService_AlterInbound_Handler,
},
{
MethodName: "AddOutbound",
Handler: _HandlerService_AddOutbound_Handler,
},
{
MethodName: "RemoveOutbound",
Handler: _HandlerService_RemoveOutbound_Handler,
},
{
MethodName: "AlterOutbound",
Handler: _HandlerService_AlterOutbound_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "app/proxyman/command/command.proto",
}

View file

@ -1,3 +1,3 @@
package command package command
//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

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

View file

@ -8,9 +8,9 @@ package proxyman
import ( import (
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
net "github.com/xtls/xray-core/v1/common/net" net "github.com/xtls/xray-core/common/net"
serial "github.com/xtls/xray-core/v1/common/serial" serial "github.com/xtls/xray-core/common/serial"
internet "github.com/xtls/xray-core/v1/transport/internet" internet "github.com/xtls/xray-core/transport/internet"
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl" protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect" reflect "reflect"
@ -835,13 +835,13 @@ var file_app_proxyman_config_proto_rawDesc = []byte{
0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63,
0x79, 0x2a, 0x23, 0x0a, 0x0e, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x79, 0x2a, 0x23, 0x0a, 0x0e, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63,
0x6f, 0x6c, 0x73, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x54, 0x54, 0x50, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x6f, 0x6c, 0x73, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x54, 0x54, 0x50, 0x10, 0x00, 0x12, 0x07, 0x0a,
0x03, 0x54, 0x4c, 0x53, 0x10, 0x01, 0x42, 0x58, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x03, 0x54, 0x4c, 0x53, 0x10, 0x01, 0x42, 0x55, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72,
0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x50, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x50,
0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x01, 0x5a, 0x26, 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, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70, 0x70,
0x61, 0x70, 0x70, 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0xaa, 0x02, 0x11, 0x58, 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0xaa, 0x02, 0x11, 0x58, 0x72, 0x61, 0x79,
0x72, 0x61, 0x79, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x6d, 0x61, 0x6e, 0x62, 0x06, 0x70,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

View file

@ -2,7 +2,7 @@ syntax = "proto3";
package xray.app.proxyman; package xray.app.proxyman;
option csharp_namespace = "Xray.App.Proxyman"; option csharp_namespace = "Xray.App.Proxyman";
option go_package = "github.com/xtls/xray-core/v1/app/proxyman"; option go_package = "github.com/xtls/xray-core/app/proxyman";
option java_package = "com.xray.app.proxyman"; option java_package = "com.xray.app.proxyman";
option java_multiple_files = true; option java_multiple_files = true;

View file

@ -3,17 +3,17 @@ package inbound
import ( import (
"context" "context"
"github.com/xtls/xray-core/v1/app/proxyman" "github.com/xtls/xray-core/app/proxyman"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/common/dice" "github.com/xtls/xray-core/common/dice"
"github.com/xtls/xray-core/v1/common/errors" "github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/v1/common/mux" "github.com/xtls/xray-core/common/mux"
"github.com/xtls/xray-core/v1/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/v1/core" "github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/v1/features/policy" "github.com/xtls/xray-core/features/policy"
"github.com/xtls/xray-core/v1/features/stats" "github.com/xtls/xray-core/features/stats"
"github.com/xtls/xray-core/v1/proxy" "github.com/xtls/xray-core/proxy"
"github.com/xtls/xray-core/v1/transport/internet" "github.com/xtls/xray-core/transport/internet"
) )
func getStatCounter(v *core.Instance, tag string) (stats.Counter, stats.Counter) { func getStatCounter(v *core.Instance, tag string) (stats.Counter, stats.Counter) {

View file

@ -5,14 +5,14 @@ import (
"sync" "sync"
"time" "time"
"github.com/xtls/xray-core/v1/app/proxyman" "github.com/xtls/xray-core/app/proxyman"
"github.com/xtls/xray-core/v1/common/dice" "github.com/xtls/xray-core/common/dice"
"github.com/xtls/xray-core/v1/common/mux" "github.com/xtls/xray-core/common/mux"
"github.com/xtls/xray-core/v1/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/v1/common/task" "github.com/xtls/xray-core/common/task"
"github.com/xtls/xray-core/v1/core" "github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/v1/proxy" "github.com/xtls/xray-core/proxy"
"github.com/xtls/xray-core/v1/transport/internet" "github.com/xtls/xray-core/transport/internet"
) )
type DynamicInboundHandler struct { type DynamicInboundHandler struct {

View file

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

View file

@ -1,17 +1,17 @@
package inbound package inbound
//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
import ( import (
"context" "context"
"sync" "sync"
"github.com/xtls/xray-core/v1/app/proxyman" "github.com/xtls/xray-core/app/proxyman"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/common/serial" "github.com/xtls/xray-core/common/serial"
"github.com/xtls/xray-core/v1/common/session" "github.com/xtls/xray-core/common/session"
"github.com/xtls/xray-core/v1/core" "github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/v1/features/inbound" "github.com/xtls/xray-core/features/inbound"
) )
// Manager is to manage all inbound handlers. // Manager is to manage all inbound handlers.

View file

@ -6,21 +6,21 @@ import (
"sync/atomic" "sync/atomic"
"time" "time"
"github.com/xtls/xray-core/v1/app/proxyman" "github.com/xtls/xray-core/app/proxyman"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/common/buf" "github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/v1/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/v1/common/serial" "github.com/xtls/xray-core/common/serial"
"github.com/xtls/xray-core/v1/common/session" "github.com/xtls/xray-core/common/session"
"github.com/xtls/xray-core/v1/common/signal/done" "github.com/xtls/xray-core/common/signal/done"
"github.com/xtls/xray-core/v1/common/task" "github.com/xtls/xray-core/common/task"
"github.com/xtls/xray-core/v1/features/routing" "github.com/xtls/xray-core/features/routing"
"github.com/xtls/xray-core/v1/features/stats" "github.com/xtls/xray-core/features/stats"
"github.com/xtls/xray-core/v1/proxy" "github.com/xtls/xray-core/proxy"
"github.com/xtls/xray-core/v1/transport/internet" "github.com/xtls/xray-core/transport/internet"
"github.com/xtls/xray-core/v1/transport/internet/tcp" "github.com/xtls/xray-core/transport/internet/tcp"
"github.com/xtls/xray-core/v1/transport/internet/udp" "github.com/xtls/xray-core/transport/internet/udp"
"github.com/xtls/xray-core/v1/transport/pipe" "github.com/xtls/xray-core/transport/pipe"
) )
type worker interface { type worker interface {
@ -78,17 +78,7 @@ func (w *tcpWorker) callback(conn internet.Connection) {
}) })
} }
} }
ctx = session.ContextWithInbound(ctx, &session.Inbound{
Source: net.DestinationFromAddr(conn.RemoteAddr()),
Gateway: net.TCPDestination(w.address, w.port),
Tag: w.tag,
})
content := new(session.Content)
if w.sniffingConfig != nil {
content.SniffingRequest.Enabled = w.sniffingConfig.Enabled
content.SniffingRequest.OverrideDestinationForProtocol = w.sniffingConfig.DestinationOverride
}
ctx = session.ContextWithContent(ctx, content)
if w.uplinkCounter != nil || w.downlinkCounter != nil { if w.uplinkCounter != nil || w.downlinkCounter != nil {
conn = &internet.StatCouterConnection{ conn = &internet.StatCouterConnection{
Connection: conn, Connection: conn,
@ -96,6 +86,20 @@ func (w *tcpWorker) callback(conn internet.Connection) {
WriteCounter: w.downlinkCounter, WriteCounter: w.downlinkCounter,
} }
} }
ctx = session.ContextWithInbound(ctx, &session.Inbound{
Source: net.DestinationFromAddr(conn.RemoteAddr()),
Gateway: net.TCPDestination(w.address, w.port),
Tag: w.tag,
Conn: conn,
})
content := new(session.Content)
if w.sniffingConfig != nil {
content.SniffingRequest.Enabled = w.sniffingConfig.Enabled
content.SniffingRequest.OverrideDestinationForProtocol = w.sniffingConfig.DestinationOverride
}
ctx = session.ContextWithContent(ctx, content)
if err := w.proxy.Process(ctx, net.Network_TCP, conn, w.dispatcher); err != nil { if err := w.proxy.Process(ctx, net.Network_TCP, conn, w.dispatcher); err != nil {
newError("connection ends").Base(err).WriteToLog(session.ExportIDToError(ctx)) newError("connection ends").Base(err).WriteToLog(session.ExportIDToError(ctx))
} }

View file

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

View file

@ -3,20 +3,20 @@ package outbound
import ( import (
"context" "context"
"github.com/xtls/xray-core/v1/app/proxyman" "github.com/xtls/xray-core/app/proxyman"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/common/mux" "github.com/xtls/xray-core/common/mux"
"github.com/xtls/xray-core/v1/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/v1/common/session" "github.com/xtls/xray-core/common/session"
"github.com/xtls/xray-core/v1/core" "github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/v1/features/outbound" "github.com/xtls/xray-core/features/outbound"
"github.com/xtls/xray-core/v1/features/policy" "github.com/xtls/xray-core/features/policy"
"github.com/xtls/xray-core/v1/features/stats" "github.com/xtls/xray-core/features/stats"
"github.com/xtls/xray-core/v1/proxy" "github.com/xtls/xray-core/proxy"
"github.com/xtls/xray-core/v1/transport" "github.com/xtls/xray-core/transport"
"github.com/xtls/xray-core/v1/transport/internet" "github.com/xtls/xray-core/transport/internet"
"github.com/xtls/xray-core/v1/transport/internet/tls" "github.com/xtls/xray-core/transport/internet/tls"
"github.com/xtls/xray-core/v1/transport/pipe" "github.com/xtls/xray-core/transport/pipe"
) )
func getStatCounter(v *core.Instance, tag string) (stats.Counter, stats.Counter) { func getStatCounter(v *core.Instance, tag string) (stats.Counter, stats.Counter) {

View file

@ -4,15 +4,15 @@ import (
"context" "context"
"testing" "testing"
"github.com/xtls/xray-core/v1/app/policy" "github.com/xtls/xray-core/app/policy"
. "github.com/xtls/xray-core/v1/app/proxyman/outbound" . "github.com/xtls/xray-core/app/proxyman/outbound"
"github.com/xtls/xray-core/v1/app/stats" "github.com/xtls/xray-core/app/stats"
"github.com/xtls/xray-core/v1/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/v1/common/serial" "github.com/xtls/xray-core/common/serial"
core "github.com/xtls/xray-core/v1/core" core "github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/v1/features/outbound" "github.com/xtls/xray-core/features/outbound"
"github.com/xtls/xray-core/v1/proxy/freedom" "github.com/xtls/xray-core/proxy/freedom"
"github.com/xtls/xray-core/v1/transport/internet" "github.com/xtls/xray-core/transport/internet"
) )
func TestInterfaces(t *testing.T) { func TestInterfaces(t *testing.T) {

View file

@ -1,17 +1,17 @@
package outbound package outbound
//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
import ( import (
"context" "context"
"strings" "strings"
"sync" "sync"
"github.com/xtls/xray-core/v1/app/proxyman" "github.com/xtls/xray-core/app/proxyman"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/common/errors" "github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/v1/core" "github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/v1/features/outbound" "github.com/xtls/xray-core/features/outbound"
) )
// Manager is to manage all outbound handlers. // Manager is to manage all outbound handlers.

View file

@ -7,13 +7,13 @@ import (
"time" "time"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
"github.com/xtls/xray-core/v1/common/mux" "github.com/xtls/xray-core/common/mux"
"github.com/xtls/xray-core/v1/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/v1/common/session" "github.com/xtls/xray-core/common/session"
"github.com/xtls/xray-core/v1/common/task" "github.com/xtls/xray-core/common/task"
"github.com/xtls/xray-core/v1/features/routing" "github.com/xtls/xray-core/features/routing"
"github.com/xtls/xray-core/v1/transport" "github.com/xtls/xray-core/transport"
"github.com/xtls/xray-core/v1/transport/pipe" "github.com/xtls/xray-core/transport/pipe"
) )
// Bridge is a component in reverse proxy, that relays connections from Portal to local address. // Bridge is a component in reverse proxy, that relays connections from Portal to local address.

View file

@ -6,7 +6,7 @@ import (
"crypto/rand" "crypto/rand"
"io" "io"
"github.com/xtls/xray-core/v1/common/dice" "github.com/xtls/xray-core/common/dice"
) )
func (c *Control) FillInRandom() { func (c *Control) FillInRandom() {

View file

@ -321,13 +321,12 @@ var file_app_reverse_config_proto_rawDesc = []byte{
0x0b, 0x32, 0x1e, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x65, 0x76, 0x0b, 0x32, 0x1e, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x65, 0x76,
0x65, 0x72, 0x73, 0x65, 0x2e, 0x50, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x65, 0x72, 0x73, 0x65, 0x2e, 0x50, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69,
0x67, 0x52, 0x0c, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42, 0x67, 0x52, 0x0c, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42,
0x59, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x56, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x78,
0x79, 0x2e, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x01, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x79, 0x2e, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x01, 0x5a, 0x25, 0x67, 0x69, 0x74,
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 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, 0x61, 0x70, 0x70, 0x2f, 0x72, 0x65, 0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x72, 0x65, 0x76, 0x65, 0x72,
0x76, 0x65, 0x72, 0x73, 0x65, 0xaa, 0x02, 0x12, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x50, 0x72, 0x6f, 0x73, 0x65, 0xaa, 0x02, 0x12, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x2e,
0x78, 0x79, 0x2e, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x6f, 0x33,
} }
var ( var (

View file

@ -2,7 +2,7 @@ syntax = "proto3";
package xray.app.reverse; package xray.app.reverse;
option csharp_namespace = "Xray.Proxy.Reverse"; option csharp_namespace = "Xray.Proxy.Reverse";
option go_package = "github.com/xtls/xray-core/v1/app/reverse"; option go_package = "github.com/xtls/xray-core/app/reverse";
option java_package = "com.xray.proxy.reverse"; option java_package = "com.xray.proxy.reverse";
option java_multiple_files = true; option java_multiple_files = true;

View file

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

View file

@ -8,15 +8,15 @@ import (
"time" "time"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/common/buf" "github.com/xtls/xray-core/common/buf"
"github.com/xtls/xray-core/v1/common/mux" "github.com/xtls/xray-core/common/mux"
"github.com/xtls/xray-core/v1/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/v1/common/session" "github.com/xtls/xray-core/common/session"
"github.com/xtls/xray-core/v1/common/task" "github.com/xtls/xray-core/common/task"
"github.com/xtls/xray-core/v1/features/outbound" "github.com/xtls/xray-core/features/outbound"
"github.com/xtls/xray-core/v1/transport" "github.com/xtls/xray-core/transport"
"github.com/xtls/xray-core/v1/transport/pipe" "github.com/xtls/xray-core/transport/pipe"
) )
type Portal struct { type Portal struct {

View file

@ -3,8 +3,8 @@ package reverse_test
import ( import (
"testing" "testing"
"github.com/xtls/xray-core/v1/app/reverse" "github.com/xtls/xray-core/app/reverse"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
) )
func TestStaticPickerEmpty(t *testing.T) { func TestStaticPickerEmpty(t *testing.T) {

View file

@ -2,17 +2,17 @@
package reverse package reverse
//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
import ( import (
"context" "context"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/common/errors" "github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/v1/common/net" "github.com/xtls/xray-core/common/net"
core "github.com/xtls/xray-core/v1/core" core "github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/v1/features/outbound" "github.com/xtls/xray-core/features/outbound"
"github.com/xtls/xray-core/v1/features/routing" "github.com/xtls/xray-core/features/routing"
) )
const ( const (

View file

@ -3,8 +3,8 @@
package router package router
import ( import (
"github.com/xtls/xray-core/v1/common/dice" "github.com/xtls/xray-core/common/dice"
"github.com/xtls/xray-core/v1/features/outbound" "github.com/xtls/xray-core/features/outbound"
) )
type BalancingStrategy interface { type BalancingStrategy interface {

View file

@ -2,7 +2,7 @@
package command package command
//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
import ( import (
"context" "context"
@ -10,10 +10,10 @@ import (
"google.golang.org/grpc" "google.golang.org/grpc"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/core" "github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/v1/features/routing" "github.com/xtls/xray-core/features/routing"
"github.com/xtls/xray-core/v1/features/stats" "github.com/xtls/xray-core/features/stats"
) )
// routingServer is an implementation of RoutingService. // routingServer is an implementation of RoutingService.

View file

@ -8,7 +8,7 @@ package command
import ( import (
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
net "github.com/xtls/xray-core/v1/common/net" net "github.com/xtls/xray-core/common/net"
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl" protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect" reflect "reflect"
@ -409,15 +409,14 @@ var file_app_router_command_command_proto_rawDesc = []byte{
0x64, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x64, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x27, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f,
0x75, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x52, 0x6f, 0x75, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x52, 0x6f, 0x75,
0x74, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x00, 0x42, 0x6a, 0x0a, 0x74, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x00, 0x42, 0x67, 0x0a,
0x1b, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f, 0x1b, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x72, 0x6f,
0x75, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x50, 0x01, 0x5a, 0x2f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x50, 0x01, 0x5a, 0x2c,
0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 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, 0x61, 0x70, 0x70, 0x78, 0x72, 0x61, 0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x72, 0x6f,
0x2f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0xaa, 0x75, 0x74, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0xaa, 0x02, 0x17, 0x58,
0x02, 0x17, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x61, 0x79, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x43,
0x72, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x33,
} }
var ( var (

View file

@ -2,7 +2,7 @@ syntax = "proto3";
package xray.app.router.command; package xray.app.router.command;
option csharp_namespace = "Xray.App.Router.Command"; option csharp_namespace = "Xray.App.Router.Command";
option go_package = "github.com/xtls/xray-core/v1/app/router/command"; option go_package = "github.com/xtls/xray-core/app/router/command";
option java_package = "com.xray.app.router.command"; option java_package = "com.xray.app.router.command";
option java_multiple_files = true; option java_multiple_files = true;

View file

@ -100,6 +100,7 @@ type UnsafeRoutingServiceServer interface {
func RegisterRoutingServiceServer(s grpc.ServiceRegistrar, srv RoutingServiceServer) { func RegisterRoutingServiceServer(s grpc.ServiceRegistrar, srv RoutingServiceServer) {
s.RegisterService(&_RoutingService_serviceDesc, srv) s.RegisterService(&_RoutingService_serviceDesc, srv)
s.RegisterService(&_RoutingService_serviceDesc2, srv)
} }
func _RoutingService_SubscribeRoutingStats_Handler(srv interface{}, stream grpc.ServerStream) error { func _RoutingService_SubscribeRoutingStats_Handler(srv interface{}, stream grpc.ServerStream) error {
@ -159,3 +160,22 @@ var _RoutingService_serviceDesc = grpc.ServiceDesc{
}, },
Metadata: "app/router/command/command.proto", Metadata: "app/router/command/command.proto",
} }
var _RoutingService_serviceDesc2 = grpc.ServiceDesc{
ServiceName: "v2ray.core.app.router.command.RoutingService",
HandlerType: (*RoutingServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "TestRoute",
Handler: _RoutingService_TestRoute_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "SubscribeRoutingStats",
Handler: _RoutingService_SubscribeRoutingStats_Handler,
ServerStreams: true,
},
},
Metadata: "app/router/command/command.proto",
}

View file

@ -8,13 +8,13 @@ import (
"github.com/golang/mock/gomock" "github.com/golang/mock/gomock"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts" "github.com/google/go-cmp/cmp/cmpopts"
"github.com/xtls/xray-core/v1/app/router" "github.com/xtls/xray-core/app/router"
. "github.com/xtls/xray-core/v1/app/router/command" . "github.com/xtls/xray-core/app/router/command"
"github.com/xtls/xray-core/v1/app/stats" "github.com/xtls/xray-core/app/stats"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/v1/features/routing" "github.com/xtls/xray-core/features/routing"
"github.com/xtls/xray-core/v1/testing/mocks" "github.com/xtls/xray-core/testing/mocks"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/test/bufconn" "google.golang.org/grpc/test/bufconn"
) )

View file

@ -3,8 +3,8 @@ package command
import ( import (
"strings" "strings"
"github.com/xtls/xray-core/v1/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/v1/features/routing" "github.com/xtls/xray-core/features/routing"
) )
// routingContext is an wrapper of protobuf RoutingContext as implementation of routing.Context and routing.Route. // routingContext is an wrapper of protobuf RoutingContext as implementation of routing.Context and routing.Route.

View file

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

View file

@ -8,9 +8,9 @@ import (
"go.starlark.net/starlark" "go.starlark.net/starlark"
"go.starlark.net/syntax" "go.starlark.net/syntax"
"github.com/xtls/xray-core/v1/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/v1/common/strmatcher" "github.com/xtls/xray-core/common/strmatcher"
"github.com/xtls/xray-core/v1/features/routing" "github.com/xtls/xray-core/features/routing"
) )
type Condition interface { type Condition interface {

View file

@ -6,7 +6,7 @@ import (
"encoding/binary" "encoding/binary"
"sort" "sort"
"github.com/xtls/xray-core/v1/common/net" "github.com/xtls/xray-core/common/net"
) )
type ipv6 struct { type ipv6 struct {

View file

@ -6,11 +6,11 @@ import (
"testing" "testing"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
"github.com/xtls/xray-core/v1/app/router" "github.com/xtls/xray-core/app/router"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/v1/common/platform" "github.com/xtls/xray-core/common/platform"
"github.com/xtls/xray-core/v1/common/platform/filesystem" "github.com/xtls/xray-core/common/platform/filesystem"
) )
func init() { func init() {

View file

@ -8,17 +8,17 @@ import (
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
. "github.com/xtls/xray-core/v1/app/router" . "github.com/xtls/xray-core/app/router"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/common/errors" "github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/v1/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/v1/common/platform" "github.com/xtls/xray-core/common/platform"
"github.com/xtls/xray-core/v1/common/platform/filesystem" "github.com/xtls/xray-core/common/platform/filesystem"
"github.com/xtls/xray-core/v1/common/protocol" "github.com/xtls/xray-core/common/protocol"
"github.com/xtls/xray-core/v1/common/protocol/http" "github.com/xtls/xray-core/common/protocol/http"
"github.com/xtls/xray-core/v1/common/session" "github.com/xtls/xray-core/common/session"
"github.com/xtls/xray-core/v1/features/routing" "github.com/xtls/xray-core/features/routing"
routing_session "github.com/xtls/xray-core/v1/features/routing/session" routing_session "github.com/xtls/xray-core/features/routing/session"
) )
func init() { func init() {

View file

@ -3,9 +3,9 @@
package router package router
import ( import (
"github.com/xtls/xray-core/v1/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/v1/features/outbound" "github.com/xtls/xray-core/features/outbound"
"github.com/xtls/xray-core/v1/features/routing" "github.com/xtls/xray-core/features/routing"
) )
// CIDRList is an alias of []*CIDR to provide sort.Interface. // CIDRList is an alias of []*CIDR to provide sort.Interface.

View file

@ -8,7 +8,7 @@ package router
import ( import (
proto "github.com/golang/protobuf/proto" proto "github.com/golang/protobuf/proto"
net "github.com/xtls/xray-core/v1/common/net" net "github.com/xtls/xray-core/common/net"
protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl" protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect" reflect "reflect"
@ -1018,12 +1018,12 @@ var file_app_router_config_proto_rawDesc = []byte{
0x73, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x55, 0x73, 0x65, 0x49, 0x70, 0x10, 0x01, 0x12, 0x10, 0x73, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x55, 0x73, 0x65, 0x49, 0x70, 0x10, 0x01, 0x12, 0x10,
0x0a, 0x0c, 0x49, 0x70, 0x49, 0x66, 0x4e, 0x6f, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x10, 0x02, 0x0a, 0x0c, 0x49, 0x70, 0x49, 0x66, 0x4e, 0x6f, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x10, 0x02,
0x12, 0x0e, 0x0a, 0x0a, 0x49, 0x70, 0x4f, 0x6e, 0x44, 0x65, 0x6d, 0x61, 0x6e, 0x64, 0x10, 0x03, 0x12, 0x0e, 0x0a, 0x0a, 0x49, 0x70, 0x4f, 0x6e, 0x44, 0x65, 0x6d, 0x61, 0x6e, 0x64, 0x10, 0x03,
0x42, 0x52, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x42, 0x4f, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70,
0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x50, 0x01, 0x5a, 0x27, 0x67, 0x69, 0x74, 0x68, 0x75, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x50, 0x01, 0x5a, 0x24, 0x67, 0x69, 0x74, 0x68, 0x75,
0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d,
0x63, 0x6f, 0x72, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x72, 0x6f, 0x75, 0x74, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0xaa,
0x65, 0x72, 0xaa, 0x02, 0x0f, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x52, 0x6f, 0x02, 0x0f, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65,
0x75, 0x74, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

View file

@ -2,7 +2,7 @@ syntax = "proto3";
package xray.app.router; package xray.app.router;
option csharp_namespace = "Xray.App.Router"; option csharp_namespace = "Xray.App.Router";
option go_package = "github.com/xtls/xray-core/v1/app/router"; option go_package = "github.com/xtls/xray-core/app/router";
option java_package = "com.xray.app.router"; option java_package = "com.xray.app.router";
option java_multiple_files = true; option java_multiple_files = true;

View file

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

View file

@ -2,17 +2,17 @@
package router package router
//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
import ( import (
"context" "context"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/core" "github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/v1/features/dns" "github.com/xtls/xray-core/features/dns"
"github.com/xtls/xray-core/v1/features/outbound" "github.com/xtls/xray-core/features/outbound"
"github.com/xtls/xray-core/v1/features/routing" "github.com/xtls/xray-core/features/routing"
routing_dns "github.com/xtls/xray-core/v1/features/routing/dns" routing_dns "github.com/xtls/xray-core/features/routing/dns"
) )
// Router is an implementation of routing.Router. // Router is an implementation of routing.Router.

View file

@ -5,13 +5,13 @@ import (
"testing" "testing"
"github.com/golang/mock/gomock" "github.com/golang/mock/gomock"
. "github.com/xtls/xray-core/v1/app/router" . "github.com/xtls/xray-core/app/router"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/common/net" "github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/v1/common/session" "github.com/xtls/xray-core/common/session"
"github.com/xtls/xray-core/v1/features/outbound" "github.com/xtls/xray-core/features/outbound"
routing_session "github.com/xtls/xray-core/v1/features/routing/session" routing_session "github.com/xtls/xray-core/features/routing/session"
"github.com/xtls/xray-core/v1/testing/mocks" "github.com/xtls/xray-core/testing/mocks"
) )
type mockOutboundManager struct { type mockOutboundManager struct {

View file

@ -6,7 +6,7 @@ import (
"context" "context"
"sync" "sync"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
) )
// Channel is an implementation of stats.Channel. // Channel is an implementation of stats.Channel.

View file

@ -6,9 +6,9 @@ import (
"testing" "testing"
"time" "time"
. "github.com/xtls/xray-core/v1/app/stats" . "github.com/xtls/xray-core/app/stats"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/features/stats" "github.com/xtls/xray-core/features/stats"
) )
func TestStatsChannel(t *testing.T) { func TestStatsChannel(t *testing.T) {

View file

@ -2,7 +2,7 @@
package command package command
//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
import ( import (
"context" "context"
@ -11,11 +11,11 @@ import (
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
"github.com/xtls/xray-core/v1/app/stats" "github.com/xtls/xray-core/app/stats"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/v1/common/strmatcher" "github.com/xtls/xray-core/common/strmatcher"
"github.com/xtls/xray-core/v1/core" "github.com/xtls/xray-core/core"
feature_stats "github.com/xtls/xray-core/v1/features/stats" feature_stats "github.com/xtls/xray-core/features/stats"
) )
// statsServer is an implementation of StatsService. // statsServer is an implementation of StatsService.

View file

@ -547,14 +547,14 @@ var file_app_stats_command_command_proto_rawDesc = []byte{
0x79, 0x73, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x79, 0x73, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28,
0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x73, 0x2e,
0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x53, 0x79, 0x73, 0x53, 0x74, 0x61, 0x74, 0x73, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x53, 0x79, 0x73, 0x53, 0x74, 0x61, 0x74, 0x73,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x67, 0x0a, 0x1a, 0x63, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x64, 0x0a, 0x1a, 0x63, 0x6f,
0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x73, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x73,
0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x50, 0x01, 0x5a, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x50, 0x01, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68,
0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 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, 0x61, 0x70, 0x70, 0x2f, 0x73, 0x74, 0x61, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x73, 0x2f,
0x74, 0x73, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0xaa, 0x02, 0x16, 0x58, 0x72, 0x61, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0xaa, 0x02, 0x16, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x41,
0x79, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x70, 0x70, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64,
0x61, 0x6e, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

View file

@ -2,7 +2,7 @@ syntax = "proto3";
package xray.app.stats.command; package xray.app.stats.command;
option csharp_namespace = "Xray.App.Stats.Command"; option csharp_namespace = "Xray.App.Stats.Command";
option go_package = "github.com/xtls/xray-core/v1/app/stats/command"; option go_package = "github.com/xtls/xray-core/app/stats/command";
option java_package = "com.xray.app.stats.command"; option java_package = "com.xray.app.stats.command";
option java_multiple_files = true; option java_multiple_files = true;

View file

@ -91,6 +91,7 @@ type UnsafeStatsServiceServer interface {
func RegisterStatsServiceServer(s grpc.ServiceRegistrar, srv StatsServiceServer) { func RegisterStatsServiceServer(s grpc.ServiceRegistrar, srv StatsServiceServer) {
s.RegisterService(&_StatsService_serviceDesc, srv) s.RegisterService(&_StatsService_serviceDesc, srv)
s.RegisterService(&_StatsService_serviceDesc2, srv)
} }
func _StatsService_GetStats_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _StatsService_GetStats_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
@ -167,3 +168,24 @@ var _StatsService_serviceDesc = grpc.ServiceDesc{
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "app/stats/command/command.proto", Metadata: "app/stats/command/command.proto",
} }
var _StatsService_serviceDesc2 = grpc.ServiceDesc{
ServiceName: "v2ray.core.app.stats.command.StatsService",
HandlerType: (*StatsServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetStats",
Handler: _StatsService_GetStats_Handler,
},
{
MethodName: "QueryStats",
Handler: _StatsService_QueryStats_Handler,
},
{
MethodName: "GetSysStats",
Handler: _StatsService_GetSysStats_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "app/stats/command/command.proto",
}

View file

@ -7,9 +7,9 @@ import (
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts" "github.com/google/go-cmp/cmp/cmpopts"
"github.com/xtls/xray-core/v1/app/stats" "github.com/xtls/xray-core/app/stats"
. "github.com/xtls/xray-core/v1/app/stats/command" . "github.com/xtls/xray-core/app/stats/command"
"github.com/xtls/xray-core/v1/common" "github.com/xtls/xray-core/common"
) )
func TestGetStats(t *testing.T) { func TestGetStats(t *testing.T) {

View file

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

View file

@ -139,13 +139,12 @@ var file_app_stats_config_proto_rawDesc = []byte{
0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0f, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0f, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72,
0x69, 0x62, 0x65, 0x72, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x42, 0x75, 0x66, 0x69, 0x62, 0x65, 0x72, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x42, 0x75, 0x66,
0x66, 0x65, 0x72, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x42, 0x66, 0x65, 0x72, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x42,
0x75, 0x66, 0x66, 0x65, 0x72, 0x53, 0x69, 0x7a, 0x65, 0x42, 0x4f, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x75, 0x66, 0x66, 0x65, 0x72, 0x53, 0x69, 0x7a, 0x65, 0x42, 0x4c, 0x0a, 0x12, 0x63, 0x6f, 0x6d,
0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x73, 0x50, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x73, 0x50,
0x01, 0x5a, 0x26, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x01, 0x5a, 0x23, 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, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x61, 0x70, 0x70,
0x61, 0x70, 0x70, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x73, 0xaa, 0x02, 0x0e, 0x58, 0x72, 0x61, 0x79, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x73, 0xaa, 0x02, 0x0e, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x41, 0x70,
0x2e, 0x41, 0x70, 0x70, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x70, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x6f, 0x33,
} }
var ( var (

View file

@ -2,7 +2,7 @@ syntax = "proto3";
package xray.app.stats; package xray.app.stats;
option csharp_namespace = "Xray.App.Stats"; option csharp_namespace = "Xray.App.Stats";
option go_package = "github.com/xtls/xray-core/v1/app/stats"; option go_package = "github.com/xtls/xray-core/app/stats";
option java_package = "com.xray.app.stats"; option java_package = "com.xray.app.stats";
option java_multiple_files = true; option java_multiple_files = true;

Some files were not shown because too many files have changed in this diff Show more