v1

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: AGPL-3.0 Imports: 10 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HookName_name = map[int32]string{
		0:  "HOOK_NAME_UNSPECIFIED",
		1:  "HOOK_NAME_ON_CONFIG_LOADED",
		2:  "HOOK_NAME_ON_NEW_LOGGER",
		3:  "HOOK_NAME_ON_NEW_POOL",
		4:  "HOOK_NAME_ON_NEW_CLIENT",
		5:  "HOOK_NAME_ON_NEW_PROXY",
		6:  "HOOK_NAME_ON_NEW_SERVER",
		7:  "HOOK_NAME_ON_SIGNAL",
		8:  "HOOK_NAME_ON_RUN",
		9:  "HOOK_NAME_ON_BOOTING",
		10: "HOOK_NAME_ON_BOOTED",
		11: "HOOK_NAME_ON_OPENING",
		12: "HOOK_NAME_ON_OPENED",
		13: "HOOK_NAME_ON_CLOSING",
		14: "HOOK_NAME_ON_CLOSED",
		15: "HOOK_NAME_ON_TRAFFIC",
		16: "HOOK_NAME_ON_TRAFFIC_FROM_CLIENT",
		17: "HOOK_NAME_ON_TRAFFIC_TO_SERVER",
		18: "HOOK_NAME_ON_TRAFFIC_FROM_SERVER",
		19: "HOOK_NAME_ON_TRAFFIC_TO_CLIENT",
		20: "HOOK_NAME_ON_SHUTDOWN",
		21: "HOOK_NAME_ON_TICK",
		22: "HOOK_NAME_ON_HOOK",
	}
	HookName_value = map[string]int32{
		"HOOK_NAME_UNSPECIFIED":            0,
		"HOOK_NAME_ON_CONFIG_LOADED":       1,
		"HOOK_NAME_ON_NEW_LOGGER":          2,
		"HOOK_NAME_ON_NEW_POOL":            3,
		"HOOK_NAME_ON_NEW_CLIENT":          4,
		"HOOK_NAME_ON_NEW_PROXY":           5,
		"HOOK_NAME_ON_NEW_SERVER":          6,
		"HOOK_NAME_ON_SIGNAL":              7,
		"HOOK_NAME_ON_RUN":                 8,
		"HOOK_NAME_ON_BOOTING":             9,
		"HOOK_NAME_ON_BOOTED":              10,
		"HOOK_NAME_ON_OPENING":             11,
		"HOOK_NAME_ON_OPENED":              12,
		"HOOK_NAME_ON_CLOSING":             13,
		"HOOK_NAME_ON_CLOSED":              14,
		"HOOK_NAME_ON_TRAFFIC":             15,
		"HOOK_NAME_ON_TRAFFIC_FROM_CLIENT": 16,
		"HOOK_NAME_ON_TRAFFIC_TO_SERVER":   17,
		"HOOK_NAME_ON_TRAFFIC_FROM_SERVER": 18,
		"HOOK_NAME_ON_TRAFFIC_TO_CLIENT":   19,
		"HOOK_NAME_ON_SHUTDOWN":            20,
		"HOOK_NAME_ON_TICK":                21,
		"HOOK_NAME_ON_HOOK":                22,
	}
)

Enum value maps for HookName.

