v1

package
v0.0.0-...-04cc12e Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const TunnelPathPrefix = "/twirp/service.rpc.v1.Tunnel/"

TunnelPathPrefix is a convenience constant that may identify URL paths. Should be used with caution, it only matches routes generated by Twirp Go clients, with the default "/twirp" prefix and default CamelCase service and method names. More info: https://twitchtv.github.io/twirp/docs/routing.html

Variables

View Source
var (
	SdpKind_name = map[int32]string{
		0: "SDP_KIND_UNSPECIFIED",
		1: "SDP_KIND_OFFER",
		2: "SDP_KIND_ANSWER",
		3: "SDP_KIND_PRANSWER",
		4: "SDP_KIND_ROLLBACK",
	}
	SdpKind_value = map[string]int32{
		"SDP_KIND_UNSPECIFIED": 0,
		"SDP_KIND_OFFER":       1,
		"SDP_KIND_ANSWER":      2,
		"SDP_KIND_PRANSWER":    3,
		"SDP_KIND_ROLLBACK":    4,
	}
)

Enum value maps for SdpKind.

View Source
var File_tunnel_proto protoreflect.FileDescriptor

Functions

func WriteError

func WriteError(resp http.ResponseWriter, err error)

WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta). Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks. If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)

Types

type Ack

type Ack struct {
	AckRanges []*AckRange `protobuf:"bytes,1,rep,name=ack_ranges,json=ackRanges,proto3" json:"ack_ranges,omitempty"`
	// contains filtered or unexported fields
}

func (*Ack) Descriptor deprecated

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

Deprecated: Use Ack.ProtoReflect.Descriptor instead.

func (*Ack) GetAckRanges

func (x *Ack) GetAckRanges() []*AckRange

func (*Ack) ProtoMessage

func (*Ack) ProtoMessage()

func (*Ack) ProtoReflect

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

func (*Ack) Reset

func (x *Ack) Reset()

func (*Ack) String

func (x *Ack) String() string

type AckRange

type AckRange struct {
	SeqnumStart uint32 `protobuf:"varint,1,opt,name=seqnum_start,json=seqnumStart,proto3" json:"seqnum_start,omitempty"`
	SeqnumEnd   uint32 `protobuf:"varint,2,opt,name=seqnum_end,json=seqnumEnd,proto3" json:"seqnum_end,omitempty"`
	// contains filtered or unexported fields
}

func (*AckRange) Descriptor deprecated

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

Deprecated: Use AckRange.ProtoReflect.Descriptor instead.

func (*AckRange) GetSeqnumEnd

func (x *AckRange) GetSeqnumEnd() uint32

func (*AckRange) GetSeqnumStart

func (x *AckRange) GetSeqnumStart() uint32

func (*AckRange) ProtoMessage

func (*AckRange) ProtoMessage()

func (*AckRange) ProtoReflect

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

func (*AckRange) Reset

func (x *AckRange) Reset()

func (*AckRange) String

func (x *AckRange) String() string

type Bye

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

func (*Bye) Descriptor deprecated

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

Deprecated: Use Bye.ProtoReflect.Descriptor instead.

func (*Bye) ProtoMessage

func (*Bye) ProtoMessage()

func (*Bye) ProtoReflect

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

func (*Bye) Reset

func (x *Bye) Reset()

func (*Bye) String

func (x *Bye) String() string

type DataChannel

type DataChannel struct {

	// Types that are assignable to Payload:
	//
	//	*DataChannel_Heartbeat
	Payload isDataChannel_Payload `protobuf_oneof:"payload"`
	// contains filtered or unexported fields
}

func (*DataChannel) Descriptor deprecated

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

Deprecated: Use DataChannel.ProtoReflect.Descriptor instead.

func (*DataChannel) GetHeartbeat

func (x *DataChannel) GetHeartbeat() *DataChannelHeartbeat

func (*DataChannel) GetPayload

func (m *DataChannel) GetPayload() isDataChannel_Payload

func (*DataChannel) ProtoMessage

func (*DataChannel) ProtoMessage()

