@@ -112,6 +112,8 @@ func TestGetRemoteIP(t *testing.T) {
112 errString string
112 errString string
113 expectedIP net.IP
113 expectedIP net.IP
115+ // Unix domain sockets set RemoteAddr to "@"
115 {"", "unable to get ip and port from http.RemoteAddr ()", nil},
117 {"", "unable to get ip and port from http.RemoteAddr ()", nil},
116 {"nil", "unable to get ip and port from http.RemoteAddr (nil)", nil},
118 {"nil", "unable to get ip and port from http.RemoteAddr (nil)", nil},
117 {"235.28.129.186", "unable to get ip and port from http.RemoteAddr (235.28.129.186)", nil},
119 {"235.28.129.186", "unable to get ip and port from http.RemoteAddr (235.28.129.186)", nil},
@@ -155,6 +157,8 @@ func TestGetClientString(t *testing.T) {
156 // Should fail quietly, only printing warnings to the log
158 // Should fail quietly, only printing warnings to the log
157 {nil, "", "", "", ""},
159 {nil, "", "", "", ""},
160+ // Unix domain socket — no IP available
161+ {nil, "@", "", "", ""},
158 {p, "127.0.0.1:11950", "", "127.0.0.1", "127.0.0.1"},
162 {p, "127.0.0.1:11950", "", "127.0.0.1", "127.0.0.1"},
159 {p, "[::1]:28660", "99.103.56.12", "99.103.56.12", "::1 (99.103.56.12)"},
163 {p, "[::1]:28660", "99.103.56.12", "99.103.56.12", "::1 (99.103.56.12)"},
160 {nil, "10.254.244.165:62750", "", "10.254.244.165", "10.254.244.165"},
164 {nil, "10.254.244.165:62750", "", "10.254.244.165", "10.254.244.165"},