Documentation ¶
Index ¶
- Variables
- func GenerateSelfSignedCert() (*tls.Certificate, error)
- func MustGenerateSelfSignedCert() []tls.Certificate
- type SingleStream
- func (s *SingleStream) Close() error
- func (s *SingleStream) CloseRead() error
- func (s *SingleStream) CloseSync(ctx context.Context) error
- func (s *SingleStream) CloseWrite() error
- func (s *SingleStream) GetPath() *pan.Path
- func (s *SingleStream) LocalAddr() net.Addr
- func (s *SingleStream) Read(p []byte) (int, error)
- func (s *SingleStream) RemoteAddr() net.Addr
- func (s *SingleStream) SetDeadline(t time.Time) error
- func (s *SingleStream) SetReadDeadline(t time.Time) error
- func (s *SingleStream) SetWriteDeadline(t time.Time) error
- func (s *SingleStream) Write(p []byte) (int, error)
- type SingleStreamListener
Constants ¶
This section is empty.
Variables ¶
var ( // SingleStreamProto is a quic application layer protocol that transports // an opaque, bi-directional data stream using quic. This is intended as a // drop-in replacement for TCP. // // This is more fiddly than perhaps expected because quic-go does not _currently_ // have any API that allows to wait until the send buffer is drained and save // shutdown (of the UDP socket, or the application) is possible. // See https://github.com/lucas-clemente/quic-go/issues/3291. // TODO: simplify this once possible (as a protocol breaking change) // // The "protocol" is: // - each peer opens a unidirectional stream for sending data // - once the data was read in full (i.e. the FIN frame was received, EOF // condition on the stream), we explicitly signal this to the peer. // The signal is opening and directly closing a second unidirectional // stream. SingleStreamProto = "qs" )
Functions ¶
func GenerateSelfSignedCert ¶
func GenerateSelfSignedCert() (*tls.Certificate, error)
GenerateSelfSignedCert generates a private key and a self-signed dummy certificate usable for TLS with InsecureSkipVerify: true
func MustGenerateSelfSignedCert ¶
func MustGenerateSelfSignedCert() []tls.Certificate
MustGenerateSelfSignedCert generates private key and a self-signed dummy certificate usable for TLS with InsecureSkipVerify: true. Like GenerateSelfSignedCert but panics on error and returns a slice with a single entry, for convenience when initializing a tls.Config structure.
Types ¶
type SingleStream ¶
type SingleStream struct { Connection quic.Connection // contains filtered or unexported fields }
SingleStream implements an opaque, bi-directional data stream using QUIC, intending to be a drop-in replacement for TCP. A SingleStream is either created by
- on the client side: quic.Dial and then immediately NewSingleStream(sess) with the obtained connection
- on the listener side: quic.Listener wrapped in SingleStreamListener, which returns SingleStream from Accept.
func NewSingleStream ¶
func NewSingleStream(connection quic.Connection) (*SingleStream, error)
func (*SingleStream) Close ¶
func (s *SingleStream) Close() error
func (*SingleStream) CloseRead ¶
func (s *SingleStream) CloseRead() error
CloseRead aborts receiving on this stream. It will ask the peer to stop transmitting stream data. This is analogous e.g. to net.TCPConn.CloseRead.
func (*SingleStream) CloseWrite ¶
func (s *SingleStream) CloseWrite() error
CloseWrite closes the stream for writing. This is analogous e.g. to net.TCPConn.CloseWrite
func (*SingleStream) GetPath ¶ added in v0.6.0
func (s *SingleStream) GetPath() *pan.Path
func (*SingleStream) LocalAddr ¶
func (s *SingleStream) LocalAddr() net.Addr
func (*SingleStream) RemoteAddr ¶
func (s *SingleStream) RemoteAddr() net.Addr
func (*SingleStream) SetDeadline ¶
func (s *SingleStream) SetDeadline(t time.Time) error
func (*SingleStream) SetReadDeadline ¶
func (s *SingleStream) SetReadDeadline(t time.Time) error
func (*SingleStream) SetWriteDeadline ¶
func (s *SingleStream) SetWriteDeadline(t time.Time) error
type SingleStreamListener ¶
type SingleStreamListener struct {
*quic.Listener
}
SingleStreamListener is a wrapper for a quic.Listener, returning SingleStream connections from Accept. This allows to use quic in contexts where a (TCP-)net.Listener is expected.