commit ed01efcdf1e96664c998d2e91ff2d3ce78f0a447 Author: David Fifield david@bamsoftware.com Date: Sat Dec 7 21:45:19 2013 -0800
Add SocksListener.Version to return the "socks4" string. --- examples/dummy-client/dummy-client.go | 2 +- pt.go | 2 +- socks.go | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/examples/dummy-client/dummy-client.go b/examples/dummy-client/dummy-client.go index 9497f99..f619e7c 100644 --- a/examples/dummy-client/dummy-client.go +++ b/examples/dummy-client/dummy-client.go @@ -93,7 +93,7 @@ func main() { continue } go acceptLoop(ln) - pt.Cmethod(methodName, "socks4", ln.Addr()) + pt.Cmethod(methodName, ln.Version(), ln.Addr()) listeners = append(listeners, ln) } pt.CmethodsDone() diff --git a/pt.go b/pt.go index 345a7bd..45dc795 100644 --- a/pt.go +++ b/pt.go @@ -14,7 +14,7 @@ // continue // } // go acceptLoop(ln) -// pt.Cmethod(methodName, "socks4", ln.Addr()) +// pt.Cmethod(methodName, ln.Version(), ln.Addr()) // } // pt.CmethodsDone() // diff --git a/socks.go b/socks.go index c982c7a..6cbecc6 100644 --- a/socks.go +++ b/socks.go @@ -95,6 +95,11 @@ func (ln *SocksListener) Accept() (net.Conn, error) { return ln.AcceptSocks() }
+// Returns "socks4", suitable to be included in a call to pt.Cmethod. +func (ln *SocksListener) Version() string { + return "socks4" +} + // Call Accept on the wrapped net.Listener, do SOCKS negotiation, and return a // SocksConn. After accepting, you must call either conn.Grant or conn.Reject // (presumably after trying to connect to conn.Req.Target).
tor-commits@lists.torproject.org