command

package
v0.0.0-...-945e4a5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2023 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_app_router_command_command_proto protoreflect.FileDescriptor
View Source
var RoutingService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "xray.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",
}

RoutingService_ServiceDesc is the grpc.ServiceDesc for RoutingService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func AsProtobufMessage

func AsProtobufMessage(fieldSelectors []string) func(routing.Route) *RoutingContext

AsProtobufMessage takes selectors of fields and returns a function to convert routing.Route to protobuf RoutingContext.

func AsRoutingContext

func AsRoutingContext(r *RoutingContext) routing.Context

AsRoutingContext converts a protobuf RoutingContext into an implementation of routing.Context.

func AsRoutingRoute

func AsRoutingRoute(r *RoutingContext) routing.Route

AsRoutingRoute converts a protobuf RoutingContext into an implementation of routing.Route.

func RegisterRoutingServiceServer

func RegisterRoutingServiceServer(s grpc.ServiceRegistrar, srv RoutingServiceServer)

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

func (*Config) Descriptor deprecated

func (*Config) Descriptor() ([]byte, []int)

Deprecated: Use Config.ProtoReflect.Descriptor instead.

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) ProtoReflect

func (x *Config) ProtoReflect() protoreflect.Message

func (*Config) Reset

func (x *Config) Reset()

func (*Config) String

func (x *Config) String() string

type RoutingContext

type RoutingContext struct {
	InboundTag        string            `protobuf:"bytes,1,opt,name=InboundTag,proto3" json:"InboundTag,omitempty"`
	Network           net.Network       `protobuf:"varint,2,opt,name=Network,proto3,enum=xray.common.net.Network" json:"Network,omitempty"`
	SourceIPs         [][]byte          `protobuf:"bytes,3,rep,name=SourceIPs,proto3" json:"SourceIPs,omitempty"`
	TargetIPs         [][]byte          `protobuf:"bytes,4,rep,name=TargetIPs,proto3" json:"TargetIPs,omitempty"`
	SourcePort        uint32            `protobuf:"varint,5,opt,name=SourcePort,proto3" json:"SourcePort,omitempty"`
	TargetPort        uint32            `protobuf:"varint,6,opt,name=TargetPort,proto3" json:"TargetPort,omitempty"`
	TargetDomain      string            `protobuf:"bytes,7,opt,name=TargetDomain,proto3" json:"TargetDomain,omitempty"`
	Protocol          string            `protobuf:"bytes,8,opt,name=Protocol,proto3" json:"Protocol,omitempty"`
	User              string            `protobuf:"bytes,9,opt,name=User,proto3" json:"User,omitempty"`
	Attributes        map[string]string `` /* 162-byte string literal not displayed */
	OutboundGroupTags []string          `protobuf:"bytes,11,rep,name=OutboundGroupTags,proto3" json:"OutboundGroupTags,omitempty"`
	OutboundTag       string            `protobuf:"bytes,12,opt,name=OutboundTag,proto3" json:"OutboundTag,omitempty"`
	// contains filtered or unexported fields
}

RoutingContext is the context with information relative to routing process. It conforms to the structure of xray.features.routing.Context and xray.features.routing.Route.

func (*RoutingContext) Descriptor deprecated

func (*RoutingContext) Descriptor() ([]byte, []int)

Deprecated: Use RoutingContext.ProtoReflect.Descriptor instead.

func (*RoutingContext) GetAttributes

func (x *RoutingContext) GetAttributes() map[string]string

func (*RoutingContext) GetInboundTag

func (x *RoutingContext) GetInboundTag() string

func (*RoutingContext) GetNetwork

func (x *RoutingContext) GetNetwork() net.Network

func (*RoutingContext) GetOutboundGroupTags

func (x *RoutingContext) GetOutboundGroupTags() []string

func (*RoutingContext) GetOutboundTag

func (x *RoutingContext) GetOutboundTag() string

func (*RoutingContext) GetProtocol

func (x *RoutingContext) GetProtocol() string

func (*RoutingContext) GetSourceIPs

func (x *RoutingContext) GetSourceIPs() [][]byte

func (*RoutingContext) GetSourcePort

func (x *RoutingContext) GetSourcePort() uint32

func (*RoutingContext) GetTargetDomain

func (x *RoutingContext) GetTargetDomain() string

func (*RoutingContext) GetTargetIPs

func (x *RoutingContext) GetTargetIPs() [][]byte

func (*RoutingContext) GetTargetPort

func (x *RoutingContext) GetTargetPort() uint32

func (*RoutingContext) GetUser

func (x *RoutingContext) GetUser() string

func (*RoutingContext) ProtoMessage

func (*RoutingContext) ProtoMessage()

func (*RoutingContext) ProtoReflect

func (x *RoutingContext) ProtoReflect() protoreflect.Message

func (*RoutingContext) Reset

func (x *RoutingContext) Reset()

func (*RoutingContext) String

func (x *RoutingContext) String() string

type RoutingServiceClient