func (*DataChannel) ProtoReflect

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

func (*DataChannel) Reset

func (x *DataChannel) Reset()

func (*DataChannel) String

func (x *DataChannel) String() string

type DataChannelHeartbeat

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

func (*DataChannelHeartbeat) Descriptor deprecated

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

Deprecated: Use DataChannelHeartbeat.ProtoReflect.Descriptor instead.

func (*DataChannelHeartbeat) ProtoMessage

func (*DataChannelHeartbeat) ProtoMessage()

func (*DataChannelHeartbeat) ProtoReflect

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

func (*DataChannelHeartbeat) Reset

func (x *DataChannelHeartbeat) Reset()

func (*DataChannelHeartbeat) String

func (x *DataChannelHeartbeat) String() string

type DataChannel_Heartbeat

type DataChannel_Heartbeat struct {
	Heartbeat *DataChannelHeartbeat `protobuf:"bytes,10,opt,name=heartbeat,proto3,oneof"`
}

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient is the interface used by generated clients to send HTTP requests. It is fulfilled by *(net/http).Client, which is sufficient for most users. Users can provide their own implementation for special retry policies.

HTTPClient implementations should not follow redirects. Redirects are automatically disabled if *(net/http).Client is passed to client constructors. See the withoutRedirects function in this file for more details.

type ICECandidate

type ICECandidate struct {
	Candidate     string  `protobuf:"bytes,1,opt,name=candidate,proto3" json:"candidate,omitempty"`
	SdpMLineIndex *uint32 `protobuf:"varint,2,opt,name=sdp_m_line_index,json=sdpMLineIndex,proto3,oneof" json:"sdp_m_line_index,omitempty"`
	SdpMid        *string `protobuf:"bytes,3,opt,name=sdp_mid,json=sdpMid,proto3,oneof" json:"sdp_mid,omitempty"`
	Username      *string `protobuf:"bytes,4,opt,name=username,proto3,oneof" json:"username,omitempty"`
	Password      *string `protobuf:"bytes,5,opt,name=password,proto3,oneof" json:"password,omitempty"`
	// contains filtered or unexported fields
}

func (*ICECandidate) Descriptor deprecated

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

Deprecated: Use ICECandidate.ProtoReflect.Descriptor instead.

func (*ICECandidate) GetCandidate

func (x *ICECandidate) GetCandidate() string

func (*ICECandidate) GetPassword

func (x *ICECandidate) GetPassword() string

func (*ICECandidate) GetSdpMLineIndex

func (x *ICECandidate) GetSdpMLineIndex() uint32

func (*ICECandidate) GetSdpMid

func (x *ICECandidate) GetSdpMid() string

func (*ICECandidate) GetUsername

func (x *ICECandidate) GetUsername() string

func (*ICECandidate) ProtoMessage

func (*ICECandidate) ProtoMessage()

func (*ICECandidate) ProtoReflect

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

func (*ICECandidate) Reset

func (x *ICECandidate) Reset()

func (*ICECandidate) String

func (x *ICECandidate) String() string

type IceServer

type IceServer struct {
	Urls       []string `protobuf:"bytes,1,rep,name=urls,proto3" json:"urls,omitempty"`
	Username   *string  `protobuf:"bytes,2,opt,name=username,proto3,oneof" json:"username,omitempty"`
	Credential *string  `protobuf:"bytes,3,opt,name=credential,proto3,oneof" json:"credential,omitempty"`
	// contains filtered or unexported fields
}

func (*IceServer) Descriptor deprecated

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

Deprecated: Use IceServer.ProtoReflect.Descriptor instead.

func (*IceServer) GetCredential

func (x *IceServer) GetCredential() string

func (*IceServer) GetUrls

func (x *IceServer) GetUrls() []string

func (*IceServer) GetUsername

func (x *IceServer) GetUsername() string

func (*IceServer) ProtoMessage

func (*IceServer) ProtoMessage()

func (*IceServer) ProtoReflect

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

func (*IceServer) Reset

func (x *IceServer) Reset()

