Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/interop/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ func generateTLSConfigWithCertAndKey(certFile, keyFile string, keyLog io.Writer)
}, nil
}

// Setup a bare-bones TLS config for the server
// generateTLSConfigWithNewCert sets up a bare-bones TLS config for the
// server, using a freshly generated self-signed certificate.
func generateTLSConfigWithNewCert(keyLog io.Writer) (*tls.Config, error) {
key, err := rsa.GenerateKey(rand.Reader, 1024)
if err != nil {
Expand Down
32 changes: 16 additions & 16 deletions quic_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,51 +6,51 @@ import (
"github.com/quic-go/quic-go"
)

type QuicGoReceiveStream struct {
type QUICGoReceiveStream struct {
stream *quic.ReceiveStream
}

func NewQuicGoReceiveStream(stream *quic.ReceiveStream) *QuicGoReceiveStream {
return &QuicGoReceiveStream{
func NewQUICGoReceiveStream(stream *quic.ReceiveStream) *QUICGoReceiveStream {
return &QUICGoReceiveStream{
stream: stream,
}
}

func (s *QuicGoReceiveStream) ID() int64 {
func (s *QUICGoReceiveStream) ID() int64 {
return int64(s.stream.StreamID())
}

func (s *QuicGoReceiveStream) CancelRead(c uint64) {
func (s *QUICGoReceiveStream) CancelRead(c uint64) {
s.stream.CancelRead(quic.StreamErrorCode(c))
}

func (c *QuicGoReceiveStream) Read(p []byte) (n int, err error) {
return c.stream.Read(p)
func (s *QUICGoReceiveStream) Read(p []byte) (n int, err error) {
return s.stream.Read(p)
}

type QuicGoSendStream struct {
type QUICGoSendStream struct {
stream *quic.SendStream
}

func NewQuicstream(stream *quic.SendStream) *QuicGoSendStream {
return &QuicGoSendStream{
func NewQUICGoSendStream(stream *quic.SendStream) *QUICGoSendStream {
return &QUICGoSendStream{
stream: stream,
}
}

func (s *QuicGoSendStream) ID() int64 {
func (s *QUICGoSendStream) ID() int64 {
return int64(s.stream.StreamID())
}

func (s *QuicGoSendStream) Write(b []byte) (int, error) {
func (s *QUICGoSendStream) Write(b []byte) (int, error) {
return s.stream.Write(b)
}

func (s *QuicGoSendStream) Close() error {
func (s *QUICGoSendStream) Close() error {
return s.stream.Close()
}

func (s *QuicGoSendStream) CancelWrite(c uint64) {
func (s *QUICGoSendStream) CancelWrite(c uint64) {
s.stream.CancelWrite(quic.StreamErrorCode(c))
}

Expand All @@ -77,7 +77,7 @@ func (c *QUICGoConnection) OpenUniStreamSync(ctx context.Context) (SendStream, e
if err != nil {
return nil, err
}
return &QuicGoSendStream{
return &QUICGoSendStream{
stream: s,
}, nil
}
Expand All @@ -87,7 +87,7 @@ func (c *QUICGoConnection) AcceptUniStream(ctx context.Context) (ReceiveStream,
if err != nil {
return nil, err
}
return &QuicGoReceiveStream{
return &QUICGoReceiveStream{
stream: s,
}, nil
}
Expand Down
2 changes: 1 addition & 1 deletion send_flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func newFlow(conn Connection, id uint64, onClose func(), qlog *qlog.Logger) *Sen
}
}

// WriteRTP sends an RTP or RTCP packet as a QUIC Datagram.
// WriteRTPBytes sends an RTP or RTCP packet as a QUIC Datagram.
func (f *SendFlow) WriteRTPBytes(packet []byte) error {
if err := f.isClosed(); err != nil {
return err
Expand Down
20 changes: 11 additions & 9 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ func NewSession(conn Connection, acceptDatagrams bool, qlogger *qlog.Logger) (*S
return s, nil
}

// NewSessionWithAppHandeledConn creates a new roq session. QUIC connection is handled by application.
// HandleDatagram and HandleUniStreamWithFlowID have to be called for each datagram / new stream.
func NewSessionWithAppHandeledConn(conn Connection, acceptDatagrams bool, qlogger *qlog.Logger) (*Session, error) {
// NewSessionWithAppHandledConn creates a new roq session. QUIC connection is
// handled by the application. HandleDatagram and HandleUniStreamWithFlowID have
// to be called for each datagram / new stream.
func NewSessionWithAppHandledConn(conn Connection, acceptDatagrams bool, qlogger *qlog.Logger) (*Session, error) {
s := newSession(conn, acceptDatagrams, qlogger)

return s, nil
Expand Down Expand Up @@ -210,9 +211,9 @@ func (s *Session) receiveDatagrams() error {
}
}

// HandleUniStreamWithFlowID handles a datagram.
// If QUIC connection is handled by the application, this function has to be called by the application
// for each datagram that belongs to belongs to the roq connnection.
// HandleDatagram handles a datagram. If QUIC connection is handled by the
// application, this function has to be called by the application for each
// datagram that belongs to the roq connection.
func (s *Session) HandleDatagram(datagram []byte) {
flowID, n, err := quicvarint.Parse(datagram)
if err != nil {
Expand Down Expand Up @@ -249,9 +250,10 @@ func (s *Session) HandleDatagram(datagram []byte) {
f.push(b)
}

// HandleUniStreamWithFlowID handles a new flow with the flowID allready parsed.
// If QUIC connection is handled by the application, this function has to be called by the application
// for each new QUIC stream containing a roq floqID.
// HandleUniStreamWithFlowID handles a new stream with the flow ID already
// parsed. If QUIC connection is handled by the application, this function has to
// be called by the application for each new QUIC stream containing a roq flow
// ID.
func (s *Session) HandleUniStreamWithFlowID(flowID uint64, rs ReceiveStream) {
if s.qlog != nil {
s.qlog.Log(roqqlog.StreamOpenedEvent{
Expand Down