wrapper

package
v0.1.5-0...-654cee6 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package wrapper is a wrapper around lucas-clemente/quic-go to match the net.Conn based interface used troughout pion/webrtc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Certificate *x509.Certificate
	PrivateKey  crypto.PrivateKey
	SkipVerify  bool
}

Config represents the configuration of a Quic session

type Listener

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

A Listener for incoming QUIC connections

func Listen

func Listen(addr string, config *Config) (*Listener, error)

Listen listens on the address over quic

func Server

func Server(conn net.Conn, config *Config) (*Listener, error)

Server creates a listener for listens for incoming QUIC sessions

func (*Listener) Accept

func (l *Listener) Accept() (*Session, error)

Accept accepts incoming streams

func (*Listener) Close

func (l *Listener) Close() error

Close closes the listener

type Session

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

A Session is a QUIC connection between two peers.

func Client

func Client(conn net.Conn, config *Config) (*Session, error)

Client establishes a QUIC session over an existing conn

func Dial

func Dial(addr string, config *Config) (*Session, error)

Dial dials the address over quic

func (*Session) AcceptStream

func (s *Session) AcceptStream() (*Stream, error)

AcceptStream accepts an incoming stream

func (*Session) Close

func (s *Session) Close() error

Close the connection

func (*Session) CloseWithError

func (s *Session) CloseWithError(code uint16, err error) error

CloseWithError closes the connection with an error. The error must not be nil.

func (*Session) GetRemoteCertificates

func (s *Session) GetRemoteCertificates() []*x509.Certificate

GetRemoteCertificates returns the certificate chain presented by remote peer.

func (*Session) OpenStream

func (s *Session) OpenStream() (*Stream, error)

OpenStream opens a new stream

type Stream

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

Stream represents a wrapped quic-go stream

func (*Stream) Close

func (s *Stream) Close() error

Close implements the Conn Close method. It is used to close the connection. Any calls to Read and Write will be unblocked and return an error.

func (*Stream) Detach

func (s *Stream) Detach() quic.Stream

Detach returns the underlying quic-go Stream

func (*Stream) Read

func (s *Stream) Read(p []byte) (int, error)

Read implements the Conn Read method.

func (*Stream) ReadQuic

func (s *Stream) ReadQuic(p []byte) (int, bool, error)

ReadQuic reads a frame and determines if it is the final frame

func (*Stream) StreamID

func (s *Stream) StreamID() uint64

StreamID returns the ID of the QuicStream

func (*Stream) Write

func (s *Stream) Write(p []byte, fin bool) (int, error)

Write implements the Conn Write method.

func (*Stream) WriteQuic

func (s *Stream) WriteQuic(p []byte, fin bool) (int, error)

WriteQuic writes a frame and closes the stream if fin is true

Jump to

Keyboard shortcuts

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