-
Notifications
You must be signed in to change notification settings - Fork 0
/
plus.go
55 lines (42 loc) · 985 Bytes
/
plus.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
53
54
55
package quic
import "net"
import "github.com/mami-project/plus-lib"
import "github.com/lucas-clemente/quic-go/internal/wire"
var UsePLUS bool = true
type plusconn struct {
p *PLUS.Connection
m *PLUS.ConnectionManager
s *session
}
func (c *plusconn) SetSession(s *session) {
c.s = s
c.p.SetFeedbackChannel(c)
}
func (c *plusconn) SendFeedback(fb []byte) error {
c.s.queuePLUSFeedback(fb)
return nil
}
func (c *plusconn) Write(p []byte) error {
_, err := c.p.Write(p)
return err
}
func (c *plusconn) Read(p []byte) (int, net.Addr, error) {
return c.p.ReadAndAddr(p)
}
func (c *plusconn) SetCurrentRemoteAddr(addr net.Addr) {
c.p.SetRemoteAddr(addr)
}
func (c *plusconn) LocalAddr() net.Addr {
return c.p.LocalAddr()
}
func (c *plusconn) RemoteAddr() net.Addr {
return c.p.RemoteAddr()
}
func (c *plusconn) Close() error {
return c.p.Close()
}
func (s *session) queuePLUSFeedback(data []byte) {
s.queueControlFrame(&wire.PLUSFeedbackFrame{
Data: data,
})
}