packetcap / go-pcap

Packet capture library and tools in native go
Apache License 2.0
14 stars 4 forks source link

Simplify composites that can be a single primitive #11

Closed deitch closed 4 years ago

deitch commented 4 years ago

In some cases, a composite can be represented as a single primitive. For example:

udp and port 53 is represented as two primitives:

However these do not conflict, especially as it is an "and", and all elements in a primitive already are logically ANDed together. This could just as easily be:

We need a composite.Simplify() (maybe "distill"?) method that can distill down things that logically can be distilled.