package udp import ( "net" "testing" ) // A "multicast" row whose group is not a multicast address. // // 127.0.0.1 in that box is the common mistake — it is the address every other // field in every other program wants — and it used to fail the join on every // interface with a Windows error about an address not being valid in its // context. The row did not run and the message named nothing the operator had // typed. Reported by an operator whose WSJT-X rows were dead for exactly this // reason, while a third row on unicast worked perfectly beside them. func TestOnlyRealMulticastGroupsAreJoined(t *testing.T) { for _, tc := range []struct { addr string multicast bool }{ {"224.0.0.1", true}, // the all-hosts group WSJT-X offers {"239.255.0.1", true}, // the administratively-scoped range {"127.0.0.1", false}, // loopback: the mistake {"192.168.1.10", false}, {"0.0.0.0", false}, } { ip := net.ParseIP(tc.addr) if ip == nil { t.Fatalf("%s does not parse", tc.addr) } if got := ip.IsMulticast(); got != tc.multicast { t.Errorf("%s: IsMulticast() = %v, wanted %v", tc.addr, got, tc.multicast) } } }