Documentation
¶
Overview ¶
Package dquicwrap declares QUIC wrapper types to ensure the quic.Connection values exposed to the application are able to interoperate with the low level streams managed internally by the dragon stack.
Index ¶
- type Conn
- func (c *Conn) AcceptStream(ctx context.Context) (dquic.Stream, error)
- func (c *Conn) AcceptUniStream(ctx context.Context) (dquic.ReceiveStream, error)
- func (c *Conn) CloseWithError(code dquic.ApplicationErrorCode, msg string) error
- func (c *Conn) Context() context.Context
- func (c *Conn) LocalAddr() net.Addr
- func (c *Conn) OpenStreamSync(ctx context.Context) (dquic.Stream, error)
- func (c *Conn) OpenUniStreamSync(ctx context.Context) (dquic.SendStream, error)
- func (c *Conn) ReceiveDatagram(ctx context.Context) ([]byte, error)
- func (c *Conn) RemoteAddr() net.Addr
- func (c *Conn) SendDatagram(p []byte) error
- func (c *Conn) TLSConnectionState() tls.ConnectionState
- func (c *Conn) WrapsConnection(conn dquic.Conn) bool
- type Stream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn wraps a dquic.Conn, for the dpeerset package.
Normally one might embed the wrapped interface value, but in this case we want to be extremely precise about the behavior of every method.
func NewConn ¶
NewConn returns a Conn wrapping the given plain dquic.Conn.
The incomingStreams channel determines the streams that reach AcceptStream. There should be another goroutine that accepts the raw streams, and then parses the first byte in order to determine whether the stream should be routed to the "application layer" (here) or remain in the protocol layer. (In practice, the [*dpeerset.peerInboundProcessor] does this work.)
func (*Conn) AcceptStream ¶
AcceptStream implements dquic.Conn.
func (*Conn) AcceptUniStream ¶
AcceptUniStream implements dquic.Conn.
func (*Conn) CloseWithError ¶
func (c *Conn) CloseWithError( code dquic.ApplicationErrorCode, msg string, ) error
CloseWithError implements dquic.Conn.
func (*Conn) OpenStreamSync ¶
OpenStreamSync implements dquic.Conn.
func (*Conn) OpenUniStreamSync ¶
OpenUniStreamSync implements dquic.Conn.
func (*Conn) ReceiveDatagram ¶
ReceiveDatagram implements dquic.Conn.
func (*Conn) SendDatagram ¶
SendDatagram implements dquic.Conn.
func (*Conn) TLSConnectionState ¶
func (c *Conn) TLSConnectionState() tls.ConnectionState
TLSConnectionState implements dquic.Conn.
type Stream ¶
type Stream struct {
// Just embed the receive stream,
// because we don't do any intercepting on receive streams.
dquic.ReceiveStream
// contains filtered or unexported fields
}
Stream wraps a real quic.Stream.
Normally one might embed the wrapped interface value, but in this case we want to be extremely precise about the behavior of every method.
func NewInboundStream ¶
NewInboundStream returns a wrapped stream that prepends the first read with the given alreadyConsumedProtocolID byte.
This is used when dragon internals intercept an incoming stream and then inspect the first byte, to decide whether the stream should be routed to the application layer or remain in the p2p protocol layer.
func NewOutboundStream ¶
NewOutboundStream returns a wrapped stream that requires that the first outbound byte is >= dconn.MinAppProtocolID.
func (*Stream) CancelWrite ¶
func (s *Stream) CancelWrite(code dquic.StreamErrorCode)
CancelWrite implements quic.SendStream.
func (*Stream) Read ¶
TODO: we need to extract a ReceiveStream and move this declaration to that type.
func (*Stream) SetWriteDeadline ¶
SetWriteDeadline implements quic.SendStream.