Make records toggleable via disabled
attribute
This commit is contained in:
parent
d74fcd0a47
commit
80205e1581
4
main.go
4
main.go
@ -58,13 +58,13 @@ func appendResults(etype string, name string, m *dns.Msg, cur *mongo.Cursor) int
|
|||||||
func query(tp string, name string, m *dns.Msg, coll *mongo.Collection) {
|
func query(tp string, name string, m *dns.Msg, coll *mongo.Collection) {
|
||||||
// TODO: Validate `name` against RE_FQDN
|
// TODO: Validate `name` against RE_FQDN
|
||||||
log.Printf("Query %s for %s\n", tp, name)
|
log.Printf("Query %s for %s\n", tp, name)
|
||||||
cur, err := coll.Find(context.TODO(), bson.M{"dns.fqdn": name})
|
cur, err := coll.Find(context.TODO(), bson.M{"dns.fqdn": name, "disabled": false})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if appendResults(tp, name, m, cur) == 0 {
|
if appendResults(tp, name, m, cur) == 0 {
|
||||||
cur, err := coll.Find(context.TODO(), bson.M{"dns.san": name})
|
cur, err := coll.Find(context.TODO(), bson.M{"dns.san": name, "disabled": false})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user