View Source
var File_plugin_v1_plugin_proto protoreflect.FileDescriptor
View Source
var GatewayDPluginService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "plugin.v1.GatewayDPluginService",
	HandlerType: (*GatewayDPluginServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetPluginConfig",
			Handler:    _GatewayDPluginService_GetPluginConfig_Handler,
		},
		{
			MethodName: "OnConfigLoaded",
			Handler:    _GatewayDPluginService_OnConfigLoaded_Handler,
		},
		{
			MethodName: "OnNewLogger",
			Handler:    _GatewayDPluginService_OnNewLogger_Handler,
		},
		{
			MethodName: "OnNewPool",
			Handler:    _GatewayDPluginService_OnNewPool_Handler,
		},
		{
			MethodName: "OnNewClient",
			Handler:    _GatewayDPluginService_OnNewClient_Handler,
		},
		{
			MethodName: "OnNewProxy",
			Handler:    _GatewayDPluginService_OnNewProxy_Handler,
		},
		{
			MethodName: "OnNewServer",
			Handler:    _GatewayDPluginService_OnNewServer_Handler,
		},
		{
			MethodName: "OnSignal",
			Handler:    _GatewayDPluginService_OnSignal_Handler,
		},
		{
			MethodName: "OnRun",
			Handler:    _GatewayDPluginService_OnRun_Handler,
		},
		{
			MethodName: "OnBooting",
			Handler:    _GatewayDPluginService_OnBooting_Handler,
		},
		{
			MethodName: "OnBooted",
			Handler:    _GatewayDPluginService_OnBooted_Handler,
		},
		{
			MethodName: "OnOpening",
			Handler:    _GatewayDPluginService_OnOpening_Handler,
		},
		{
			MethodName: "OnOpened",
			Handler:    _GatewayDPluginService_OnOpened_Handler,
		},
		{
			MethodName: "OnClosing",
			Handler:    _GatewayDPluginService_OnClosing_Handler,
		},
		{
			MethodName: "OnClosed",
			Handler:    _GatewayDPluginService_OnClosed_Handler,
		},
		{
			MethodName: "OnTraffic",
			Handler:    _GatewayDPluginService_OnTraffic_Handler,
		},
		{
			MethodName: "OnTrafficFromClient",
			Handler:    _GatewayDPluginService_OnTrafficFromClient_Handler,
		},
		{
			MethodName: "OnTrafficToServer",
			Handler:    _GatewayDPluginService_OnTrafficToServer_Handler,
		},
		{
			MethodName: "OnTrafficFromServer",
			Handler:    _GatewayDPluginService_OnTrafficFromServer_Handler,
		},
		{
			MethodName: "OnTrafficToClient",
			Handler:    _GatewayDPluginService_OnTrafficToClient_Handler,
		},
		{
			MethodName: "OnShutdown",
			Handler:    _GatewayDPluginService_OnShutdown_Handler,
		},
		{
			MethodName: "OnTick",
			Handler:    _GatewayDPluginService_OnTick_Handler,
		},
		{
			MethodName: "OnHook",
			Handler:    _GatewayDPluginService_OnHook_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "plugin/v1/plugin.proto",
}

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

View Source
var Handshake = goplugin.HandshakeConfig{
	ProtocolVersion:  1,
	MagicCookieKey:   "GATEWAYD_PLUGIN",
	MagicCookieValue: "5712b87aa5d7e9f9e9ab643e6603181c5b796015cb1c09d6f5ada882bf2a1872",
}

Handshake must be used by all plugins to ensure that the plugin and host are compatible.

Functions

func GetPluginMap

func GetPluginMap(pluginName string) map[string]goplugin.Plugin

GetPluginMap returns the plugin map for the plugin.

func GetPluginSetMap added in v0.0.3

func GetPluginSetMap(plugins map[string]goplugin.Plugin) goplugin.PluginSet

GetPluginSetMap returns the PluginSet for the plugin.

func RegisterGatewayDPluginServiceServer

func RegisterGatewayDPluginServiceServer(s grpc.ServiceRegistrar, srv GatewayDPluginServiceServer)

Types

type GatewayDPluginServiceClient

