-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Support for listening to multicast group #5352
Comments
I'm new to working with multicast, but it seems that a more advanced configuration would allow listening to a specific address on an interface and potentially with multiple multicast groups? We could potentially expose these as settings, or it might just be overkill. @phemmer Any thoughts on this one? |
In principal I don't think there's anything wrong with the idea. In regards to listening on a specific interface, we can add support for |
With @phemmer's input: case "udp", "udp4", "udp6", "ip", "ip4", "ip6", "unixgram":
pc, err := udpListen(spl[0], spl[1])
if err != nil {
return err
}
if sl.ReadBufferSize.Size > 0 {
if srb, ok := pc.(setReadBufferer); ok {
srb.SetReadBuffer(int(sl.ReadBufferSize.Size))
} else {
log.Printf("W! Unable to set read buffer on a %s socket", spl[0])
}
}
psl := &packetSocketListener{
PacketConn: pc,
SocketListener: sl,
}
sl.Closer = psl
go psl.listen() and func udpListen(network string, address string) (net.PacketConn, error) {
switch network {
case "udp", "udp4", "udp6":
var addr *net.UDPAddr
var err error
var ifi *net.Interface
if spl := strings.SplitN(address, "%", 2); len(spl) == 2 {
address = spl[0]
ifi, err = net.InterfaceByName(spl[1])
if err != nil {
return nil, err
}
}
addr, err = net.ResolveUDPAddr(network, address)
if err == nil {
if addr.IP.IsMulticast() {
return net.ListenMulticastUDP(network, ifi, addr)
}
}
}
return net.ListenPacket(network, address)
} |
Looks good, can you create a pull request? |
Feature Request
I believe this feature could be added easily to the exisitng
socket_listener
input plugin. I have it working locally but I'm not sure how to cleanly integrate. For my requirements I only need the very simple multicast implementation (vianet.ListenMulticastUDP
) so there isn't much change.Proposal:
Adding
multicast://
multicast4://
multicast6://
network type handling toservice_address
config option:Current behavior:
Does not support multicast
Desired behavior:
Support multicast
Use case: [Why is this important (helps with prioritizing requests)]
I'm monitoring alerts sent from one application to other related applications via multicast group
The text was updated successfully, but these errors were encountered: