rpc

package
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2020 License: MIT Imports: 29 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertFromRPCHeaders

func ConvertFromRPCHeaders(headers []*HttpHeader) http.Header

func CtxWithToken

func CtxWithToken(ctx context.Context, scheme string, token string) context.Context

func CtxWithTokenAndPath

func CtxWithTokenAndPath(ctx context.Context, scheme string, token string, path string) context.Context

func NewHttpServer

func NewHttpServer(port int, plugin []Plugin, logger *zap.SugaredLogger) *httpServer

func RegisterHTTPPluginServer

func RegisterHTTPPluginServer(s *grpc.Server, srv HTTPPluginServer)

func RegisterIRCPluginServer

func RegisterIRCPluginServer(s *grpc.Server, srv IRCPluginServer)

Types

type Channel

type Channel struct {
	Name                 string   `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Channel) Descriptor

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

func (*Channel) GetName

func (m *Channel) GetName() string

func (*Channel) ProtoMessage

func (*Channel) ProtoMessage()

func (*Channel) Reset

func (m *Channel) Reset()

func (*Channel) String

func (m *Channel) String() string

func (*Channel) XXX_DiscardUnknown

func (m *Channel) XXX_DiscardUnknown()

func (*Channel) XXX_Marshal

func (m *Channel) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Channel) XXX_Merge

func (m *Channel) XXX_Merge(src proto.Message)

func (*Channel) XXX_Size

func (m *Channel) XXX_Size() int

func (*Channel) XXX_Unmarshal

func (m *Channel) XXX_Unmarshal(b []byte) error

type ChannelMessage

type ChannelMessage struct {
	Channel              string   `protobuf:"bytes,1,opt,name=channel,proto3" json:"channel,omitempty"`
	Message              string   `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	Source               string   `protobuf:"bytes,3,opt,name=source,proto3" json:"source,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ChannelMessage) Descriptor

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

func (*ChannelMessage) GetChannel

func (m *ChannelMessage) GetChannel() string

func (*ChannelMessage) GetMessage

func (m *ChannelMessage) GetMessage() string

func (*ChannelMessage) GetSource

func (m *ChannelMessage) GetSource() string

func (*ChannelMessage) ProtoMessage

func (*ChannelMessage) ProtoMessage()

func (*ChannelMessage) Reset

func (m *ChannelMessage) Reset()

func (*ChannelMessage) String

func (m *ChannelMessage) String() string

func (*ChannelMessage) XXX_DiscardUnknown

func (m *ChannelMessage) XXX_DiscardUnknown()

func (*ChannelMessage) XXX_Marshal

func (m *ChannelMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ChannelMessage) XXX_Merge

func (m *ChannelMessage) XXX_Merge(src proto.Message)

func (*ChannelMessage) XXX_Size

func (m *ChannelMessage) XXX_Size() int

func (*ChannelMessage) XXX_Unmarshal

func (m *ChannelMessage) XXX_Unmarshal(b []byte) error

type Empty

type Empty struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Empty) Descriptor

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

func (*Empty) ProtoMessage

func (*Empty) ProtoMessage()

func (*Empty) Reset

func (m *Empty) Reset()

func (*Empty) String

func (m *Empty) String() string

func (*Empty) XXX_DiscardUnknown

func (m *Empty) XXX_DiscardUnknown()

func (*Empty) XXX_Marshal

func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Empty) XXX_Merge

func (m *Empty) XXX_Merge(src proto.Message)

func (*Empty) XXX_Size

func (m *Empty) XXX_Size() int

func (*Empty) XXX_Unmarshal

func (m *Empty) XXX_Unmarshal(b []byte) error

type Error

type Error struct {
	Message              string   `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Error) Descriptor

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

func (*Error) GetMessage

func (m *Error) GetMessage() string

func (*Error) ProtoMessage

func (*Error) ProtoMessage()

func (*Error) Reset

func (m *Error) Reset()

func (*Error) String

func (m *Error) String() string

func (*Error) XXX_DiscardUnknown

func (m *Error) XXX_DiscardUnknown()

func (*Error) XXX_Marshal

func (m *Error) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Error) XXX_Merge

func (m *Error) XXX_Merge(src proto.Message)

func (*Error) XXX_Size

func (m *Error) XXX_Size() int

func (*Error) XXX_Unmarshal

func (m *Error) XXX_Unmarshal(b []byte) error

type GrpcServer

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

func NewGrpcServer

func NewGrpcServer(conn *irc.Connection, eventManager *irc.EventManager, rpcPort int, plugins []Plugin, webPort int, logger *zap.SugaredLogger) GrpcServer

func (*GrpcServer) StartGRPC

func (s *GrpcServer) StartGRPC()

type HTTPPluginClient

type HTTPPluginClient interface {
	GetRequest(ctx context.Context, opts ...grpc.CallOption) (HTTPPlugin_GetRequestClient, error)
}