type GatewayDPluginServiceClient interface {
	// GetPluginConfig returns the plugin config upon registration
	GetPluginConfig(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error)
	// OnConfigLoaded is called when the config is loaded from any config provider
	OnConfigLoaded(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error)
	OnNewLogger(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error)
	OnNewPool(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error)
	OnNewClient(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error)
	OnNewProxy(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error)
	OnNewServer(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error)
	OnSignal(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error)
	OnRun(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error)
	OnBooting(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error)
	OnBooted(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error)
	OnOpening(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error)
	OnOpened(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error)
	OnClosing(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error)
	OnClosed(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error)
	OnTraffic(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error)
	OnTrafficFromClient(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error)
	OnTrafficToServer(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error)
	OnTrafficFromServer(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error)
	OnTrafficToClient(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error)
	OnShutdown(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error)
	OnTick(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error)
	OnHook(ctx context.Context, in *structpb.Struct, opts ...grpc.CallOption) (*structpb.Struct, error)
}

GatewayDPluginServiceClient is the client API for GatewayDPluginService 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 GatewayDPluginServiceServer

type GatewayDPluginServiceServer interface {
	// GetPluginConfig returns the plugin config upon registration
	GetPluginConfig(context.Context, *structpb.Struct) (*structpb.Struct, error)
	// OnConfigLoaded is called when the config is loaded from any config provider
	OnConfigLoaded(context.Context, *structpb.Struct) (*structpb.Struct, error)
	OnNewLogger(context.Context, *structpb.Struct) (*structpb.Struct, error)
	OnNewPool(context.Context, *structpb.Struct) (*structpb.Struct, error)
	OnNewClient(context.Context, *structpb.Struct) (*structpb.Struct, error)
	OnNewProxy(context.Context, *structpb.Struct) (*structpb.Struct, error)
	OnNewServer(context.Context, *structpb.Struct) (*structpb.Struct, error)
	OnSignal(context.Context, *structpb.Struct) (*structpb.Struct, error)
	OnRun(context.Context, *structpb.Struct) (*structpb.Struct, error)
	OnBooting(context.Context, *structpb.Struct) (*structpb.Struct, error)
	OnBooted(context.Context, *structpb.Struct) (*structpb.Struct, error)
	OnOpening(context.Context, *structpb.Struct) (*structpb.Struct, error)
	OnOpened(context.Context, *structpb.Struct) (*structpb.Struct, error)
	OnClosing(context.Context, *structpb.Struct) (*structpb.Struct, error)
	OnClosed(context.Context, *structpb.Struct) (*structpb.Struct, error)
	OnTraffic(context.Context, *structpb.Struct) (*structpb.Struct, error)
	OnTrafficFromClient(context.Context, *structpb.Struct) (*structpb.Struct, error)
	OnTrafficToServer(context.Context, *structpb.Struct) (*structpb.Struct, error)
	OnTrafficFromServer(context.Context, *structpb.Struct) (*structpb.Struct, error)
	OnTrafficToClient(context.Context, *structpb.Struct) (*structpb.Struct, error)
	OnShutdown(context.Context, *structpb.Struct) (*structpb.Struct, error)
	OnTick(context.Context, *structpb.Struct) (*structpb.Struct, error)
	OnHook(context.Context, *structpb.Struct) (*structpb.Struct, error)
	// contains filtered or unexported methods
}

GatewayDPluginServiceServer is the server API for GatewayDPluginService service. All implementations must embed UnimplementedGatewayDPluginServiceServer for forward compatibility

type HookName added in v0.0.11