type RoutingServiceClient interface {
	SubscribeRoutingStats(ctx context.Context, in *SubscribeRoutingStatsRequest, opts ...grpc.CallOption) (RoutingService_SubscribeRoutingStatsClient, error)
	TestRoute(ctx context.Context, in *TestRouteRequest, opts ...grpc.CallOption) (*RoutingContext, error)
}

RoutingServiceClient is the client API for RoutingService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

type RoutingServiceServer

type RoutingServiceServer interface {
	SubscribeRoutingStats(*SubscribeRoutingStatsRequest, RoutingService_SubscribeRoutingStatsServer) error
	TestRoute(context.Context, *TestRouteRequest) (*RoutingContext, error)
	// contains filtered or unexported methods
}

RoutingServiceServer is the server API for RoutingService service. All implementations must embed UnimplementedRoutingServiceServer for forward compatibility

func NewRoutingServer

func NewRoutingServer(router routing.Router, routingStats stats.Channel) RoutingServiceServer

NewRoutingServer creates a statistics service with statistics manager.

type RoutingService_SubscribeRoutingStatsClient

type RoutingService_SubscribeRoutingStatsClient interface {
	Recv() (*RoutingContext, error)
	grpc.ClientStream
}

type RoutingService_SubscribeRoutingStatsServer

type RoutingService_SubscribeRoutingStatsServer interface {
	Send(*RoutingContext) error
	grpc.ServerStream
}

type SubscribeRoutingStatsRequest

type SubscribeRoutingStatsRequest struct {
	FieldSelectors []string `protobuf:"bytes,1,rep,name=FieldSelectors,proto3" json:"FieldSelectors,omitempty"`
	// contains filtered or unexported fields
}

SubscribeRoutingStatsRequest subscribes to routing statistics channel if opened by xray-core. * FieldSelectors selects a subset of fields in routing statistics to return. Valid selectors:

  • inbound: Selects connection's inbound tag.
  • network: Selects connection's network.
  • ip: Equivalent as "ip_source" and "ip_target", selects both source and target IP.
  • port: Equivalent as "port_source" and "port_target", selects both source and target port.
  • domain: Selects target domain.
  • protocol: Select connection's protocol.
  • user: Select connection's inbound user email.
  • attributes: Select connection's additional attributes.
  • outbound: Equivalent as "outbound" and "outbound_group", select both outbound tag and outbound group tags.

* If FieldSelectors is left empty, all fields will be returned.

func (*SubscribeRoutingStatsRequest) Descriptor deprecated

func (*SubscribeRoutingStatsRequest) Descriptor() ([]byte, []int)

Deprecated: Use SubscribeRoutingStatsRequest.ProtoReflect.Descriptor instead.

func (*SubscribeRoutingStatsRequest) GetFieldSelectors

func (x *SubscribeRoutingStatsRequest) GetFieldSelectors() []string

func (*SubscribeRoutingStatsRequest) ProtoMessage

func (*SubscribeRoutingStatsRequest) ProtoMessage()

func (*SubscribeRoutingStatsRequest) ProtoReflect

func (*SubscribeRoutingStatsRequest) Reset

func (x *SubscribeRoutingStatsRequest) Reset()

func (*SubscribeRoutingStatsRequest) String

type TestRouteRequest

type TestRouteRequest struct {
	RoutingContext *RoutingContext `protobuf:"bytes,1,opt,name=RoutingContext,proto3" json:"RoutingContext,omitempty"`
	FieldSelectors []string        `protobuf:"bytes,2,rep,name=FieldSelectors,proto3" json:"FieldSelectors,omitempty"`
	PublishResult  bool            `protobuf:"varint,3,opt,name=PublishResult,proto3" json:"PublishResult,omitempty"`
	// contains filtered or unexported fields
}

TestRouteRequest manually tests a routing result according to the routing context message. * RoutingContext is the routing message without outbound information. * FieldSelectors selects the fields to return in the routing result. All fields are returned if left empty. * PublishResult broadcasts the routing result to routing statistics channel if set true.

func (*TestRouteRequest) Descriptor deprecated

func (*TestRouteRequest) Descriptor() ([]byte, []int)

Deprecated: Use TestRouteRequest.ProtoReflect.Descriptor instead.

func (*TestRouteRequest) GetFieldSelectors

func (x *TestRouteRequest) GetFieldSelectors() []string

func (*TestRouteRequest) GetPublishResult

func (x *TestRouteRequest) GetPublishResult() bool

func (*TestRouteRequest) GetRoutingContext

func (x *TestRouteRequest) GetRoutingContext() *RoutingContext

func (*TestRouteRequest) ProtoMessage

func (*TestRouteRequest) ProtoMessage()

func (*TestRouteRequest) ProtoReflect

func (x *TestRouteRequest) ProtoReflect() protoreflect.Message

func (*TestRouteRequest) Reset

func (x *TestRouteRequest) Reset()

func (*TestRouteRequest) String

func (x *TestRouteRequest) String() string

type UnimplementedRoutingServiceServer

type UnimplementedRoutingServiceServer struct {
}

UnimplementedRoutingServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedRoutingServiceServer) TestRoute

type UnsafeRoutingServiceServer

type UnsafeRoutingServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeRoutingServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to RoutingServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL