lib/beacon, lib/discover: Send IPv4 limited broadcast when address listing fails (fixes #1628) (#9087)
This commit is contained in:
@@ -91,14 +91,14 @@ func TestLocalInstanceIDShouldTriggerNew(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestFilterUnspecified(t *testing.T) {
|
||||
func TestFilterUndialable(t *testing.T) {
|
||||
addrs := []string{
|
||||
"quic://[2001:db8::1]:22000", // OK
|
||||
"tcp://192.0.2.42:22000", // OK
|
||||
"quic://[2001:db8::1]:0", // remove, port zero
|
||||
"tcp://192.0.2.42:0", // remove, port zero
|
||||
"quic://[::]:22000", // remove, unspecified
|
||||
"tcp://0.0.0.0:22000", // remove, unspecified
|
||||
"quic://[::]:22000", // OK
|
||||
"tcp://0.0.0.0:22000", // OK
|
||||
"tcp://[2001:db8::1]", // remove, no port
|
||||
"tcp://192.0.2.42", // remove, no port
|
||||
"tcp://foo:bar", // remove, host/port does not resolve
|
||||
@@ -112,11 +112,13 @@ func TestFilterUnspecified(t *testing.T) {
|
||||
exp := []string{
|
||||
"quic://[2001:db8::1]:22000",
|
||||
"tcp://192.0.2.42:22000",
|
||||
"quic://[::]:22000",
|
||||
"tcp://0.0.0.0:22000",
|
||||
"tcp://[fe80::9ef:dff1:b332:5e56]:55681",
|
||||
}
|
||||
res := filterUnspecifiedLocal(addrs)
|
||||
res := filterUndialableLocal(addrs)
|
||||
if fmt.Sprint(res) != fmt.Sprint(exp) {
|
||||
t.Log(res)
|
||||
t.Error("filterUnspecified returned invalid addresses")
|
||||
t.Error("filterUndialableLocal returned invalid addresses")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user