pluginctl

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrJsonSchemaConvertion error = errors.New("failed to convert to json format")
	ErrJsonConvertion       error = errors.New("failed to convert to/from json")
)
View Source
var DefaultHandshake = plugin.HandshakeConfig{

	ProtocolVersion:  1,
	MagicCookieKey:   "BASIC_SECPIPELINE_PLUGIN",
	MagicCookieValue: "hello",
}
View Source
var File_pluginctl_plugins_proto protoreflect.FileDescriptor
View Source
var SecPipelinePlugins_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "pluginctl.SecPipelinePlugins",
	HandlerType: (*SecPipelinePluginsServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetInputSchema",
			Handler:    _SecPipelinePlugins_GetInputSchema_Handler,
		},
		{
			MethodName: "Config",
			Handler:    _SecPipelinePlugins_Config_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Run",
			Handler:       _SecPipelinePlugins_Run_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "pluginctl/plugins.proto",
}

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

Functions

func CleanupClients

func CleanupClients()

func RegisterSecPipelinePluginsServer

func RegisterSecPipelinePluginsServer(s grpc.ServiceRegistrar, srv SecPipelinePluginsServer)

Types

type DataStream

type DataStream struct {
	Data       []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
	ParentSrc  string `protobuf:"bytes,2,opt,name=parentSrc,proto3" json:"parentSrc,omitempty"`
	Id         string `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"`
	IsComplete bool   `protobuf:"varint,4,opt,name=isComplete,proto3" json:"isComplete,omitempty"`
	TotalLen   int64  `protobuf:"varint,5,opt,name=totalLen,proto3" json:"totalLen,omitempty"`
	// contains filtered or unexported fields
}

func (*DataStream) Descriptor deprecated

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

Deprecated: Use DataStream.ProtoReflect.Descriptor instead.

func (*DataStream) GetData

func (x *DataStream) GetData() []byte

func (*DataStream) GetId

func (x *DataStream) GetId() string

func (*DataStream) GetIsComplete

func (x *DataStream) GetIsComplete() bool

func (*DataStream) GetParentSrc

func (x *DataStream) GetParentSrc() string

func (*DataStream) GetTotalLen

func (x *DataStream) GetTotalLen() int64

func (*DataStream) ProtoMessage

func (*DataStream) ProtoMessage()

func (*DataStream) ProtoReflect

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

func (*DataStream) Reset

func (x *DataStream) Reset()

func (*DataStream) String

func (x *DataStream) String() string

type Empty

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

func (*Empty) Descriptor deprecated

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

Deprecated: Use Empty.ProtoReflect.Descriptor instead.

func (*Empty) ProtoMessage

func (*Empty) ProtoMessage()

func (*Empty) ProtoReflect

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

func (*Empty) Reset

func (x *Empty) Reset()

func (*Empty) String

func (x *Empty) String() string

type Error

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

func (*Error) Descriptor deprecated

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

Deprecated: Use Error.ProtoReflect.Descriptor instead.

func (*Error) GetMessage

func (x *Error) GetMessage() string

func (*Error) ProtoMessage

func (*Error) ProtoMessage()

func (*Error) ProtoReflect

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

func (*Error) Reset

func (x *Error) Reset()

func (*Error) String

func (x *Error) String() string

type GRPCClient

type GRPCClient struct {
	Name string
	// contains filtered or unexported fields
}

func (*GRPCClient) Config

func (m *GRPCClient) Config(config []byte) error

func (*GRPCClient) GetInputSchema

func (m *GRPCClient) GetInputSchema() ([]byte, error)

func (*GRPCClient) Run

func (m *GRPCClient) Run(ctx context.Context, input <-chan *DataStream) (<-chan *DataStream, <-chan error)

type GRPCServer

type GRPCServer struct {
	// This is the real implementation
	Impl SecPipelinePluginable
	Name string
}

Here is the gRPC server that GRPCClient talks to.

func (*GRPCServer) Config

func (m *GRPCServer) Config(ctx context.Context, config *RunInputConfig) (*Empty, error)

func (*GRPCServer) GetInputSchema

func (m *GRPCServer) GetInputSchema(context.Context, *Empty) (*InputSchema, error)

func (*GRPCServer) Run

type InputSchema

type InputSchema struct {
	Config []byte `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"`
	// contains filtered or unexported fields
}

func (*InputSchema) Descriptor deprecated

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

Deprecated: Use InputSchema.ProtoReflect.Descriptor instead.

func (*InputSchema) GetConfig

func (x *InputSchema) GetConfig() []byte

func (*InputSchema) ProtoMessage

func (*InputSchema) ProtoMessage()

