-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add messagetype, vendor name registries and lookups
- Loading branch information
Showing
5 changed files
with
145 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
module github.com/farsightsec/go-nmsg | ||
|
||
go 1.18 | ||
|
||
require ( | ||
github.com/dnstap/golang-dnstap v0.4.0 | ||
google.golang.org/protobuf v1.25.0 | ||
gopkg.in/yaml.v2 v2.4.0 | ||
) | ||
|
||
require ( | ||
github.com/farsightsec/golang-framestream v0.3.0 // indirect | ||
github.com/miekg/dns v1.1.31 // indirect | ||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 // indirect | ||
golang.org/x/net v0.0.0-20190923162816-aa69164e4478 // indirect | ||
golang.org/x/sys v0.8.0 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package nmsg_test | ||
|
||
import ( | ||
"github.com/farsightsec/go-nmsg" | ||
_ "github.com/farsightsec/go-nmsg/nmsg_base" | ||
"testing" | ||
) | ||
|
||
func TestRegisterVendor(t *testing.T) { | ||
vname, err := nmsg.VendorName(1) | ||
if err != nil || vname != "base" { | ||
t.Errorf("VendorName(1): %s, %v", vname, err) | ||
} | ||
|
||
vid, err := nmsg.VendorByName("base") | ||
if err != nil || vid != 1 { | ||
t.Errorf("VendorByName(base): %d, %v", vid, err) | ||
} | ||
} | ||
|
||
func TestRegisterMessageByName(t *testing.T) { | ||
vid, msgtype, err := nmsg.MessageTypeByName("base", "ncap") | ||
if err != nil || vid != 1 || msgtype != 1 { | ||
t.Errorf("MessageTypeByName(base,ncap): %d, %d, %v", vid, msgtype, err) | ||
} | ||
} | ||
|
||
func TestRegisterMessageName(t *testing.T) { | ||
vname, mname, err := nmsg.MessageTypeName(1, 1) | ||
if err != nil || vname != "base" || mname != "ncap" { | ||
t.Errorf("MessageTypeByName(base,ncap): %s, %s, %v", vname, mname, err) | ||
} | ||
} |