In order to add support for application layer protocols that operate over UDP packetbeat first needs to add support for UDP. Is anyone currently working on adding UDP support? Let’s discuss the changes necessary to add UDP support.
I will float some ideas to start the discussion.
Currently the ProtocolPlugin interface is specific to TCP and will require changes to support UDP. It seems to me that it would be good to separate the methods for parsing UDP and TCP into separate interfaces. Plugins can then implement one or both of the interfaces depending on their needs. This also gives a path forward if other transport protocols need to be supported in the future. For example I was thinking something like this . . .
type ProtocolPlugin interface {
Init(…)
GetPorts(…)
}
type TcpProtocolPlugin interface {
ProtocolPlugin
ParseTcp(…) // renamed from Parse()
ReceivedFin(…)
GapInStream(…)
}
type UdpProtocolPlugin interface {
ProtocolPlugin
ParseUdp(…)
}
The packet decoder used in the SnifferSetup is provided by the TCP protocol plugin. I’m thinking most of the decoder logic should be separated from the TCP protocol plugin so that support for UDP (and possibly other transports) can be added.