I have simple udp service in Go, but it listens only for packets generated on the local server (where my udp service is started). If packets are coming from outside , they don't reach my udp service.
func ListenUDP(syslog string) (*net.UDPConn) {
udpAddr, _ := net.ResolveUDPAddr("udp4", syslog)
ln, _ := net.ListenUDP("udp", udpAddr)
return ln
}
func Start(conn *net.UDPConn) []byte {
buffer := make([]byte, 2048)
n, _, _ := conn.ReadFromUDP(buffer)
return (buffer[:n])
}
ln, _ := syslogd.ListenUDP("0.0.0.0:12514")
data := syslogd.Start(ln)
And I verified that packets are not blocked by local firewall or iptables