[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [snowflake/master] Add a dummy port number to USERADDR.
commit c84e1a2e034bb3e2e454389cf9e8fd71d2d8d040
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date: Tue Oct 17 21:41:24 2017 -0700
Add a dummy port number to USERADDR.
Current versions of tor accept USERADDR with or without a port number,
but future versions may become more strict and require the port number.
https://bugs.torproject.org/23080
---
server/server.go | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/server/server.go b/server/server.go
index 29e8137..3c97e06 100644
--- a/server/server.go
+++ b/server/server.go
@@ -130,12 +130,16 @@ func proxy(local *net.TCPConn, conn *webSocketConn) {
// Return an address string suitable to pass into pt.DialOr.
func clientAddr(clientIPParam string) string {
+ if clientIPParam == "" {
+ return ""
+ }
// Check if client addr is a valid IP
clientIP := net.ParseIP(clientIPParam)
if clientIP == nil {
return ""
}
- return clientIPParam
+ // Add a dummy port number. USERADDR requires a port number.
+ return (&net.TCPAddr{IP: clientIP, Port: 1, Zone: ""}).String()
}
func webSocketHandler(ws *websocket.WebSocket) {
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits