Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

More finegrained error messages to support reading from named pipes #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

resulknad
Copy link

Changes in the pull request make it easier to read from named pipes which do not allow to seek. Whatever the read returns from the named-pipe needs to be buffered. The more fine-grained error messages can be useful as follows:

ErrBufferTooSmall (n) - wait for n more bytes to arrive, retry parsing
ErrInvalidHeader - advance file pointer by 1 position and retry parsing header there (useful to find beginning of record)
ErrMalformedRecord - skip the whole record

This enables to process records instantly by waiting for just enough bytes to become available, reopen a u2 named pipe mid-record and skipping bad-records.

@jasonish
Copy link
Owner

I think this makes sense, are you actively using this project?

@resulknad
Copy link
Author

Yeah it is being used in a daemon interfacing between snort and some internal tooling. Thanks for publishing the code.

Let me know if you have some thoughts on how to improve the proposed changes, more than happy to implement that and get this upstream :)

@jasonish
Copy link
Owner

jasonish commented Sep 3, 2021

Any interest in taking this over? I haven't written Go in about 2 years, and don't think I even having a working toolchain installed anywhere right now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants