Documentation ¶
Index ¶
- Variables
- func AttachRPCToStream(rpc RPC, s io.ReadWriteCloser, stateCb func(state StreamState)) error
- type Data
- func (m *Data) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *Data) CloneVT() *Data
- func (this *Data) EqualMessageVT(thatMsg any) bool
- func (this *Data) EqualVT(that *Data) bool
- func (x *Data) GetData() []byte
- func (x *Data) GetState() StreamState
- func (x *Data) MarshalJSON() ([]byte, error)
- func (x *Data) MarshalProtoJSON(s *json.MarshalState)
- func (x *Data) MarshalProtoText() string
- func (m *Data) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *Data) MarshalToVT(dAtA []byte) (int, error)
- func (m *Data) MarshalVT() (dAtA []byte, err error)
- func (*Data) ProtoMessage()
- func (x *Data) Reset()
- func (m *Data) SizeVT() (n int)
- func (x *Data) String() string
- func (x *Data) UnmarshalJSON(b []byte) error
- func (x *Data) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *Data) UnmarshalVT(dAtA []byte) error
- type NetConn
- func (n *NetConn) Close() error
- func (n *NetConn) LocalAddr() net.Addr
- func (n *NetConn) Read(b []byte) (int, error)
- func (n *NetConn) RemoteAddr() net.Addr
- func (n *NetConn) SetDeadline(t time.Time) error
- func (n *NetConn) SetReadDeadline(t time.Time) error
- func (n *NetConn) SetWriteDeadline(t time.Time) error
- func (n *NetConn) Write(b []byte) (nw int, err error)
- type RPC
- type StreamState
- func (x StreamState) Enum() *StreamState
- func (x StreamState) MarshalJSON() ([]byte, error)
- func (x StreamState) MarshalProtoJSON(s *json.MarshalState)
- func (x StreamState) MarshalProtoText() string
- func (x StreamState) MarshalText() ([]byte, error)
- func (x StreamState) String() string
- func (x *StreamState) UnmarshalJSON(b []byte) error
- func (x *StreamState) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (x *StreamState) UnmarshalText(b []byte) error
Constants ¶
This section is empty.
Variables ¶
var ( StreamState_name = map[int32]string{ 0: "StreamState_NONE", 1: "StreamState_ESTABLISHING", 2: "StreamState_ESTABLISHED", } StreamState_value = map[string]int32{ "StreamState_NONE": 0, "StreamState_ESTABLISHING": 1, "StreamState_ESTABLISHED": 2, } )
Enum value maps for StreamState.
Functions ¶
func AttachRPCToStream ¶
func AttachRPCToStream( rpc RPC, s io.ReadWriteCloser, stateCb func(state StreamState), ) error
AttachRPCToStream attaches a RPC to a stream.
Types ¶
type Data ¶
type Data struct { // State indicates stream state in-band. // Data is packet data from the remote. Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` // State indicates the stream state. State StreamState `protobuf:"varint,2,opt,name=state,proto3" json:"state,omitempty"` // contains filtered or unexported fields }
Data is a data packet.
func (*Data) CloneMessageVT ¶ added in v0.15.6
func (m *Data) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*Data) EqualMessageVT ¶ added in v0.15.6
func (*Data) GetState ¶
func (x *Data) GetState() StreamState
func (*Data) MarshalJSON ¶ added in v0.29.0
MarshalJSON marshals the Data to JSON.
func (*Data) MarshalProtoJSON ¶ added in v0.29.0
func (x *Data) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the Data message to JSON.
func (*Data) MarshalProtoText ¶ added in v0.29.2
func (*Data) MarshalToSizedBufferVT ¶ added in v0.2.0
func (*Data) ProtoMessage ¶
func (*Data) ProtoMessage()
func (*Data) UnmarshalJSON ¶ added in v0.29.0
UnmarshalJSON unmarshals the Data from JSON.
func (*Data) UnmarshalProtoJSON ¶ added in v0.29.0
func (x *Data) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the Data message from JSON.
func (*Data) UnmarshalVT ¶ added in v0.2.0
type NetConn ¶
type NetConn struct {
// contains filtered or unexported fields
}
NetConn wraps an RPC into a net.Conn compat interface.
func NewNetConn ¶
NewNetConn constructs a new NetConn.
func (*NetConn) Close ¶
Close closes the connection. Any blocked Read or Write operations will be unblocked and return errors.
func (*NetConn) Read ¶
Read reads data from the connection. Read can be made to time out and return an Error with Timeout() == true after a fixed time limit; see SetDeadline and SetReadDeadline.
func (*NetConn) RemoteAddr ¶
RemoteAddr returns the remote network address.
func (*NetConn) SetDeadline ¶
SetDeadline sets the read and write deadlines associated with the connection. It is equivalent to calling both SetReadDeadline and SetWriteDeadline.
A zero value for t means I/O operations will not time out. Deadlines are stubbed here.
func (*NetConn) SetReadDeadline ¶
SetReadDeadline sets the deadline for future Read calls and any currently-blocked Read call. A zero value for t means Read will not time out.
func (*NetConn) SetWriteDeadline ¶
SetWriteDeadline sets the deadline for future Write calls and any currently-blocked Write call. Even if write times out, it may return n > 0, indicating that some of the data was successfully written. A zero value for t means Write will not time out.
type RPC ¶
type RPC interface { // Context returns the context. Context() context.Context // Send sends a packet. Send(*Data) error // Recv receives a packet. Recv() (*Data, error) }
RPC matches the request/response interface.
type StreamState ¶
type StreamState int32
StreamState is state for the stream related calls.
const ( // StreamState_NONE indicates nothing about the state StreamState_StreamState_NONE StreamState = 0 // StreamState_ESTABLISHING indicates the stream is connecting. StreamState_StreamState_ESTABLISHING StreamState = 1 // StreamState_ESTABLISHED indicates the stream is established. StreamState_StreamState_ESTABLISHED StreamState = 2 )
func (StreamState) Enum ¶ added in v0.2.0
func (x StreamState) Enum() *StreamState
func (StreamState) MarshalJSON ¶ added in v0.29.0
func (x StreamState) MarshalJSON() ([]byte, error)
MarshalJSON marshals the StreamState to JSON.
func (StreamState) MarshalProtoJSON ¶ added in v0.29.0
func (x StreamState) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the StreamState to JSON.
func (StreamState) MarshalProtoText ¶ added in v0.29.2
func (x StreamState) MarshalProtoText() string
func (StreamState) MarshalText ¶ added in v0.29.0
func (x StreamState) MarshalText() ([]byte, error)
MarshalText marshals the StreamState to text.
func (StreamState) String ¶
func (x StreamState) String() string
func (*StreamState) UnmarshalJSON ¶ added in v0.29.0
func (x *StreamState) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the StreamState from JSON.
func (*StreamState) UnmarshalProtoJSON ¶ added in v0.29.0
func (x *StreamState) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the StreamState from JSON.
func (*StreamState) UnmarshalText ¶ added in v0.29.0
func (x *StreamState) UnmarshalText(b []byte) error
UnmarshalText unmarshals the StreamState from text.