func (*IceServer) String

func (x *IceServer) String() string

type Join

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

func (*Join) Descriptor deprecated

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

Deprecated: Use Join.ProtoReflect.Descriptor instead.

func (*Join) ProtoMessage

func (*Join) ProtoMessage()

func (*Join) ProtoReflect

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

func (*Join) Reset

func (x *Join) Reset()

func (*Join) String

func (x *Join) String() string

type Message

type Message struct {
	Header *MessageHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
	// payload will be treated as opaque in backend. Size limit is 10kB.
	Payload *MessagePayload `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"`
	// contains filtered or unexported fields
}

Use small tag numbers (1-15) for fields that are frequently used or are performance-sensitive, even if they are optional. Larger tag numbers (16 and above) can be used for fields that are optional and not frequently included in messages, as they will require more bytes to encode. Avoid the 19000–19999 range, as it's reserved. Consider future-proofing your schema by leaving gaps between field numbers to allow for extensions or new fields later.

func (*Message) Descriptor deprecated

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

Deprecated: Use Message.ProtoReflect.Descriptor instead.

func (*Message) GetHeader

func (x *Message) GetHeader() *MessageHeader

func (*Message) GetPayload

func (x *Message) GetPayload() *MessagePayload

func (*Message) ProtoMessage

func (*Message) ProtoMessage()

func (*Message) ProtoReflect

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

func (*Message) Reset

func (x *Message) Reset()

func (*Message) String

func (x *Message) String() string

type MessageHeader

type MessageHeader struct {
	GroupId      string `protobuf:"bytes,1,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"`
	PeerId       string `protobuf:"bytes,2,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"`  // where this message is originated from. Special values: "SYSTEM"
	ConnId       uint32 `protobuf:"varint,3,opt,name=conn_id,json=connId,proto3" json:"conn_id,omitempty"` // used for deciding polite vs impolite. higher id wins. It also is used to detect connection breakages
	OtherGroupId string `protobuf:"bytes,4,opt,name=other_group_id,json=otherGroupId,proto3" json:"other_group_id,omitempty"`
	OtherPeerId  string `protobuf:"bytes,5,opt,name=other_peer_id,json=otherPeerId,proto3" json:"other_peer_id,omitempty"`  // Special values: "SYSTEM"
	OtherConnId  uint32 `protobuf:"varint,6,opt,name=other_conn_id,json=otherConnId,proto3" json:"other_conn_id,omitempty"` // Special values: 0-16
	Seqnum       uint32 `protobuf:"varint,7,opt,name=seqnum,proto3" json:"seqnum,omitempty"`
	Reliable     bool   `protobuf:"varint,8,opt,name=reliable,proto3" json:"reliable,omitempty"` // true: tcp like, false: fire & forget
	// contains filtered or unexported fields
}

func (*MessageHeader) Descriptor deprecated

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

Deprecated: Use MessageHeader.ProtoReflect.Descriptor instead.

func (*MessageHeader) GetConnId

func (x *MessageHeader) GetConnId() uint32

func (*MessageHeader) GetGroupId

func (x *MessageHeader) GetGroupId() string

func (*MessageHeader) GetOtherConnId

func (x *MessageHeader) GetOtherConnId() uint32

func (*MessageHeader) GetOtherGroupId

func (x *MessageHeader) GetOtherGroupId() string

func (*MessageHeader) GetOtherPeerId

func (x *MessageHeader) GetOtherPeerId() string

func (*MessageHeader) GetPeerId

func (x *MessageHeader) GetPeerId() string

func (*MessageHeader) GetReliable

func (x *MessageHeader) GetReliable() bool

func (*MessageHeader) GetSeqnum

func (x *MessageHeader) GetSeqnum() uint32

func (*MessageHeader) ProtoMessage

func (*MessageHeader) ProtoMessage()

func (*MessageHeader) ProtoReflect

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

func (*MessageHeader) Reset

func (x *MessageHeader) Reset()

func (*MessageHeader) String

func (x *MessageHeader) String() string

