command

package
v5.17.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: MIT Imports: 17 Imported by: 2

Documentation

Index

Constants

View Source
const (
	RoutingService_SubscribeRoutingStats_FullMethodName  = "/v2ray.core.app.router.command.RoutingService/SubscribeRoutingStats"
	RoutingService_TestRoute_FullMethodName              = "/v2ray.core.app.router.command.RoutingService/TestRoute"
	RoutingService_GetBalancerInfo_FullMethodName        = "/v2ray.core.app.router.command.RoutingService/GetBalancerInfo"
	RoutingService_OverrideBalancerTarget_FullMethodName = "/v2ray.core.app.router.command.RoutingService/OverrideBalancerTarget"
)

Variables

View Source
var File_app_router_command_command_proto protoreflect.FileDescriptor
View Source
var RoutingService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "v2ray.core.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,
		},
	},
	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 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 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=v2ray.core.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 v2ray.core.features.routing.Context and v2ray.core.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)
	GetBalancerInfo(ctx context.Context, in *GetBalancerInfoRequest, opts ...grpc.CallOption) (*GetBalancerInfoResponse, error)
	OverrideBalancerTarget(ctx context.Context, in *OverrideBalancerTargetRequest, opts ...grpc.CallOption) (*OverrideBalancerTargetResponse, 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)
	GetBalancerInfo(context.Context, *GetBalancerInfoRequest) (*GetBalancerInfoResponse, error)
	OverrideBalancerTarget(context.Context, *OverrideBalancerTargetRequest) (*OverrideBalancerTargetResponse, 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 v2ray-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) GetBalancerInfo

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