Documentation
¶
Overview ¶
Package output provides the JSONL (newline-delimited JSON) sink for scan reports. Records are written as one JSON object per line, which keeps the format stream-friendly and easy to consume with jq or line-oriented tools.
Index ¶
- type JSONLWriter
- func (j *JSONLWriter) Close() error
- func (j *JSONLWriter) Path() string
- func (j *JSONLWriter) Write(record interface{}) error
- func (j *JSONLWriter) WriteCertificate(c report.Certificate) error
- func (j *JSONLWriter) WriteConfig(c report.Config) error
- func (j *JSONLWriter) WriteHost(h report.Host) error
- func (j *JSONLWriter) WriteIP(i report.IP) error
- func (j *JSONLWriter) WriteSummary(s report.Summary) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JSONLWriter ¶
type JSONLWriter struct {
// contains filtered or unexported fields
}
JSONLWriter serializes report records to a writer as JSONL. A nil *JSONLWriter is a valid no-op, so callers never need guards.
func NewFile ¶
func NewFile(path string) (*JSONLWriter, error)
NewFile creates a JSONLWriter that writes to the file at path.
func NewStdout ¶
func NewStdout(w io.Writer) *JSONLWriter
NewStdout creates a JSONLWriter on w, tagged as the stdout sink. It is used when human output has been diverted to stderr but JSONL must keep flowing to the real stdout. The underlying writer is not closed on Close.
func NewWriter ¶
func NewWriter(w io.Writer) *JSONLWriter
NewWriter creates a JSONLWriter on an arbitrary io.Writer. Primarily used by tests. The underlying writer is not closed.
func (*JSONLWriter) Close ¶
func (j *JSONLWriter) Close() error
Close flushes buffered output and closes an owned file handle, if any.
func (*JSONLWriter) Path ¶
func (j *JSONLWriter) Path() string
Path returns the output destination for display purposes. "-" means stdout.
func (*JSONLWriter) Write ¶
func (j *JSONLWriter) Write(record interface{}) error
Write serializes one record. It is safe for concurrent use.
func (*JSONLWriter) WriteCertificate ¶
func (j *JSONLWriter) WriteCertificate(c report.Certificate) error
func (*JSONLWriter) WriteConfig ¶
func (j *JSONLWriter) WriteConfig(c report.Config) error
WriteConfig, WriteCertificate, WriteHost, WriteIP and WriteSummary are small typed conveniences over Write.
func (*JSONLWriter) WriteSummary ¶
func (j *JSONLWriter) WriteSummary(s report.Summary) error