func (*InputSchema) ProtoReflect

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

func (*InputSchema) Reset

func (x *InputSchema) Reset()

func (*InputSchema) String

func (x *InputSchema) String() string

type Plugin

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

func NewPlugin

func NewPlugin(name string, opt ...PluginOption) *Plugin

func (*Plugin) Cleanup

func (p *Plugin) Cleanup()

func (*Plugin) Connect

func (p *Plugin) Connect() (SecPipelinePluginable, error)

func (Plugin) Serve

func (p Plugin) Serve()

type PluginOption

type PluginOption = helper.Option[Plugin]

func WithCmdConfig

func WithCmdConfig(cmd *exec.Cmd) PluginOption

func WithGRPCPlugin

func WithGRPCPlugin() PluginOption

func WithHandshakeConfig

func WithHandshakeConfig(handshakeConfig plugin.HandshakeConfig) PluginOption

func WithPath

func WithPath(path string) PluginOption

func WithPluginImplementation

func WithPluginImplementation(plugin SecPipelinePluginable) PluginOption

func WithPluginProcessPath

func WithPluginProcessPath(path string) PluginOption

type RunInputConfig

type RunInputConfig struct {
	Config []byte `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"`
	// contains filtered or unexported fields
}

func (*RunInputConfig) Descriptor deprecated

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

Deprecated: Use RunInputConfig.ProtoReflect.Descriptor instead.

func (*RunInputConfig) GetConfig

func (x *RunInputConfig) GetConfig() []byte

func (*RunInputConfig) ProtoMessage

func (*RunInputConfig) ProtoMessage()

func (*RunInputConfig) ProtoReflect

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

func (*RunInputConfig) Reset

func (x *RunInputConfig) Reset()

func (*RunInputConfig) String

func (x *RunInputConfig) String() string

type RunLoop

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

func NewRunLoop

func NewRunLoop() *RunLoop

func (*RunLoop) Recv

func (rl *RunLoop) Recv(stream *DataStream) *DataStream

func (*RunLoop) Send

func (rl *RunLoop) Send(stream *DataStream) []*DataStream

type SecPipelineGRPCPlugin

type SecPipelineGRPCPlugin struct {
	// GRPCPlugin must still implement the Plugin interface
	plugin.NetRPCUnsupportedPlugin
	Impl SecPipelinePluginable
	Name string
}

This is the implementation of plugin.GRPCPlugin so we can serve/consume this.

func (SecPipelineGRPCPlugin) GRPCClient

func (p SecPipelineGRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

func (SecPipelineGRPCPlugin) GRPCServer

func (p SecPipelineGRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error

type SecPipelinePluginable

type SecPipelinePluginable interface {
	GetInputSchema() ([]byte, error)
	Config(config []byte) error
	Run(ctx context.Context, input <-chan *DataStream) (<-chan *DataStream, <-chan error)
}

type SecPipelinePluginsClient

type SecPipelinePluginsClient interface {
	GetInputSchema(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*InputSchema, error)
	Config(ctx context.Context, in *RunInputConfig, opts ...grpc.CallOption) (*Empty, error)
	Run(ctx context.Context, opts ...grpc.CallOption) (SecPipelinePlugins_RunClient, error)
}

SecPipelinePluginsClient is the client API for SecPipelinePlugins 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 SecPipelinePluginsServer

type SecPipelinePluginsServer interface {
	GetInputSchema(context.Context, *Empty) (*InputSchema, error)
	Config(context.Context, *RunInputConfig) (*Empty, error)
	Run(SecPipelinePlugins_RunServer) error
	// contains filtered or unexported methods
}

SecPipelinePluginsServer is the server API for SecPipelinePlugins service. All implementations must embed UnimplementedSecPipelinePluginsServer for forward compatibility

type SecPipelinePlugins_RunClient

type SecPipelinePlugins_RunClient interface {
	Send(*DataStream) error
	Recv() (*DataStream, error)
	grpc.ClientStream
}

type SecPipelinePlugins_RunServer

type SecPipelinePlugins_RunServer interface {
	Send(*DataStream) error
	Recv() (*DataStream, error)
	grpc.ServerStream
}

type UnimplementedSecPipelinePluginsServer

type UnimplementedSecPipelinePluginsServer struct {
}

UnimplementedSecPipelinePluginsServer must be embedded to have forward compatible implementations.

func (UnimplementedSecPipelinePluginsServer) Config

func (UnimplementedSecPipelinePluginsServer) GetInputSchema

func (UnimplementedSecPipelinePluginsServer) Run

type UnsafeSecPipelinePluginsServer

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

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

Jump to

Keyboard shortcuts

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