Debian Codegraph @

/

debian golang-github-farsightsec-go-nmsg 0.3.0-1debian golang-github-farsightsec-go-nmsg-dev gomod github.com/farsightsec/go-nmsg shell shell-project 0.0.0 debiangogoinimakefilemarkdownshellyaml 60 files · 1321 symbols
View dependency graph

Depends on

README (full)

Pure Golang NMSG Library

go-nmsg is a pure go implementation of the NMSG container and payload format used by the C nmsg toolkit and library.

Synopsis

import "github.com/farsightsec/go-nmsg"
import "github.com/farsightsec/go-nmsg/nmsg_base"

var r io.Reader
var w io.Writer
...
input := nmsg.NewInput(r, mtu)
output := nmsg.BufferedOutput(w)
output.SetMaxSize(nmsg.MaxContainerSize, 0)

for {
	payload, err := input.Recv()
	if err != nil {
		if nmsg.IsDataError(err) {
			continue
		}
		break
	}
	message := payload.Message()

	switch message.(type) {
	case *nmsg_base.Dnstap:
		// process dnstap
		// write copy to output
		output.Send(payload)
	}
}

output.Close()

Requirements

go-nmsg requires the following open source libraries:

"google.golang.org/protobuf/proto"
"github.com/dnstap/golang-dnstap"

Limitations

go-nmsg can pack and unpack the protobuf structure of an NMSG payload, and the protobuf structure of the data contained in the payload. It does not implement the full functionality of the C libnmsg message modules, such as:

  • Advanced field types (e.g., a protobuf []byte as an IP address)
  • Generated fields
  • Formatting of fields for presentation and JSON output

Applications needing such functionality in go should use the cgo-nmsg package included in this distribution under:

"github.com/farsightsec/go-nmsg/cgo-nmsg"
dir cgo-nmsg/
dir debian/
dir nmsg_base/
file COPYRIGHT
file LICENSE
file README.md
file container.go
file container_test.go
file endian.go
file genproto.sh
file go.mod
file go.sum
file input.go
file input_frag.go
file input_seq.go
file input_test.go
file nmsg.go
file nmsg.pb.go
file nmsg.proto
file output.go
file output_test.go
file payload.go
file payload_test.go
file payload_test.pb_test.go
file payload_test.proto
file register.go
file register_test.go
file sockspec.go
file sockspec_test.go
file zbuf.go
file zlib_test.go