type MessagePayload

type MessagePayload struct {

	// Types that are assignable to PayloadType:
	//
	//	*MessagePayload_Signal
	//	*MessagePayload_Join
	//	*MessagePayload_Bye
	//	*MessagePayload_Ack
	PayloadType isMessagePayload_PayloadType `protobuf_oneof:"payload_type"`
	// contains filtered or unexported fields
}

func (*MessagePayload) Descriptor deprecated

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

Deprecated: Use MessagePayload.ProtoReflect.Descriptor instead.

func (*MessagePayload) GetAck

func (x *MessagePayload) GetAck() *Ack

func (*MessagePayload) GetBye

func (x *MessagePayload) GetBye() *Bye

func (*MessagePayload) GetJoin

func (x *MessagePayload) GetJoin() *Join

func (*MessagePayload) GetPayloadType

func (m *MessagePayload) GetPayloadType() isMessagePayload_PayloadType

func (*MessagePayload) GetSignal

func (x *MessagePayload) GetSignal() *Signal

func (*MessagePayload) ProtoMessage

func (*MessagePayload) ProtoMessage()

func (*MessagePayload) ProtoReflect

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

func (*MessagePayload) Reset

func (x *MessagePayload) Reset()

func (*MessagePayload) String

func (x *MessagePayload) String() string

type MessagePayload_Ack

type MessagePayload_Ack struct {
	Ack *Ack `protobuf:"bytes,4,opt,name=ack,proto3,oneof"`
}

type MessagePayload_Bye

type MessagePayload_Bye struct {
	Bye *Bye `protobuf:"bytes,3,opt,name=bye,proto3,oneof"`
}

type MessagePayload_Join

type MessagePayload_Join struct {
	Join *Join `protobuf:"bytes,2,opt,name=join,proto3,oneof"`
}

type MessagePayload_Signal

type MessagePayload_Signal struct {
	Signal *Signal `protobuf:"bytes,1,opt,name=signal,proto3,oneof"`
}

type PeerInfo

type PeerInfo struct {
	ConnId          uint32 `protobuf:"varint,1,opt,name=conn_id,json=connId,proto3" json:"conn_id,omitempty"`
	EnableDiscovery bool   `protobuf:"varint,2,opt,name=enable_discovery,json=enableDiscovery,proto3" json:"enable_discovery,omitempty"`
	// contains filtered or unexported fields
}

func (*PeerInfo) Descriptor deprecated

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

Deprecated: Use PeerInfo.ProtoReflect.Descriptor instead.

func (*PeerInfo) GetConnId

func (x *PeerInfo) GetConnId() uint32

func (*PeerInfo) GetEnableDiscovery

func (x *PeerInfo) GetEnableDiscovery() bool

func (*PeerInfo) ProtoMessage

func (*PeerInfo) ProtoMessage()

func (*PeerInfo) ProtoReflect

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

func (*PeerInfo) Reset

func (x *PeerInfo) Reset()

func (*PeerInfo) String

func (x *PeerInfo) String() string

type PrepareReq

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

func (*PrepareReq) Descriptor deprecated

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

Deprecated: Use PrepareReq.ProtoReflect.Descriptor instead.

func (*PrepareReq) ProtoMessage

func (*PrepareReq) ProtoMessage()

func (*PrepareReq) ProtoReflect

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

func (*PrepareReq) Reset

func (x *PrepareReq) Reset()

func (*PrepareReq) String

func (x *PrepareReq) String() string

type PrepareResp

type PrepareResp struct {
	IceServers []*IceServer `protobuf:"bytes,1,rep,name=ice_servers,json=iceServers,proto3" json:"ice_servers,omitempty"`
	// contains filtered or unexported fields
}

func (*PrepareResp) Descriptor deprecated

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

Deprecated: Use PrepareResp.ProtoReflect.Descriptor instead.

func (*PrepareResp) GetIceServers

func (x *PrepareResp) GetIceServers() []*IceServer

func (*PrepareResp) ProtoMessage

func (*PrepareResp) ProtoMessage()

