forked from bluenviron/gortsplib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver_tunnel_http.go
More file actions
58 lines (46 loc) · 1.03 KB
/
server_tunnel_http.go
File metadata and controls
58 lines (46 loc) · 1.03 KB
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
56
57
58
package gortsplib
import (
"bufio"
"io"
"net"
"time"
"github.com/bluenviron/gortsplib/v5/internal/base64streamreader"
)
type serverHTTPTunnel struct {
r net.Conn
rb io.Reader
w net.Conn
}
func (m *serverHTTPTunnel) Read(p []byte) (int, error) {
return m.rb.Read(p)
}
func (m *serverHTTPTunnel) Write(p []byte) (int, error) {
return m.w.Write(p)
}
func (m *serverHTTPTunnel) Close() error {
m.r.Close()
m.w.Close()
return nil
}
func (m *serverHTTPTunnel) LocalAddr() net.Addr {
return m.r.LocalAddr()
}
func (m *serverHTTPTunnel) RemoteAddr() net.Addr {
return m.r.RemoteAddr()
}
func (m *serverHTTPTunnel) SetDeadline(_ time.Time) error {
panic("unimplemented")
}
func (m *serverHTTPTunnel) SetReadDeadline(t time.Time) error {
return m.r.SetReadDeadline(t)
}
func (m *serverHTTPTunnel) SetWriteDeadline(t time.Time) error {
return m.w.SetWriteDeadline(t)
}
func newServerHTTPTunnel(r net.Conn, rb *bufio.Reader, w net.Conn) net.Conn {
return &serverHTTPTunnel{
r: r,
rb: base64streamreader.New(rb),
w: w,
}
}