diff options
author | Robert Daniel Kortschak <dan.kortschak@adelaide.edu.au> | 2014-07-09 12:14:27 +1000 |
---|---|---|
committer | Andrew Gerrand <adg@golang.org> | 2014-07-09 12:14:27 +1000 |
commit | 063db5971cb2f5fed479d7c6616c8d7a11d0c1d5 (patch) | |
tree | 177cab8d4b3262073cd31ac7909825ab50f119ac /playground | |
parent | 32c9809768a42725e9f2d2743dbe67b68a695534 (diff) | |
download | golang-x-tools-063db5971cb2f5fed479d7c6616c8d7a11d0c1d5.tar.gz |
go.tools/playground/socket: log connections and code snippet run requests
This logs all successful handshakes and all requests to run code snippets;
it is not immediately obvious how to limit this to non-localhost hosts, or
to instances where publicly available playgrounds are allowed without resorting
to addition of a new global. The level of noise on the log should not be too
great.
LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/112850043
Diffstat (limited to 'playground')
-rw-r--r-- | playground/socket/socket.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/playground/socket/socket.go b/playground/socket/socket.go index 89dc53278..ae4b481c0 100644 --- a/playground/socket/socket.go +++ b/playground/socket/socket.go @@ -95,6 +95,7 @@ func handshake(c *websocket.Config, req *http.Request) error { log.Println("bad websocket origin:", o) return websocket.ErrBadWebSocketOrigin } + log.Println("accepting connection from:", req.RemoteAddr) return nil } @@ -136,6 +137,7 @@ func socketHandler(c *websocket.Conn) { case m := <-in: switch m.Kind { case "run": + log.Println("running snippet from:", c.Request().RemoteAddr) proc[m.Id].Kill() lOut := limiter(in, out) proc[m.Id] = startProcess(m.Id, m.Body, lOut, m.Options) |