type HookName int32
const (
	HookName_HOOK_NAME_UNSPECIFIED            HookName = 0
	HookName_HOOK_NAME_ON_CONFIG_LOADED       HookName = 1
	HookName_HOOK_NAME_ON_NEW_LOGGER          HookName = 2
	HookName_HOOK_NAME_ON_NEW_POOL            HookName = 3
	HookName_HOOK_NAME_ON_NEW_CLIENT          HookName = 4
	HookName_HOOK_NAME_ON_NEW_PROXY           HookName = 5
	HookName_HOOK_NAME_ON_NEW_SERVER          HookName = 6
	HookName_HOOK_NAME_ON_SIGNAL              HookName = 7
	HookName_HOOK_NAME_ON_RUN                 HookName = 8
	HookName_HOOK_NAME_ON_BOOTING             HookName = 9
	HookName_HOOK_NAME_ON_BOOTED              HookName = 10
	HookName_HOOK_NAME_ON_OPENING             HookName = 11
	HookName_HOOK_NAME_ON_OPENED              HookName = 12
	HookName_HOOK_NAME_ON_CLOSING             HookName = 13
	HookName_HOOK_NAME_ON_CLOSED              HookName = 14
	HookName_HOOK_NAME_ON_TRAFFIC             HookName = 15
	HookName_HOOK_NAME_ON_TRAFFIC_FROM_CLIENT HookName = 16
	HookName_HOOK_NAME_ON_TRAFFIC_TO_SERVER   HookName = 17
	HookName_HOOK_NAME_ON_TRAFFIC_FROM_SERVER HookName = 18
	HookName_HOOK_NAME_ON_TRAFFIC_TO_CLIENT   HookName = 19
	HookName_HOOK_NAME_ON_SHUTDOWN            HookName = 20
	HookName_HOOK_NAME_ON_TICK                HookName = 21
	HookName_HOOK_NAME_ON_HOOK                HookName = 22
)

func (HookName) Descriptor added in v0.0.11

func (HookName) Descriptor() protoreflect.EnumDescriptor

func (HookName) Enum added in v0.0.11

func (x HookName) Enum() *HookName

func (HookName) EnumDescriptor deprecated added in v0.0.11

func (HookName) EnumDescriptor() ([]byte, []int)

Deprecated: Use HookName.Descriptor instead.

func (HookName) Number added in v0.0.11

func (x HookName) Number() protoreflect.EnumNumber

func (HookName) String added in v0.0.11

func (x HookName) String() string

func (HookName) Type added in v0.0.11

type Plugin

Plugin is the interface that all plugins must implement.

func (*Plugin) GRPCClient