func (*PrepareResp) ProtoReflect

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

func (*PrepareResp) Reset

func (x *PrepareResp) Reset()

func (*PrepareResp) String

func (x *PrepareResp) String() string

type RecvReq

type RecvReq struct {
	Info *PeerInfo `protobuf:"bytes,1,opt,name=info,proto3" json:"info,omitempty"`
	// contains filtered or unexported fields
}

func (*RecvReq) Descriptor deprecated

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

Deprecated: Use RecvReq.ProtoReflect.Descriptor instead.

func (*RecvReq) GetInfo

func (x *RecvReq) GetInfo() *PeerInfo

func (*RecvReq) ProtoMessage

func (*RecvReq) ProtoMessage()

func (*RecvReq) ProtoReflect

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

func (*RecvReq) Reset

func (x *RecvReq) Reset()

func (*RecvReq) String

func (x *RecvReq) String() string

type RecvResp

type RecvResp struct {
	Msgs []*Message `protobuf:"bytes,1,rep,name=msgs,proto3" json:"msgs,omitempty"`
	// contains filtered or unexported fields
}

func (*RecvResp) Descriptor deprecated

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

Deprecated: Use RecvResp.ProtoReflect.Descriptor instead.

func (*RecvResp) GetMsgs

func (x *RecvResp) GetMsgs() []*Message

func (*RecvResp) ProtoMessage

func (*RecvResp) ProtoMessage()

func (*RecvResp) ProtoReflect

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

func (*RecvResp) Reset

func (x *RecvResp) Reset()

func (*RecvResp) String

func (x *RecvResp) String() string

type Sdp

type Sdp struct {
	Kind SdpKind `protobuf:"varint,1,opt,name=kind,proto3,enum=service.rpc.v1.SdpKind" json:"kind,omitempty"`
	Sdp  string  `protobuf:"bytes,2,opt,name=sdp,proto3" json:"sdp,omitempty"`
	// contains filtered or unexported fields
}

func (*Sdp) Descriptor deprecated

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

Deprecated: Use Sdp.ProtoReflect.Descriptor instead.

func (*Sdp) GetKind

func (x *Sdp) GetKind() SdpKind

func (*Sdp) GetSdp

func (x *Sdp) GetSdp() string

func (*Sdp) ProtoMessage

func (*Sdp) ProtoMessage()

func (*Sdp) ProtoReflect

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

func (*Sdp) Reset

func (x *Sdp) Reset()

func (*Sdp) String

func (x *Sdp) String() string

type SdpKind

type SdpKind int32
const (
	SdpKind_SDP_KIND_UNSPECIFIED SdpKind = 0
	SdpKind_SDP_KIND_OFFER       SdpKind = 1
	SdpKind_SDP_KIND_ANSWER      SdpKind = 2
	SdpKind_SDP_KIND_PRANSWER    SdpKind = 3
	SdpKind_SDP_KIND_ROLLBACK    SdpKind = 4
)

func (SdpKind) Descriptor

func (SdpKind) Descriptor() protoreflect.EnumDescriptor

func (SdpKind) Enum

func (x SdpKind) Enum() *SdpKind

func (SdpKind) EnumDescriptor deprecated

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

Deprecated: Use SdpKind.Descriptor instead.

func (SdpKind) Number

func (x SdpKind) Number() protoreflect.EnumNumber

func (SdpKind) String

func (x SdpKind) String() string

func (SdpKind) Type

func (SdpKind) Type() protoreflect.EnumType

type SendReq

type SendReq struct {
	Msg *Message `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"`
	// contains filtered or unexported fields
}

func (*SendReq) Descriptor deprecated

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

Deprecated: Use SendReq.ProtoReflect.Descriptor instead.

func (*SendReq) GetMsg

func (x *SendReq) GetMsg() *Message

func (*SendReq) ProtoMessage

func (*SendReq) ProtoMessage()

func (*SendReq) ProtoReflect

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

func (*SendReq) Reset

func (x *SendReq) Reset()

func (*SendReq) String

func (x *SendReq) String() string

