mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
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
This commit is contained in:
parent
83f8712078
commit
c84e1a2e03
1 changed files with 5 additions and 1 deletions
|
@ -130,12 +130,16 @@ func proxy(local *net.TCPConn, conn *webSocketConn) {
|
||||||
|
|
||||||
// Return an address string suitable to pass into pt.DialOr.
|
// Return an address string suitable to pass into pt.DialOr.
|
||||||
func clientAddr(clientIPParam string) string {
|
func clientAddr(clientIPParam string) string {
|
||||||
|
if clientIPParam == "" {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
// Check if client addr is a valid IP
|
// Check if client addr is a valid IP
|
||||||
clientIP := net.ParseIP(clientIPParam)
|
clientIP := net.ParseIP(clientIPParam)
|
||||||
if clientIP == nil {
|
if clientIP == nil {
|
||||||
return ""
|
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) {
|
func webSocketHandler(ws *websocket.WebSocket) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue