command

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RoutingService_SubscribeRoutingStats_FullMethodName  = "/xray.app.router.command.RoutingService/SubscribeRoutingStats"
	RoutingService_TestRoute_FullMethodName              = "/xray.app.router.command.RoutingService/TestRoute"
	RoutingService_GetBalancerInfo_FullMethodName        = "/xray.app.router.command.RoutingService/GetBalancerInfo"
	RoutingService_OverrideBalancerTarget_FullMethodName = "/xray.app.router.command.RoutingService/OverrideBalancerTarget"
	RoutingService_AddRule_FullMethodName                = "/xray.app.router.command.RoutingService/AddRule"
	RoutingService_RemoveRule_FullMethodName             = "/xray.app.router.command.RoutingService/RemoveRule"
)

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,
		},
		{
			MethodName: "GetBalancerInfo",
			Handler:    _RoutingService_GetBalancerInfo_Handler,
		},
		{
			MethodName: "OverrideBalancerTarget",
			Handler:    _RoutingService_OverrideBalancerTarget_Handler,
		},
		{
			MethodName: "AddRule",
			Handler:    _RoutingService_AddRule_Handler,
		},
		{
			MethodName: "RemoveRule",
			Handler:    _RoutingService_RemoveRule_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 AddRuleRequest

type AddRuleRequest struct {
	Config       *serial.TypedMessage `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"`
	ShouldAppend bool                 `protobuf:"varint,2,opt,name=shouldAppend,proto3" json:"shouldAppend,omitempty"`
	// contains filtered or unexported fields
}

func (*AddRuleRequest) Descriptor deprecated

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

Deprecated: Use AddRuleRequest.ProtoReflect.Descriptor instead.

func (*AddRuleRequest) GetConfig

func (x *AddRuleRequest) GetConfig() *serial.TypedMessage

func (*AddRuleRequest) GetShouldAppend

func (x *AddRuleRequest) GetShouldAppend() bool

func (*AddRuleRequest) ProtoMessage

func (*AddRuleRequest) ProtoMessage()

func (*AddRuleRequest) ProtoReflect

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

func (*AddRuleRequest) Reset

func (x *AddRuleRequest) Reset()

func (*AddRuleRequest) String

func (x *AddRuleRequest) String() string

type AddRuleResponse

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

func (*AddRuleResponse) Descriptor deprecated

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

Deprecated: Use AddRuleResponse.ProtoReflect.Descriptor instead.

func (*AddRuleResponse) ProtoMessage

func (*AddRuleResponse) ProtoMessage()

func (*AddRuleResponse) ProtoReflect

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

func (*AddRuleResponse) Reset

func (x *AddRuleResponse) Reset()

func (*AddRuleResponse) String

func (x *AddRuleResponse) String() string

type BalancerMsg

type BalancerMsg struct {
	Override        *OverrideInfo        `protobuf:"bytes,5,opt,name=override,proto3" json:"override,omitempty"`
	PrincipleTarget *PrincipleTargetInfo `protobuf:"bytes,6,opt,name=principle_target,json=principleTarget,proto3" json:"principle_target,omitempty"`
	// contains filtered or unexported fields
}

func (*BalancerMsg) Descriptor deprecated

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

Deprecated: Use BalancerMsg.ProtoReflect.Descriptor instead.

func (*BalancerMsg) GetOverride

func (x *BalancerMsg) GetOverride() *OverrideInfo

func (*BalancerMsg) GetPrincipleTarget

func (x *BalancerMsg) GetPrincipleTarget() *PrincipleTargetInfo

func (*BalancerMsg) ProtoMessage

func (*BalancerMsg) ProtoMessage()

func (*BalancerMsg) ProtoReflect

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

func (*BalancerMsg) Reset

func (x *BalancerMsg) Reset()

func (*BalancerMsg) String

func (x *BalancerMsg) String() string

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 GetBalancerInfoRequest

type GetBalancerInfoRequest struct {
	Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
	// contains filtered or unexported fields
}

func (*GetBalancerInfoRequest) Descriptor deprecated

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

Deprecated: Use GetBalancerInfoRequest.ProtoReflect.Descriptor instead.

func (*GetBalancerInfoRequest) GetTag

func (x *GetBalancerInfoRequest) GetTag() string

func (*GetBalancerInfoRequest) ProtoMessage

func (*GetBalancerInfoRequest) ProtoMessage()

func (*GetBalancerInfoRequest) ProtoReflect

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

func (*GetBalancerInfoRequest) Reset

func (x *GetBalancerInfoRequest) Reset()

func (*GetBalancerInfoRequest) String

func (x *GetBalancerInfoRequest) String() string

type GetBalancerInfoResponse

type GetBalancerInfoResponse struct {
	Balancer *BalancerMsg `protobuf:"bytes,1,opt,name=balancer,proto3" json:"balancer,omitempty"`
	// contains filtered or unexported fields
}

func (*GetBalancerInfoResponse) Descriptor deprecated

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

Deprecated: Use GetBalancerInfoResponse.ProtoReflect.Descriptor instead.

func (*GetBalancerInfoResponse) GetBalancer

func (x *GetBalancerInfoResponse) GetBalancer() *BalancerMsg

func (*GetBalancerInfoResponse) ProtoMessage

func (*GetBalancerInfoResponse) ProtoMessage()

func (*GetBalancerInfoResponse) ProtoReflect

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

func (*GetBalancerInfoResponse) Reset

func (x *GetBalancerInfoResponse) Reset()

func (*GetBalancerInfoResponse) String

func (x *GetBalancerInfoResponse) String() string

type OverrideBalancerTargetRequest

type OverrideBalancerTargetRequest struct {
	BalancerTag string `protobuf:"bytes,1,opt,name=balancerTag,proto3" json:"balancerTag,omitempty"`
	Target      string `protobuf:"bytes,2,opt,name=target,proto3" json:"target,omitempty"`
	// contains filtered or unexported fields
}

func (*OverrideBalancerTargetRequest) Descriptor deprecated

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

Deprecated: Use OverrideBalancerTargetRequest.ProtoReflect.Descriptor instead.

func (*OverrideBalancerTargetRequest) GetBalancerTag

func (x *OverrideBalancerTargetRequest) GetBalancerTag() string

func (*OverrideBalancerTargetRequest) GetTarget

func (x *OverrideBalancerTargetRequest) GetTarget() string

func (*OverrideBalancerTargetRequest) ProtoMessage

func (*OverrideBalancerTargetRequest) ProtoMessage()

func (*OverrideBalancerTargetRequest) ProtoReflect

func (*OverrideBalancerTargetRequest) Reset

func (x *OverrideBalancerTargetRequest) Reset()

func (*OverrideBalancerTargetRequest) String

type OverrideBalancerTargetResponse

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

func (*OverrideBalancerTargetResponse) Descriptor deprecated

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

Deprecated: Use OverrideBalancerTargetResponse.ProtoReflect.Descriptor instead.

func (*OverrideBalancerTargetResponse) ProtoMessage

func (*OverrideBalancerTargetResponse) ProtoMessage()

func (*OverrideBalancerTargetResponse) ProtoReflect

func (*OverrideBalancerTargetResponse) Reset

func (x *OverrideBalancerTargetResponse) Reset()

func (*OverrideBalancerTargetResponse) String

type OverrideInfo

type OverrideInfo struct {
	Target string `protobuf:"bytes,2,opt,name=target,proto3" json:"target,omitempty"`
	// contains filtered or unexported fields
}

func (*OverrideInfo) Descriptor deprecated

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

Deprecated: Use OverrideInfo.ProtoReflect.Descriptor instead.

func (*OverrideInfo) GetTarget

func (x *OverrideInfo) GetTarget() string

func (*OverrideInfo) ProtoMessage

func (*OverrideInfo) ProtoMessage()

func (*OverrideInfo) ProtoReflect

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

func (*OverrideInfo) Reset

func (x *OverrideInfo) Reset()

func (*OverrideInfo) String

func (x *OverrideInfo) String() string

type PrincipleTargetInfo

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

func (*PrincipleTargetInfo) Descriptor deprecated

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

Deprecated: Use PrincipleTargetInfo.ProtoReflect.Descriptor instead.

func (*PrincipleTargetInfo) GetTag

func (x *PrincipleTargetInfo) GetTag() []string

func (*PrincipleTargetInfo) ProtoMessage

func (*PrincipleTargetInfo) ProtoMessage()

func (*PrincipleTargetInfo) ProtoReflect

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

func (*PrincipleTargetInfo) Reset

func (x *PrincipleTargetInfo) Reset()

func (*PrincipleTargetInfo) String

func (x *PrincipleTargetInfo) String() string

type RemoveRuleRequest

type RemoveRuleRequest struct {
	RuleTag string `protobuf:"bytes,1,opt,name=ruleTag,proto3" json:"ruleTag,omitempty"`
	// contains filtered or unexported fields
}

func (*RemoveRuleRequest) Descriptor deprecated

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

Deprecated: Use RemoveRuleRequest.ProtoReflect.Descriptor instead.

func (*RemoveRuleRequest) GetRuleTag

func (x *RemoveRuleRequest) GetRuleTag() string

func (*RemoveRuleRequest) ProtoMessage

func (*RemoveRuleRequest) ProtoMessage()

func (*RemoveRuleRequest) ProtoReflect

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

func (*RemoveRuleRequest) Reset

func (x *RemoveRuleRequest) Reset()

func (*RemoveRuleRequest) String

func (x *RemoveRuleRequest) String() string

type RemoveRuleResponse

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

func (*RemoveRuleResponse) Descriptor deprecated

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

Deprecated: Use RemoveRuleResponse.ProtoReflect.Descriptor instead.

func (*RemoveRuleResponse) ProtoMessage

func (*RemoveRuleResponse) ProtoMessage()

func (*RemoveRuleResponse) ProtoReflect

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

func (*RemoveRuleResponse) Reset

func (x *RemoveRuleResponse) Reset()

func (*RemoveRuleResponse) String

func (x *RemoveRuleResponse) 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

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

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) AddRule

func (UnimplementedRoutingServiceServer) GetBalancerInfo

func (UnimplementedRoutingServiceServer) RemoveRule

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