Commit c84e1a2e authored by David Fifield's avatar David Fifield
Browse files

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
parent 83f87120
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -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) {