type SendResp

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

func (*SendResp) Descriptor deprecated

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

Deprecated: Use SendResp.ProtoReflect.Descriptor instead.

func (*SendResp) ProtoMessage

func (*SendResp) ProtoMessage()

func (*SendResp) ProtoReflect

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

func (*SendResp) Reset

func (x *SendResp) Reset()

func (*SendResp) String

func (x *SendResp) String() string

type Signal

type Signal struct {
	GenerationCounter uint32 `protobuf:"varint,1,opt,name=generation_counter,json=generationCounter,proto3" json:"generation_counter,omitempty"`
	// reserved for headers
	//
	// Types that are assignable to Data:
	//
	//	*Signal_Sdp
	//	*Signal_IceCandidate
	Data isSignal_Data `protobuf_oneof:"data"`
	// contains filtered or unexported fields
}

func (*Signal) Descriptor deprecated

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

Deprecated: Use Signal.ProtoReflect.Descriptor instead.

func (*Signal) GetData

func (m *Signal) GetData() isSignal_Data

func (*Signal) GetGenerationCounter

func (x *Signal) GetGenerationCounter() uint32

func (*Signal) GetIceCandidate

func (x *Signal) GetIceCandidate() *ICECandidate

func (*Signal) GetSdp

func (x *Signal) GetSdp() *Sdp

func (*Signal) ProtoMessage

func (*Signal) ProtoMessage()

func (*Signal) ProtoReflect

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

func (*Signal) Reset

func (x *Signal) Reset()

func (*Signal) String

func (x *Signal) String() string

type Signal_IceCandidate

type Signal_IceCandidate struct {
	IceCandidate *ICECandidate `protobuf:"bytes,10,opt,name=ice_candidate,json=iceCandidate,proto3,oneof"`
}

type Signal_Sdp

type Signal_Sdp struct {
	Sdp *Sdp `protobuf:"bytes,9,opt,name=sdp,proto3,oneof"`
}

type Tunnel

type Tunnel interface {
	Prepare(context.Context, *PrepareReq) (*PrepareResp, error)

	Send(context.Context, *SendReq) (*SendResp, error)

	Recv(context.Context, *RecvReq) (*RecvResp, error)
}

func NewTunnelJSONClient

func NewTunnelJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Tunnel

NewTunnelJSONClient creates a JSON client that implements the Tunnel interface. It communicates using JSON and can be configured with a custom HTTPClient.

func NewTunnelProtobufClient

func NewTunnelProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Tunnel

NewTunnelProtobufClient creates a Protobuf client that implements the Tunnel interface. It communicates using Protobuf and can be configured with a custom HTTPClient.

type TwirpServer

type TwirpServer interface {
	http.Handler

	// ServiceDescriptor returns gzipped bytes describing the .proto file that
	// this service was generated from. Once unzipped, the bytes can be
	// unmarshalled as a
	// google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto.
	//
	// The returned integer is the index of this particular service within that
	// FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a
	// low-level field, expected to be used for reflection.
	ServiceDescriptor() ([]byte, int)

	// ProtocGenTwirpVersion is the semantic version string of the version of
	// twirp used to generate this file.
	ProtocGenTwirpVersion() string

	// PathPrefix returns the HTTP URL path prefix for all methods handled by this
	// service. This can be used with an HTTP mux to route Twirp requests.
	// The path prefix is in the form: "/<prefix>/<package>.<Service>/"
	// that is, everything in a Twirp route except for the <Method> at the end.
	PathPrefix() string
}

TwirpServer is the interface generated server structs will support: they're HTTP handlers with additional methods for accessing metadata about the service. Those accessors are a low-level API for building reflection tools. Most people can think of TwirpServers as just http.Handlers.

func NewTunnelServer

func NewTunnelServer(svc Tunnel, opts ...interface{}) TwirpServer

NewTunnelServer builds a TwirpServer that can be used as an http.Handler to handle HTTP requests that are routed to the right method in the provided svc implementation. The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).

Jump to

Keyboard shortcuts

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