func (p *Plugin) GRPCClient(ctx context.Context, b *goplugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

GRPCClient returns the plugin client.

func (*Plugin) GRPCServer

func (p *Plugin) GRPCServer(b *goplugin.GRPCBroker, s *grpc.Server) error

GRPCServer registers the plugin with the gRPC server.

type PluginConfig

type PluginConfig struct {
	Id          *PluginID `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Description string    `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
	Authors     []string  `protobuf:"bytes,3,rep,name=authors,proto3" json:"authors,omitempty"`
	License     string    `protobuf:"bytes,4,opt,name=license,proto3" json:"license,omitempty"`
	ProjectUrl  string    `protobuf:"bytes,5,opt,name=project_url,json=projectUrl,proto3" json:"project_url,omitempty"`
	// internal and external config options
	Config map[string]string `` /* 153-byte string literal not displayed */
	// hooks it attaches to
	Hooks []HookName `protobuf:"varint,7,rep,packed,name=hooks,proto3,enum=plugin.v1.HookName" json:"hooks,omitempty"`
	// required plugins
	Requires   map[string]string `` /* 157-byte string literal not displayed */
	Tags       []string          `protobuf:"bytes,9,rep,name=tags,proto3" json:"tags,omitempty"`
	Categories []string          `protobuf:"bytes,10,rep,name=categories,proto3" json:"categories,omitempty"`
	// contains filtered or unexported fields
}

func (*PluginConfig) Descriptor deprecated

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

Deprecated: Use PluginConfig.ProtoReflect.Descriptor instead.

func (*PluginConfig) GetAuthors

func (x *PluginConfig) GetAuthors() []string

func (*PluginConfig) GetCategories

func (x *PluginConfig) GetCategories() []string

func (*PluginConfig) GetConfig

func (x *PluginConfig) GetConfig() map[string]string

func (*PluginConfig) GetDescription

func (x *PluginConfig) GetDescription() string

func (*PluginConfig) GetHooks

func (x *PluginConfig) GetHooks() []HookName

func (*PluginConfig) GetId

func (x *PluginConfig) GetId() *PluginID

func (*PluginConfig) GetLicense

func (x *PluginConfig) GetLicense() string

func (*PluginConfig) GetProjectUrl

func (x *PluginConfig) GetProjectUrl() string

func (*PluginConfig) GetRequires

func (x *PluginConfig) GetRequires() map[string]string

func (*PluginConfig) GetTags

func (x *PluginConfig) GetTags() []string

func (*PluginConfig) ProtoMessage

func (*PluginConfig) ProtoMessage()

func (*PluginConfig) ProtoReflect

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

func (*PluginConfig) Reset

func (x *PluginConfig) Reset()

func (*PluginConfig) String

func (x *PluginConfig) String() string

type PluginID

type PluginID struct {
	Name      string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Version   string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
	RemoteUrl string `protobuf:"bytes,3,opt,name=remote_url,json=remoteUrl,proto3" json:"remote_url,omitempty"`
	Checksum  string `protobuf:"bytes,4,opt,name=checksum,proto3" json:"checksum,omitempty"`
	// contains filtered or unexported fields
}

func (*PluginID) Descriptor deprecated

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

Deprecated: Use PluginID.ProtoReflect.Descriptor instead.

func (*PluginID) GetChecksum

func (x *PluginID) GetChecksum() string

func (*PluginID) GetName

func (x *PluginID) GetName() string

func (*PluginID) GetRemoteUrl

func (x *PluginID) GetRemoteUrl() string

func (*PluginID) GetVersion

func (x *PluginID) GetVersion() string

func (*PluginID) ProtoMessage

func (*PluginID) ProtoMessage()

func (*PluginID) ProtoReflect

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

func (*PluginID) Reset

func (x *PluginID) Reset()

func (*PluginID) String

func (x *PluginID) String() string

type UnimplementedGatewayDPluginServiceServer

type UnimplementedGatewayDPluginServiceServer struct {
}

UnimplementedGatewayDPluginServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedGatewayDPluginServiceServer) GetPluginConfig

func (UnimplementedGatewayDPluginServiceServer) OnBooted

func (UnimplementedGatewayDPluginServiceServer) OnBooting

func (UnimplementedGatewayDPluginServiceServer) OnClosed

func (UnimplementedGatewayDPluginServiceServer) OnClosing

func (UnimplementedGatewayDPluginServiceServer) OnConfigLoaded

func (UnimplementedGatewayDPluginServiceServer) OnHook

func (UnimplementedGatewayDPluginServiceServer) OnNewClient

func (UnimplementedGatewayDPluginServiceServer) OnNewLogger

func (UnimplementedGatewayDPluginServiceServer) OnNewPool

func (UnimplementedGatewayDPluginServiceServer) OnNewProxy

func (UnimplementedGatewayDPluginServiceServer) OnNewServer

func (UnimplementedGatewayDPluginServiceServer) OnOpened

func (UnimplementedGatewayDPluginServiceServer) OnOpening

func (UnimplementedGatewayDPluginServiceServer) OnRun

func (UnimplementedGatewayDPluginServiceServer) OnShutdown

func (UnimplementedGatewayDPluginServiceServer) OnSignal

func (UnimplementedGatewayDPluginServiceServer) OnTick

func (UnimplementedGatewayDPluginServiceServer) OnTraffic

func (UnimplementedGatewayDPluginServiceServer) OnTrafficFromClient

func (UnimplementedGatewayDPluginServiceServer) OnTrafficFromServer

func (UnimplementedGatewayDPluginServiceServer) OnTrafficToClient

func (UnimplementedGatewayDPluginServiceServer) OnTrafficToServer

type UnsafeGatewayDPluginServiceServer

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

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

Jump to

Keyboard shortcuts

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