commit 10139fe73d7a6186554708d153e8f9b2127ae457 Author: David Fifield david@bamsoftware.com Date: Thu Dec 12 22:36:40 2013 -0800
Log → log in websocket-client. --- websocket-client/websocket-client.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/websocket-client/websocket-client.go b/websocket-client/websocket-client.go index 09181db..d1d6dcc 100644 --- a/websocket-client/websocket-client.go +++ b/websocket-client/websocket-client.go @@ -45,7 +45,7 @@ func usage() { fmt.Printf(" --socks ADDR listen for SOCKS on ADDR.\n") }
-func Log(format string, v ...interface{}) { +func log(format string, v ...interface{}) { dateStr := time.Now().Format("2006-01-02 15:04:05") logMutex.Lock() defer logMutex.Unlock() @@ -77,7 +77,7 @@ func proxy(local *net.TCPConn, ws *websocket.Conn) { } } if err != nil && err != io.EOF { - Log("%s", err) + log("%s", err) } local.CloseRead() ws.Close() @@ -106,7 +106,7 @@ func proxy(local *net.TCPConn, ws *websocket.Conn) { } } if err != nil && err != io.EOF { - Log("%s", err) + log("%s", err) } local.CloseWrite() ws.Close() @@ -127,7 +127,7 @@ func handleConnection(conn *pt.SocksConn) error {
var ws *websocket.Conn
- Log("SOCKS request for %s", conn.Req.Target) + log("SOCKS request for %s", conn.Req.Target) destAddr, err := net.ResolveTCPAddr("tcp", conn.Req.Target) if err != nil { conn.Reject() @@ -139,7 +139,7 @@ func handleConnection(conn *pt.SocksConn) error { err = conn.Reject() return err } - Log("WebSocket connection to %s", ws.Config().Location.String()) + log("WebSocket connection to %s", ws.Config().Location.String()) defer ws.Close() err = conn.Grant(destAddr) if err != nil { @@ -160,7 +160,7 @@ func socksAcceptLoop(ln *pt.SocksListener) error { go func() { err := handleConnection(socks) if err != nil { - Log("SOCKS from %s: %s", socks.RemoteAddr(), err) + log("SOCKS from %s: %s", socks.RemoteAddr(), err) } }() } @@ -175,7 +175,7 @@ func startListener(addrStr string) (*pt.SocksListener, error) { go func() { err := socksAcceptLoop(ln) if err != nil { - Log("accept: %s", err) + log("accept: %s", err) } }() return ln, nil @@ -205,10 +205,10 @@ func main() { socksAddrStrs = []string{socksArg} }
- Log("starting") + log("starting") ptInfo, err = pt.ClientSetup([]string{ptMethodName}) if err != nil { - Log("error in setup: %s", err) + log("error in setup: %s", err) os.Exit(1) }
@@ -220,7 +220,7 @@ func main() { continue } pt.Cmethod(ptMethodName, ln.Version(), ln.Addr()) - Log("listening on %s", ln.Addr().String()) + log("listening on %s", ln.Addr().String()) listeners = append(listeners, ln) } pt.CmethodsDone()
tor-commits@lists.torproject.org