moqtransport

package module
v0.1.1-6 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: MIT Imports: 11 Imported by: 0

README

Media over QUIC Transport

Go Reference

moqtransport is an implementation of Media over QUIC Transport on top of quic-go and optionally webtransport-go.

Example: Chat Server and Client

The examples directory contains an implementation of MoQ Chat.

To run a simple chat server using MoQ Tranpsort on top of QUIC, run:

go run examples/server/main.go

Then, open a new shell and start a client:

go run examples/client/main.go

The client is a simple interactive shell that reads and writes messages from stdin and stdout (input and output is currently not well synchronized).

Open another shell and run a second client to chat with the first one using the commands join <roomID> <username> to join a room and msg <roomID> <message> to send messages to a room.

To use WebTransport, we need to create a TLS certificate. This can be done using mkcert:

mkcert localhost
mkcert -install

mkcert will generate a localhost.pem and a localhost-key.pem file. If you change the name of the files or use a different host name, you can use the -cert and -key flags of the server command to point it to the correct files.

We can now start the server and client with the -webtransport flag to run MoQ Transport on top of WebTransport.

Documentation

Index

Constants

View Source
const (
	SessionTerminatedErrorCode = 0x00
	GenericErrorCode           = 0x01
	UnauthorizedErrorCode      = 0x02
	GoAwayErrorCode            = 0x10
)
View Source
const DRAFT_IETF_MOQ_TRANSPORT_00 = 0

Variables

This section is empty.

Functions

This section is empty.

Types

type AnnouncementHandler

type AnnouncementHandler func(string) error

type Peer

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

func DialQUIC

func DialQUIC(ctx context.Context, addr string) (*Peer, error)

func (*Peer) Announce

func (p *Peer) Announce(namespace string) error

func (*Peer) GetConnection

func (p *Peer) GetConnection() connection

func (*Peer) OnAnnouncement

func (p *Peer) OnAnnouncement(callback AnnouncementHandler)

func (*Peer) OnSubscription

func (p *Peer) OnSubscription(callback SubscriptionHandler)

func (*Peer) Subscribe

func (p *Peer) Subscribe(trackname string) (*ReceiveTrack, error)

type PeerHandler

type PeerHandler interface {
	Handle(*Peer)
}

type PeerHandlerFunc

type PeerHandlerFunc func(*Peer)

func (PeerHandlerFunc) Handle

func (h PeerHandlerFunc) Handle(p *Peer)

type ReceiveTrack

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

func (*ReceiveTrack) Read

func (t *ReceiveTrack) Read(p []byte) (n int, err error)

type SendTrack

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

func (*SendTrack) Write

func (t *SendTrack) Write(b []byte) (n int, err error)

type Server

type Server struct {
	Handler   PeerHandler
	TLSConfig *tls.Config
}

func (*Server) Listen

func (s *Server) Listen(ctx context.Context, l listener) error

func (*Server) ListenQUIC

func (s *Server) ListenQUIC(ctx context.Context, addr string) error

type SubscriptionHandler

type SubscriptionHandler func(string, *SendTrack) (uint64, time.Duration, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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