websocket.Conn.RemoteAddr()

John Arbash Meinel john at arbash-meinel.com
Mon Oct 28 11:27:27 UTC 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

In Roger's recent patch to add a 'notifier' to rpc debugging, he had
this line:

 notifier = requestNotifier{wsConn.RemoteAddr()}

Which would seem to indicate (to me) that we would be giving something
like the IP address of the client connecting to us.

However, I started writing: Sprintf("%s", remoteAddr) to the log file,
and I get: http://localhost/

Which seems *completely* worthless. I tried to read the docs about it:
 http://godoc.org/code.google.com/p/go.net/websocket#Conn.RemoteAddr

Which says it returns the "Websocket Origin for server", which I'm
guessing *should* be the Websocket origin as defined by the client
(because this should be logging on the server side).

So I guess this address is whatever the client feels like putting into
the connection request, which as we can see isn't very useful.

I tried using remoteAddr.Network() but that just gives 'websocket'
which seems even worse.

Looking into the code itself "Location" and "Origin" are just URLs.
Which would be fine if the client was putting its socket address into
the URL, but it would appear the client actually needs to make it up,
rather than the server producing a client IP + socket combination.

Anyone have a better address that we could put in for better logging?

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (Cygwin)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlJuSh8ACgkQJdeBCYSNAAPlNQCgoFBUXov1UlLoBCHXkwHOgQp9
gLMAn2tNrL27i+2F/egJJ5p1hcPJP8GV
=Qb5J
-----END PGP SIGNATURE-----



More information about the Juju-dev mailing list