mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Have websocketconn.New return a pointer.
This makes the return type satisfy the io.ReadWriteCloser interface directly.
This commit is contained in:
parent
e47dd5e2b4
commit
20ac2029fd
4 changed files with 5 additions and 5 deletions
|
@ -63,8 +63,8 @@ func (conn *Conn) Close() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a new Conn.
|
// Create a new Conn.
|
||||||
func New(ws *websocket.Conn) Conn {
|
func New(ws *websocket.Conn) *Conn {
|
||||||
var conn Conn
|
var conn Conn
|
||||||
conn.Ws = ws
|
conn.Ws = ws
|
||||||
return conn
|
return &conn
|
||||||
}
|
}
|
||||||
|
|
|
@ -288,7 +288,7 @@ func datachannelHandler(conn *webRTCConn, remoteAddr net.Addr) {
|
||||||
wsConn := websocketconn.New(ws)
|
wsConn := websocketconn.New(ws)
|
||||||
log.Printf("connected to relay")
|
log.Printf("connected to relay")
|
||||||
defer wsConn.Close()
|
defer wsConn.Close()
|
||||||
CopyLoop(conn, &wsConn)
|
CopyLoop(conn, wsConn)
|
||||||
log.Printf("datachannelHandler ends")
|
log.Printf("datachannelHandler ends")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,7 @@ func (handler *HTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
defer or.Close()
|
defer or.Close()
|
||||||
|
|
||||||
proxy(or, &conn)
|
proxy(or, conn)
|
||||||
}
|
}
|
||||||
|
|
||||||
func initServer(addr *net.TCPAddr,
|
func initServer(addr *net.TCPAddr,
|
||||||
|
|
|
@ -66,7 +66,7 @@ func (handler *StubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
//dial stub OR
|
//dial stub OR
|
||||||
or, _ := net.DialTCP("tcp", nil, &net.TCPAddr{IP: net.ParseIP("localhost"), Port: 8889})
|
or, _ := net.DialTCP("tcp", nil, &net.TCPAddr{IP: net.ParseIP("localhost"), Port: 8889})
|
||||||
|
|
||||||
proxy(or, &conn)
|
proxy(or, conn)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test(t *testing.T) {
|
func Test(t *testing.T) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue