grpctunnel

package
v0.0.0-...-c7154f0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TunnelService_OpenTunnel_FullMethodName        = "/sesame.type.TunnelService/OpenTunnel"
	TunnelService_OpenReverseTunnel_FullMethodName = "/sesame.type.TunnelService/OpenReverseTunnel"
)

Variables

View Source
var File_sesame_type_grpctunnel_proto protoreflect.FileDescriptor
View Source
var TunnelService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "sesame.type.TunnelService",
	HandlerType: (*TunnelServiceServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "OpenTunnel",
			Handler:       _TunnelService_OpenTunnel_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
		{
			StreamName:    "OpenReverseTunnel",
			Handler:       _TunnelService_OpenReverseTunnel_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "sesame/type/grpctunnel.proto",
}

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

Functions

func RegisterTunnelServiceServer

func RegisterTunnelServiceServer(s grpc.ServiceRegistrar, srv TunnelServiceServer)

Types

type ClientToServer

type ClientToServer struct {

	// The ID of the stream. Stream IDs must be used in increasing order and
	// cannot be re-used.
	StreamId uint64 `protobuf:"varint,1,opt,name=stream_id,json=streamId,proto3" json:"stream_id,omitempty"`
	// Types that are assignable to Frame:
	//
	//	*ClientToServer_WindowUpdate
	//	*ClientToServer_NewStream_
	//	*ClientToServer_Message
	//	*ClientToServer_MessageData
	//	*ClientToServer_HalfClose
	//	*ClientToServer_Cancel
	Frame isClientToServer_Frame `protobuf_oneof:"frame"`
	// contains filtered or unexported fields
}

ClientToServer is the message a client sends to a server.

For a single stream ID, the first such message must include the new_stream field. After that, there can be any number of requests sent, via the request_message field and additional messages thereafter that use the message_data field (for requests that are larger than 16kb). And finally, the RPC ends with either the half_close or cancel fields. If the half_close field is used, the RPC stream remains active so the server may continue to send response data. But, if the cancel field is used, the RPC stream is aborted and thus closed on both client and server ends. If a stream has been half-closed, the only allowed message from the client for that stream ID is one with the cancel field, to abort the remainder of the operation.

func (*ClientToServer) Descriptor deprecated

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

Deprecated: Use ClientToServer.ProtoReflect.Descriptor instead.

func (*ClientToServer) GetCancel

func (x *ClientToServer) GetCancel() *emptypb.Empty

func (*ClientToServer) GetFrame

func (m *ClientToServer) GetFrame() isClientToServer_Frame

func (*ClientToServer) GetHalfClose

func (x *ClientToServer) GetHalfClose() *emptypb.Empty

func (*ClientToServer) GetMessage

func (x *ClientToServer) GetMessage() *EncodedMessage

func (*ClientToServer) GetMessageData

func (x *ClientToServer) GetMessageData() []byte

func (*ClientToServer) GetNewStream

func (x *ClientToServer) GetNewStream() *ClientToServer_NewStream

func (*ClientToServer) GetStreamId

func (x *ClientToServer) GetStreamId() uint64

func (*ClientToServer) GetWindowUpdate

func (x *ClientToServer) GetWindowUpdate() uint32

func (*ClientToServer) ProtoMessage

func (*ClientToServer) ProtoMessage()

func (*ClientToServer) ProtoReflect

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

func (*ClientToServer) Proto_ShallowClone

func (x *ClientToServer) Proto_ShallowClone() (c *ClientToServer)

Proto_ShallowClone returns a shallow copy of the receiver or nil if it's nil.

func (*ClientToServer) Proto_ShallowCopy

func (x *ClientToServer) Proto_ShallowCopy(v interface{})

Proto_ShallowCopy copies fields, from v to the receiver, using field getters. Note that v is of an arbitrary type, which may implement any number of the field getters, which are defined as any methods of the same signature as those generated for the receiver type, with a name starting with Get. WARNING: Optional fields may be ignored, if v is not the receiver type.

func (*ClientToServer) Reset

func (x *ClientToServer) Reset()

func (*ClientToServer) String

func (x *ClientToServer) String() string

type ClientToServer_Cancel

type ClientToServer_Cancel struct {
	// Aborts the stream. No other messages should be sent for this stream.
	Cancel *emptypb.Empty `protobuf:"bytes,7,opt,name=cancel,proto3,oneof"`
}

type ClientToServer_HalfClose

type ClientToServer_HalfClose struct {
	// Half-closes the stream, signaling that no more request messages will
	// be sent. No other messages, other than one with the cancel field set,
	// should be sent for this stream.
	HalfClose *emptypb.Empty `protobuf:"bytes,6,opt,name=half_close,json=halfClose,proto3,oneof"`
}

type ClientToServer_Message

type ClientToServer_Message struct {
	// Sends a message on the RPC stream. If the message is larger than 16k,
	// the rest of the message should be sent in chunks using the
	// message_data field (up to 16kb of data in each chunk).
	Message *EncodedMessage `protobuf:"bytes,4,opt,name=message,proto3,oneof"`
}

type ClientToServer_MessageData

type ClientToServer_MessageData struct {
	// Sends a chunk of request data, for a request message that could not
	// wholly fit in a request_message field (e.g. > 16kb).
	MessageData []byte `protobuf:"bytes,5,opt,name=message_data,json=messageData,proto3,oneof"`
}

type ClientToServer_NewStream

type ClientToServer_NewStream struct {
	Method string                     `protobuf:"bytes,1,opt,name=method,proto3" json:"method,omitempty"`
	Header *grpcmetadata.GrpcMetadata `protobuf:"bytes,2,opt,name=header,proto3" json:"header,omitempty"`
	// contains filtered or unexported fields
}

func (*ClientToServer_NewStream) Descriptor deprecated

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

Deprecated: Use ClientToServer_NewStream.ProtoReflect.Descriptor instead.

func (*ClientToServer_NewStream) GetHeader

func (*ClientToServer_NewStream) GetMethod

func (x *ClientToServer_NewStream) GetMethod() string

func (*ClientToServer_NewStream) ProtoMessage

func (*ClientToServer_NewStream) ProtoMessage()

func (*ClientToServer_NewStream) ProtoReflect

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

func (*ClientToServer_NewStream) Proto_ShallowClone

func (x *ClientToServer_NewStream) Proto_ShallowClone() (c *ClientToServer_NewStream)

Proto_ShallowClone returns a shallow copy of the receiver or nil if it's nil.

func (*ClientToServer_NewStream) Proto_ShallowCopy

func (x *ClientToServer_NewStream) Proto_ShallowCopy(v interface{})

Proto_ShallowCopy copies fields, from v to the receiver, using field getters. Note that v is of an arbitrary type, which may implement any number of the field getters, which are defined as any methods of the same signature as those generated for the receiver type, with a name starting with Get. WARNING: Optional fields may be ignored, if v is not the receiver type.

func (*ClientToServer_NewStream) Reset

func (x *ClientToServer_NewStream) Reset()

func (*ClientToServer_NewStream) String

func (x *ClientToServer_NewStream) String() string

type ClientToServer_NewStream_

type ClientToServer_NewStream_ struct {
	// Creates a new RPC stream, which includes request header metadata. The
	// stream ID must not be an already active stream.
	NewStream *ClientToServer_NewStream `protobuf:"bytes,3,opt,name=new_stream,json=newStream,proto3,oneof"`
}

type ClientToServer_WindowUpdate

type ClientToServer_WindowUpdate struct {
	// Per-stream flow control message, based on HTTP/2.
	// Note that only message/message_data frames are subject to flow control.
	// https://datatracker.ietf.org/doc/html/rfc7540#section-6.9
	WindowUpdate uint32 `protobuf:"varint,2,opt,name=window_update,json=windowUpdate,proto3,oneof"`
}

type EncodedMessage

type EncodedMessage struct {

	// The full size of the message.
	Size int32 `protobuf:"varint,1,opt,name=size,proto3" json:"size,omitempty"`
	// The message data. This field should not be longer than 16kb (16,384
	// bytes). If the full size of the message is larger then it should be
	// split into multiple chunks. The chunking is done to allow multiple
	// access to the underlying gRPC stream by concurrent tunneled streams.
	// If very large messages were sent via a single chunk, it could cause
	// head-of-line blocking and starvation when multiple streams need to send
	// data on the one underlying gRPC stream.
	Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

EncodedMessage models a binary gRPC message, and is used to frame tunneled messages.

func (*EncodedMessage) Descriptor deprecated

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

Deprecated: Use EncodedMessage.ProtoReflect.Descriptor instead.

func (*EncodedMessage) GetData

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

func (*EncodedMessage) GetSize

func (x *EncodedMessage) GetSize() int32

func (*EncodedMessage) ProtoMessage

func (*EncodedMessage) ProtoMessage()

func (*EncodedMessage) ProtoReflect

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

func (*EncodedMessage) Proto_ShallowClone

func (x *EncodedMessage) Proto_ShallowClone() (c *EncodedMessage)

Proto_ShallowClone returns a shallow copy of the receiver or nil if it's nil.

func (*EncodedMessage) Proto_ShallowCopy

func (x *EncodedMessage) Proto_ShallowCopy(v interface{})

Proto_ShallowCopy copies fields, from v to the receiver, using field getters. Note that v is of an arbitrary type, which may implement any number of the field getters, which are defined as any methods of the same signature as those generated for the receiver type, with a name starting with Get. WARNING: Optional fields may be ignored, if v is not the receiver type.

func (*EncodedMessage) Reset

func (x *EncodedMessage) Reset()

func (*EncodedMessage) String

func (x *EncodedMessage) String() string

type ServerToClient

type ServerToClient struct {

	// The ID of the stream. Stream IDs are defined by the client and should be
	// used in monotonically increasing order. They cannot be re-used.
	StreamId uint64 `protobuf:"varint,1,opt,name=stream_id,json=streamId,proto3" json:"stream_id,omitempty"`
	// Types that are assignable to Frame:
	//
	//	*ServerToClient_WindowUpdate
	//	*ServerToClient_Header
	//	*ServerToClient_Message
	//	*ServerToClient_MessageData
	//	*ServerToClient_CloseStream_
	Frame isServerToClient_Frame `protobuf_oneof:"frame"`
	// contains filtered or unexported fields
}

ServerToClient is the message a server sends to a client.

For a single stream ID, the first such message should include the response_headers field unless no headers are to be sent. After the headers, the server can send any number of responses, via the response_message field and additional messages thereafter that use the message_data field (for responses that are larger than 16kb). A message with the close_stream field concludes the stream, whether it terminates successfully or with an error.

func (*ServerToClient) Descriptor deprecated

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

Deprecated: Use ServerToClient.ProtoReflect.Descriptor instead.

func (*ServerToClient) GetCloseStream

func (x *ServerToClient) GetCloseStream() *ServerToClient_CloseStream

func (*ServerToClient) GetFrame

func (m *ServerToClient) GetFrame() isServerToClient_Frame

func (*ServerToClient) GetHeader

func (x *ServerToClient) GetHeader() *grpcmetadata.GrpcMetadata

func (*ServerToClient) GetMessage

func (x *ServerToClient) GetMessage() *EncodedMessage

func (*ServerToClient) GetMessageData

func (x *ServerToClient) GetMessageData() []byte

func (*ServerToClient) GetStreamId

func (x *ServerToClient) GetStreamId() uint64

func (*ServerToClient) GetWindowUpdate

func (x *ServerToClient) GetWindowUpdate() uint32

func (*ServerToClient) ProtoMessage

func (*ServerToClient) ProtoMessage()

func (*ServerToClient) ProtoReflect

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

func (*ServerToClient) Proto_ShallowClone

func (x *ServerToClient) Proto_ShallowClone() (c *ServerToClient)

Proto_ShallowClone returns a shallow copy of the receiver or nil if it's nil.

func (*ServerToClient) Proto_ShallowCopy

func (x *ServerToClient) Proto_ShallowCopy(v interface{})

Proto_ShallowCopy copies fields, from v to the receiver, using field getters. Note that v is of an arbitrary type, which may implement any number of the field getters, which are defined as any methods of the same signature as those generated for the receiver type, with a name starting with Get. WARNING: Optional fields may be ignored, if v is not the receiver type.

func (*ServerToClient) Reset

func (x *ServerToClient) Reset()

func (*ServerToClient) String

func (x *ServerToClient) String() string

type ServerToClient_CloseStream

type ServerToClient_CloseStream struct {
	Trailer *grpcmetadata.GrpcMetadata `protobuf:"bytes,1,opt,name=trailer,proto3" json:"trailer,omitempty"`
	Status  *status.Status             `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"`
	// contains filtered or unexported fields
}

func (*ServerToClient_CloseStream) Descriptor deprecated

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

Deprecated: Use ServerToClient_CloseStream.ProtoReflect.Descriptor instead.

func (*ServerToClient_CloseStream) GetStatus

func (x *ServerToClient_CloseStream) GetStatus() *status.Status

func (*ServerToClient_CloseStream) GetTrailer

func (*ServerToClient_CloseStream) ProtoMessage

func (*ServerToClient_CloseStream) ProtoMessage()

func (*ServerToClient_CloseStream) ProtoReflect

func (*ServerToClient_CloseStream) Proto_ShallowClone

func (x *ServerToClient_CloseStream) Proto_ShallowClone() (c *ServerToClient_CloseStream)

Proto_ShallowClone returns a shallow copy of the receiver or nil if it's nil.

func (*ServerToClient_CloseStream) Proto_ShallowCopy

func (x *ServerToClient_CloseStream) Proto_ShallowCopy(v interface{})

Proto_ShallowCopy copies fields, from v to the receiver, using field getters. Note that v is of an arbitrary type, which may implement any number of the field getters, which are defined as any methods of the same signature as those generated for the receiver type, with a name starting with Get. WARNING: Optional fields may be ignored, if v is not the receiver type.

func (*ServerToClient_CloseStream) Reset

func (x *ServerToClient_CloseStream) Reset()

func (*ServerToClient_CloseStream) String

func (x *ServerToClient_CloseStream) String() string

type ServerToClient_CloseStream_

type ServerToClient_CloseStream_ struct {
	// Terminates the stream and communicates the final disposition to the
	// client. After the stream is closed, no other messages should use the
	// given stream ID.
	CloseStream *ServerToClient_CloseStream `protobuf:"bytes,6,opt,name=close_stream,json=closeStream,proto3,oneof"`
}

type ServerToClient_Header

type ServerToClient_Header struct {
	// Sends response headers for this stream. If headers are sent at all,
	// they must be sent before any response message data.
	Header *grpcmetadata.GrpcMetadata `protobuf:"bytes,3,opt,name=header,proto3,oneof"`
}

type ServerToClient_Message

type ServerToClient_Message struct {
	// Sends a message on the RPC stream. If the message is larger than 16k,
	// the rest of the message should be sent in chunks using the
	// message_data field (up to 16kb of data in each chunk).
	Message *EncodedMessage `protobuf:"bytes,4,opt,name=message,proto3,oneof"`
}

type ServerToClient_MessageData

type ServerToClient_MessageData struct {
	// Sends a chunk of response data, for a response message that could not
	// wholly fit in a response_message field (e.g. > 16kb).
	MessageData []byte `protobuf:"bytes,5,opt,name=message_data,json=messageData,proto3,oneof"`
}

type ServerToClient_WindowUpdate

type ServerToClient_WindowUpdate struct {
	// Per-stream flow control message, based on HTTP/2.
	// Note that only message/message_data frames are subject to flow control.
	// https://datatracker.ietf.org/doc/html/rfc7540#section-6.9
	WindowUpdate uint32 `protobuf:"varint,2,opt,name=window_update,json=windowUpdate,proto3,oneof"`
}

type TunnelServiceClient

type TunnelServiceClient interface {
	// OpenTunnel creates a channel to the server which can be used to send
	// additional RPCs, all of which will be sent to the same server via a
	// single underlying gRPC stream. This can provide affinity for a "chatty"
	// sequence of calls, where the gRPC connection is load balanced (so there
	// may be multiple backend servers), but a particular "conversation" (which
	// may consist of numerous RPCs) needs to all go to a single server, for
	// consistency.
	OpenTunnel(ctx context.Context, opts ...grpc.CallOption) (TunnelService_OpenTunnelClient, error)
	// OpenReverseTunnel creates a "reverse" channel, which allows the server to
	// act as a client and send RPCs to the client that creates the tunnel. It
	// is in most respects identical to OpenTunnel except that the roles are
	// reversed: the server initiates RPCs and sends requests and the client
	// replies to them and sends responses.
	OpenReverseTunnel(ctx context.Context, opts ...grpc.CallOption) (TunnelService_OpenReverseTunnelClient, error)
}

TunnelServiceClient is the client API for TunnelService 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 TunnelServiceServer

type TunnelServiceServer interface {
	// OpenTunnel creates a channel to the server which can be used to send
	// additional RPCs, all of which will be sent to the same server via a
	// single underlying gRPC stream. This can provide affinity for a "chatty"
	// sequence of calls, where the gRPC connection is load balanced (so there
	// may be multiple backend servers), but a particular "conversation" (which
	// may consist of numerous RPCs) needs to all go to a single server, for
	// consistency.
	OpenTunnel(TunnelService_OpenTunnelServer) error
	// OpenReverseTunnel creates a "reverse" channel, which allows the server to
	// act as a client and send RPCs to the client that creates the tunnel. It
	// is in most respects identical to OpenTunnel except that the roles are
	// reversed: the server initiates RPCs and sends requests and the client
	// replies to them and sends responses.
	OpenReverseTunnel(TunnelService_OpenReverseTunnelServer) error
	// contains filtered or unexported methods
}

TunnelServiceServer is the server API for TunnelService service. All implementations must embed UnimplementedTunnelServiceServer for forward compatibility

type TunnelService_OpenReverseTunnelClient

type TunnelService_OpenReverseTunnelClient interface {
	Send(*ServerToClient) error
	Recv() (*ClientToServer, error)
	grpc.ClientStream
}

type TunnelService_OpenReverseTunnelServer

type TunnelService_OpenReverseTunnelServer interface {
	Send(*ClientToServer) error
	Recv() (*ServerToClient, error)
	grpc.ServerStream
}

type TunnelService_OpenTunnelClient

type TunnelService_OpenTunnelClient interface {
	Send(*ClientToServer) error
	Recv() (*ServerToClient, error)
	grpc.ClientStream
}

type TunnelService_OpenTunnelServer

type TunnelService_OpenTunnelServer interface {
	Send(*ServerToClient) error
	Recv() (*ClientToServer, error)
	grpc.ServerStream
}

type UnimplementedTunnelServiceServer

type UnimplementedTunnelServiceServer struct {
}

UnimplementedTunnelServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedTunnelServiceServer) OpenReverseTunnel

func (UnimplementedTunnelServiceServer) OpenTunnel

type UnsafeTunnelServiceServer

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

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

Jump to

Keyboard shortcuts

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