[tor-commits] [goptlib/master] Return the username from readSocks4aConnect.
dcf at torproject.org
dcf at torproject.org
Mon Dec 9 02:49:51 UTC 2013
commit d58b6b6ef27edf4de034f99e62d51bcb753e9d5a
Author: David Fifield <david at bamsoftware.com>
Date: Mon Dec 2 08:58:34 2013 -0800
Return the username from readSocks4aConnect.
---
socks/socks.go | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/socks/socks.go b/socks/socks.go
index 8d2e870..8726ceb 100644
--- a/socks/socks.go
+++ b/socks/socks.go
@@ -21,7 +21,8 @@ const (
)
type Request struct {
- Target string
+ Username string
+ Target string
}
// Read a SOCKS4a connect request, and call the given connect callback with the
@@ -76,10 +77,12 @@ func readSocks4aConnect(s io.Reader) (req Request, err error) {
return
}
- _, err = r.ReadBytes('\x00')
+ var usernameBytes []byte
+ usernameBytes, err = r.ReadBytes('\x00')
if err != nil {
return
}
+ req.Username = string(usernameBytes[:len(usernameBytes)-1])
var port int
var host string
More information about the tor-commits
mailing list