commit 20ac2029fd671ccfa8af240fe9c91d9653715ebc
Author: David Fifield <david(a)bamsoftware.com>
Date: Tue Jan 28 02:37:10 2020 -0700
Have websocketconn.New return a pointer.
This makes the return type satisfy the io.ReadWriteCloser interface
directly.
---
common/websocketconn/websocketconn.go | 4 ++--
proxy-go/snowflake.go | 2 +-
server/server.go | 2 +-
server/server_test.go | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/common/websocketconn/websocketconn.go b/common/websocketconn/websocketconn.go
index 8a9e015..b87e657 100644
--- a/common/websocketconn/websocketconn.go
+++ b/common/websocketconn/websocketconn.go
@@ -63,8 +63,8 @@ func (conn *Conn) Close() error {
}
// Create a new Conn.
-func New(ws *websocket.Conn) Conn {
+func New(ws *websocket.Conn) *Conn {
var conn Conn
conn.Ws = ws
- return conn
+ return &conn
}
diff --git a/proxy-go/snowflake.go b/proxy-go/snowflake.go
index 675d76a..e964a07 100644
--- a/proxy-go/snowflake.go
+++ b/proxy-go/snowflake.go
@@ -288,7 +288,7 @@ func datachannelHandler(conn *webRTCConn, remoteAddr net.Addr) {
wsConn := websocketconn.New(ws)
log.Printf("connected to relay")
defer wsConn.Close()
- CopyLoop(conn, &wsConn)
+ CopyLoop(conn, wsConn)
log.Printf("datachannelHandler ends")
}
diff --git a/server/server.go b/server/server.go
index 739a55a..5d3bfc6 100644
--- a/server/server.go
+++ b/server/server.go
@@ -125,7 +125,7 @@ func (handler *HTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
defer or.Close()
- proxy(or, &conn)
+ proxy(or, conn)
}
func initServer(addr *net.TCPAddr,
diff --git a/server/server_test.go b/server/server_test.go
index bbc9ba9..d4ada6e 100644
--- a/server/server_test.go
+++ b/server/server_test.go
@@ -66,7 +66,7 @@ func (handler *StubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
//dial stub OR
or, _ := net.DialTCP("tcp", nil, &net.TCPAddr{IP: net.ParseIP("localhost"), Port: 8889})
- proxy(or, &conn)
+ proxy(or, conn)
}
func Test(t *testing.T) {