HTTPPluginClient is the client API for HTTPPlugin service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewHTTPPluginClient

func NewHTTPPluginClient(cc grpc.ClientConnInterface) HTTPPluginClient

type HTTPPluginServer

type HTTPPluginServer interface {
	GetRequest(HTTPPlugin_GetRequestServer) error
}

HTTPPluginServer is the server API for HTTPPlugin service.

type HTTPPlugin_GetRequestClient

type HTTPPlugin_GetRequestClient interface {
	Send(*HttpResponse) error
	Recv() (*HttpRequest, error)
	grpc.ClientStream
}

type HTTPPlugin_GetRequestServer

type HTTPPlugin_GetRequestServer interface {
	Send(*HttpRequest) error
	Recv() (*HttpResponse, error)
	grpc.ServerStream
}

type HttpHeader

type HttpHeader struct {
	Key                  string   `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Value                string   `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func ConvertToRPCHeaders

func ConvertToRPCHeaders(headers http.Header) []*HttpHeader

func (*HttpHeader) Descriptor

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

func (*HttpHeader) GetKey

func (m *HttpHeader) GetKey() string

func (*HttpHeader) GetValue

func (m *HttpHeader) GetValue() string

func (*HttpHeader) ProtoMessage

func (*HttpHeader) ProtoMessage()

func (*HttpHeader) Reset

func (m *HttpHeader) Reset()

func (*HttpHeader) String

func (m *HttpHeader) String() string

func (*HttpHeader) XXX_DiscardUnknown

func (m *HttpHeader) XXX_DiscardUnknown()

func (*HttpHeader) XXX_Marshal

func (m *HttpHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*HttpHeader) XXX_Merge

func (m *HttpHeader) XXX_Merge(src proto.Message)

func (*HttpHeader) XXX_Size

func (m *HttpHeader) XXX_Size() int

func (*HttpHeader) XXX_Unmarshal

func (m *HttpHeader) XXX_Unmarshal(b []byte) error

type HttpRequest

type HttpRequest struct {
	Header               []*HttpHeader `protobuf:"bytes,1,rep,name=header,proto3" json:"header,omitempty"`
	Body                 []byte        `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"`
	Path                 string        `protobuf:"bytes,3,opt,name=path,proto3" json:"path,omitempty"`
	Method               string        `protobuf:"bytes,4,opt,name=method,proto3" json:"method,omitempty"`
	XXX_NoUnkeyedLiteral struct{}      `json:"-"`
	XXX_unrecognized     []byte        `json:"-"`
	XXX_sizecache        int32         `json:"-"`
}

func (*HttpRequest) Descriptor

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

func (*HttpRequest) GetBody

func (m *HttpRequest) GetBody() []byte

func (*HttpRequest) GetHeader

func (m *HttpRequest) GetHeader() []*HttpHeader

func (*HttpRequest) GetMethod

func (m *HttpRequest) GetMethod() string

func (*HttpRequest) GetPath

func (m *HttpRequest) GetPath() string

func (*HttpRequest) ProtoMessage

func (*HttpRequest) ProtoMessage()

func (*HttpRequest) Reset

func (m *HttpRequest) Reset()

func (*HttpRequest) String

func (m *HttpRequest) String() string

func (*HttpRequest) XXX_DiscardUnknown

func (m *HttpRequest) XXX_DiscardUnknown()

func (*HttpRequest) XXX_Marshal

func (m *HttpRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*HttpRequest) XXX_Merge

func (m *HttpRequest) XXX_Merge(src proto.Message)

func (*HttpRequest) XXX_Size

func (m *HttpRequest) XXX_Size() int

func (*HttpRequest) XXX_Unmarshal

func (m *HttpRequest) XXX_Unmarshal(b []byte) error

type HttpResponse

type HttpResponse struct {
	Header               []*HttpHeader `protobuf:"bytes,1,rep,name=header,proto3" json:"header,omitempty"`
	Body                 []byte        `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"`
	Status               int32         `protobuf:"varint,3,opt,name=status,proto3" json:"status,omitempty"`
	XXX_NoUnkeyedLiteral struct{}      `json:"-"`
	XXX_unrecognized     []byte        `json:"-"`
	XXX_sizecache        int32         `json:"-"`
}

func (*HttpResponse) Descriptor

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

func (*HttpResponse) GetBody

func (m *HttpResponse) GetBody() []byte

func (*HttpResponse) GetHeader

func (m *HttpResponse) GetHeader() []*HttpHeader

func (*HttpResponse) GetStatus

func (m *HttpResponse) GetStatus() int32

func (*HttpResponse) ProtoMessage

func (*HttpResponse) ProtoMessage()

func (*HttpResponse) Reset

func (m *HttpResponse) Reset()

func (*HttpResponse) String

func (m *HttpResponse) String() string

func (*HttpResponse) XXX_DiscardUnknown

func (m *HttpResponse) XXX_DiscardUnknown()

func (*HttpResponse) XXX_Marshal

func (m *HttpResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*HttpResponse) XXX_Merge

func (m *HttpResponse) XXX_Merge(src proto.Message)

func (*HttpResponse) XXX_Size

func (m *HttpResponse) XXX_Size() int

func (*HttpResponse) XXX_Unmarshal

func (m *HttpResponse) XXX_Unmarshal(b []byte) error

type IRCPluginClient

type IRCPluginClient interface {
	Ping(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error)
	SendChannelMessage(ctx context.Context, in *ChannelMessage, opts ...grpc.CallOption) (*Error, error)
	SendRawMessage(ctx context.Context, in *RawMessage, opts ...grpc.CallOption) (*Error, error)
	GetMessages(ctx context.Context, in *Channel, opts ...grpc.CallOption) (IRCPlugin_GetMessagesClient, error)
}

IRCPluginClient is the client API for IRCPlugin service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewIRCPluginClient

func NewIRCPluginClient(cc grpc.ClientConnInterface) IRCPluginClient

type IRCPluginServer

type IRCPluginServer interface {
	Ping(context.Context, *Empty) (*Empty, error)
	SendChannelMessage(context.Context, *ChannelMessage) (*Error, error)
	SendRawMessage(context.Context, *RawMessage) (*Error, error)
	GetMessages(*Channel, IRCPlugin_GetMessagesServer) error
}

IRCPluginServer is the server API for IRCPlugin service.

type IRCPlugin_GetMessagesClient

type IRCPlugin_GetMessagesClient interface {
	Recv() (*ChannelMessage, error)
	grpc.ClientStream
}

type IRCPlugin_GetMessagesServer

type IRCPlugin_GetMessagesServer interface {
	Send(*ChannelMessage) error
	grpc.ServerStream
}

type Plugin

type Plugin struct {
	Name  string
	Token string
}

func ParsePluginString

func ParsePluginString(pluginString string) (plugins []Plugin, err error)

type RawMessage

type RawMessage struct {
	Message              string   `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*RawMessage) Descriptor

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

func (*RawMessage) GetMessage

func (m *RawMessage) GetMessage() string

func (*RawMessage) ProtoMessage

func (*RawMessage) ProtoMessage()

func (*RawMessage) Reset

func (m *RawMessage) Reset()

func (*RawMessage) String

func (m *RawMessage) String() string

func (*RawMessage) XXX_DiscardUnknown

func (m *RawMessage) XXX_DiscardUnknown()

func (*RawMessage) XXX_Marshal

func (m *RawMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*RawMessage) XXX_Merge

func (m *RawMessage) XXX_Merge(src proto.Message)

func (*RawMessage) XXX_Size

func (m *RawMessage) XXX_Size() int

func (*RawMessage) XXX_Unmarshal

func (m *RawMessage) XXX_Unmarshal(b []byte) error

type Route

type Route struct {
	Prefix               string   `protobuf:"bytes,1,opt,name=prefix,proto3" json:"prefix,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Route) Descriptor

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

func (*Route) GetPrefix

func (m *Route) GetPrefix() string

func (*Route) ProtoMessage

func (*Route) ProtoMessage()

func (*Route) Reset

func (m *Route) Reset()

func (*Route) String

func (m *Route) String() string

func (*Route) XXX_DiscardUnknown

func (m *Route) XXX_DiscardUnknown()

func (*Route) XXX_Marshal

func (m *Route) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Route) XXX_Merge

func (m *Route) XXX_Merge(src proto.Message)

func (*Route) XXX_Size

func (m *Route) XXX_Size() int

func (*Route) XXX_Unmarshal

func (m *Route) XXX_Unmarshal(b []byte) error

type UnimplementedHTTPPluginServer

type UnimplementedHTTPPluginServer struct {
}

UnimplementedHTTPPluginServer can be embedded to have forward compatible implementations.

func (*UnimplementedHTTPPluginServer) GetRequest

type UnimplementedIRCPluginServer

type UnimplementedIRCPluginServer struct {
}

UnimplementedIRCPluginServer can be embedded to have forward compatible implementations.

func (*UnimplementedIRCPluginServer) GetMessages

func (*UnimplementedIRCPluginServer) Ping

func (*UnimplementedIRCPluginServer) SendChannelMessage

func (*UnimplementedIRCPluginServer) SendChannelMessage(ctx context.Context, req *ChannelMessage) (*Error, error)

func (*UnimplementedIRCPluginServer) SendRawMessage

func (*UnimplementedIRCPluginServer) SendRawMessage(ctx context.Context, req *RawMessage) (*Error, error)

Jump to

Keyboard shortcuts

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