From e38ebda0ccde8239b3b636e31c2e945637793021 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Mon, 19 Sep 2011 22:41:38 +0200 Subject: [PATCH] It compiles --- _examples/q/fp.go | 10 ++++++++++ _examples/q/lex.go | 13 ++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/_examples/q/fp.go b/_examples/q/fp.go index c2c1faea..28bfebfc 100644 --- a/_examples/q/fp.go +++ b/_examples/q/fp.go @@ -7,6 +7,16 @@ import ( "strings" ) +const ( + // Detected software types + NSD = "nsd" + BIND = "bind" + + // Vendors + ISC = "ISC" + NLNETLABS = "NLnet Labs" +) + // SendProbe creates a packet and sends it to the nameserver. // Connection errors are returned as: // ... diff --git a/_examples/q/lex.go b/_examples/q/lex.go index a1139f87..831d0751 100644 --- a/_examples/q/lex.go +++ b/_examples/q/lex.go @@ -18,7 +18,8 @@ const ( itemError itemType = iota itemVender // software vendor itemSoftware // the name of the DNS server software - itemVersion // the version of the software (empty if not determined) + itemVersionMin // the minimum version of the software (empty if not determined) + itemVersionMax // the maximum version of the software (empty if not determined) ) // stateFn represents the state of the scanner as a function that returns the next state. @@ -37,8 +38,8 @@ func (l *lexer) probe() *fingerprint { return sendProbe(l.client, l.addr, l.fp, l.q) } -func (l *lexer) emit() { - // send item on the channel +func (l *lexer) emit(i *item) { + l.items <- *i } // "Lexer" functions @@ -48,7 +49,9 @@ func lexDoBitMirorred(l *lexer) stateFn { // The important part here is that the DO bit is on l.fp.SetString("QUERY,NOERROR,qr,aa,tc,RD,ad,cd,z,1,0,0,0,DO,0") l.q = dns.Question{".", dns.TypeNS, dns.ClassINET} - l.probe() - + if l.probe().Do { + l.emit(&item{itemSoftware, NSD}) + } + l.emit(&item{itemSoftware, BIND}) return nil }