netdoc: add annotation fields for microdescriptors

This commit is contained in:
Nick Mathewson 2020-06-06 15:31:03 -04:00
parent b3f2e273c5
commit fe93263d35
1 changed files with 8 additions and 1 deletions

View File

@ -42,7 +42,7 @@ pub struct Microdesc {
decl_keyword! {
/// Keyword type for recognized objects in microdescriptors.
MicrodescKW {
annotation "last-listed" => A_LAST_LISTED,
annotation "last-listed" => ANN_LAST_LISTED,
"onion-key" => ONION_KEY,
"ntor-onion-key" => NTOR_ONION_KEY,
"family" => FAMILY,
@ -53,6 +53,13 @@ decl_keyword! {
}
lazy_static! {
static ref MICRODESC_ANNOTATIONS: SectionRules<MicrodescKW> = {
use MicrodescKW::*;
let mut rules = SectionRules::new();
rules.add(ANN_LAST_LISTED.rule().args(1..));
rules.add(ANN_UNRECOGNIZED.rule().may_repeat().obj_optional());
rules
};
static ref MICRODESC_RULES: SectionRules<MicrodescKW> = {
use MicrodescKW::*;