-
Notifications
You must be signed in to change notification settings - Fork 7
/
connection.go
52 lines (39 loc) · 1.33 KB
/
connection.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package quicmoq
import (
"context"
"github.com/mengelbart/moqtransport"
"github.com/quic-go/quic-go"
)
type connection struct {
connection quic.Connection
}
func New(conn quic.Connection) moqtransport.Connection {
return &connection{conn}
}
func (c *connection) OpenStream() (moqtransport.Stream, error) {
return c.connection.OpenStream()
}
func (c *connection) OpenStreamSync(ctx context.Context) (moqtransport.Stream, error) {
return c.connection.OpenStreamSync(ctx)
}
func (c *connection) OpenUniStream() (moqtransport.SendStream, error) {
return c.connection.OpenUniStream()
}
func (c *connection) OpenUniStreamSync(ctx context.Context) (moqtransport.SendStream, error) {
return c.connection.OpenUniStreamSync(ctx)
}
func (c *connection) AcceptStream(ctx context.Context) (moqtransport.Stream, error) {
return c.connection.AcceptStream(ctx)
}
func (c *connection) AcceptUniStream(ctx context.Context) (moqtransport.ReceiveStream, error) {
return c.connection.AcceptUniStream(ctx)
}
func (c *connection) SendDatagram(b []byte) error {
return c.connection.SendDatagram(b)
}
func (c *connection) ReceiveDatagram(ctx context.Context) ([]byte, error) {
return c.connection.ReceiveDatagram(ctx)
}
func (c *connection) CloseWithError(e uint64, msg string) error {
return c.connection.CloseWithError(quic.ApplicationErrorCode(e), msg)
}