kanishkarj / snoopy

A highly configurable multi-threaded packet sniffer and parser build in rust-lang.
MIT License
177 stars 16 forks source link

don't wrap packets in constructors for Result when encoding to JSON? #7

Closed chessai closed 5 years ago

chessai commented 5 years ago

It seems that all of the packets encoded to json are wrapped in "Ok". I would expect the file to only contain values that were once wrapped in the 'Ok' constructor, but then unwrapped when encoded.

kanishkarj commented 5 years ago

That was something I was thinking about. What should the JSON file contain if parsing lead to some error? Should I ignore it? I was not sure, so I left it as a result. I know it's a terrible design choice, but was not able to come up with anything else. Please let me know if you have anything in mind, I'd be glad to incorporate that ! :D

chessai commented 5 years ago

i was thinking that it should be left out. perhaps you could also log to the user that there were some packets you were unable to encode? i think if you give the user just a u32 representing the number of packets you were unable to decode, that would be sufficient.

p.s. thanks for the awesome project! much more digestible code than wireshark

kanishkarj commented 5 years ago

Take a look now, I have merged the changes. the errors are logged onto the console. Thanks for the suggestion :D

p.s. thanks for the awesome project! much more digestible code than wireshark Thanks xD