mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
In server, treat a client IP address of 0.0.0.0 as missing.
Some proxies currently send ?client_ip=0.0.0.0 because of an error in how they attempt to grep the address from the client's SDP. That's inflating our "%d/%d connections had client_ip" logs. Instead, treat these cases as if the IP address were absent. https://bugs.torproject.org/33157 https://bugs.torproject.org/33385
This commit is contained in:
parent
380b133155
commit
c124e8c643
2 changed files with 7 additions and 0 deletions
|
@ -88,6 +88,11 @@ func clientAddr(clientIPParam string) string {
|
||||||
if clientIP == nil {
|
if clientIP == nil {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
// Check if client addr is 0.0.0.0 or [::]. Some proxies erroneously
|
||||||
|
// report an address of 0.0.0.0: https://bugs.torproject.org/33157.
|
||||||
|
if clientIP.IsUnspecified() {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
// Add a dummy port number. USERADDR requires a port number.
|
// Add a dummy port number. USERADDR requires a port number.
|
||||||
return (&net.TCPAddr{IP: clientIP, Port: 1, Zone: ""}).String()
|
return (&net.TCPAddr{IP: clientIP, Port: 1, Zone: ""}).String()
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,8 @@ func TestClientAddr(t *testing.T) {
|
||||||
"abc",
|
"abc",
|
||||||
"1.2.3.4.5",
|
"1.2.3.4.5",
|
||||||
"[12::34]",
|
"[12::34]",
|
||||||
|
"0.0.0.0",
|
||||||
|
"[::]",
|
||||||
} {
|
} {
|
||||||
useraddr := clientAddr(input)
|
useraddr := clientAddr(input)
|
||||||
if useraddr != "" {
|
if useraddr != "" {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue