switch to v5 (#890)

* switch from v4 to v5

* remove deprecated entities

* remove "2" suffix from entities

* rename TransportProtocol into Protocol
This commit is contained in:
Alessandro Ros
2025-09-16 11:46:52 +02:00
committed by GitHub
parent f8649f6cf1
commit ec81d388d1
173 changed files with 805 additions and 2615 deletions

View File

@@ -2,7 +2,6 @@
package multicast
import (
"fmt"
"net"
"syscall"
)
@@ -13,37 +12,3 @@ type Conn interface {
SetReadBuffer(int) error
SyscallConn() (syscall.RawConn, error)
}
// InterfaceForSource returns a multicast-capable interface that can communicate with given IP.
//
// Deprecated: not used anymore.
func InterfaceForSource(ip net.IP) (*net.Interface, error) {
if ip.Equal(net.ParseIP("127.0.0.1")) {
return nil, fmt.Errorf("IP 127.0.0.1 can't be used as source of a multicast stream. Use the LAN IP of your PC")
}
intfs, err := net.Interfaces()
if err != nil {
return nil, err
}
for _, intf := range intfs {
if (intf.Flags & net.FlagMulticast) == 0 {
continue
}
var addrs []net.Addr
addrs, err = intf.Addrs()
if err == nil {
for _, addr := range addrs {
var ipnet *net.IPNet
_, ipnet, err = net.ParseCIDR(addr.String())
if err == nil && ipnet.Contains(ip) {
return &intf, nil
}
}
}
}
return nil, fmt.Errorf("found no interface that is multicast-capable and can communicate with IP %v", ip)
}