Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add multicast UDP listener support #412

Merged
merged 10 commits into from
Nov 7, 2022
Prev Previous commit
Next Next commit
Skip multicast IPv6 tests on Linux
  • Loading branch information
leki75 committed Nov 7, 2022
commit 2bc64db57bdd9b98cfc12536efab497b3589ba5f
7 changes: 5 additions & 2 deletions gnet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,9 @@ func TestServeMulticast(t *testing.T) {
t.Run("IPv6", func(t *testing.T) {
iface, err := findLoopbackInterface()
require.NoError(t, err)
if iface.Flags&net.FlagMulticast != net.FlagMulticast {
t.Skip("multicast is not supported on loopback interface")
}
// ff02::3 is an unassigned address from Link-Local Scope Multicast Addresses
// https://www.iana.org/assignments/ipv6-multicast-addresses/ipv6-multicast-addresses.xhtml#link-local
t.Run("udp-multicast", func(t *testing.T) {
Expand All @@ -451,11 +454,11 @@ func findLoopbackInterface() (*net.Interface, error) {
return nil, err
}
for _, iface := range ifaces {
if iface.Flags&(net.FlagLoopback|net.FlagMulticast) == net.FlagLoopback|net.FlagMulticast {
if iface.Flags&net.FlagLoopback == net.FlagLoopback {
return &iface, nil
}
}
return nil, errors.New("no loopback interface that supports multicast")
return nil, errors.New("no loopback interface")
}

func testMulticast(t *testing.T, addr string, reuseport, reuseaddr bool, index, nclients int) {
Expand Down