[tor-commits] [flashproxy/master] Add remaining net.Conn methods.

dcf at torproject.org dcf at torproject.org
Wed Jan 30 05:11:38 UTC 2013


commit 59b3e68135dc876ba343a3eef16a02b814995bd2
Author: David Fifield <david at bamsoftware.com>
Date:   Mon Nov 26 01:27:49 2012 -0800

    Add remaining net.Conn methods.
---
 websocket-transport/websocket-server.go |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/websocket-transport/websocket-server.go b/websocket-transport/websocket-server.go
index c005d7e..8b62b60 100644
--- a/websocket-transport/websocket-server.go
+++ b/websocket-transport/websocket-server.go
@@ -8,6 +8,7 @@ import (
 	"net/http"
 	"os"
 	"os/signal"
+	"time"
 )
 
 const defaultPort = 9901
@@ -76,6 +77,36 @@ func (conn *websocketConn) Write(b []byte) (n int, err error) {
 	return
 }
 
+func (conn *websocketConn) Close() (err error) {
+	err = conn.Ws.WriteFrame(8, nil)
+	if err != nil {
+		conn.Ws.Conn.Close()
+		return
+	}
+	err = conn.Ws.Conn.Close()
+	return
+}
+
+func (conn *websocketConn) LocalAddr() net.Addr {
+	return conn.Ws.Conn.LocalAddr()
+}
+
+func (conn *websocketConn) RemoteAddr() net.Addr {
+	return conn.Ws.Conn.RemoteAddr()
+}
+
+func (conn *websocketConn) SetDeadline(t time.Time) error {
+	return conn.Ws.Conn.SetDeadline(t)
+}
+
+func (conn *websocketConn) SetReadDeadline(t time.Time) error {
+	return conn.Ws.Conn.SetReadDeadline(t)
+}
+
+func (conn *websocketConn) SetWriteDeadline(t time.Time) error {
+	return conn.Ws.Conn.SetWriteDeadline(t)
+}
+
 func NewWebsocketConn(ws *websocket) websocketConn {
 	var conn websocketConn
 	conn.Ws = ws





More information about the tor-commits mailing list