1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
//! The TALs bundled with Routinator.


//------------ BundledTal ----------------------------------------------------

/// Description and content of a TAL bundled with Routinator.
pub struct BundledTal {
    /// The short name of the TAL.
    pub name: &'static str,

    /// A description of the TAL.
    pub description: &'static str,

    /// The category of the TAL.
    pub category: Category,

    /// Does this TAL need explicit opt-in and if so, how is it to be done?
    pub opt_in: Option<OptIn>,

    /// The actual content of the TAL.
    pub content: &'static str,
}


//------------ OptIn ---------------------------------------------------------

/// Information about performing the opt-in procedure for some TALs.
pub struct OptIn {
    /// The command line option for explicitely opting in.
    pub option_name: &'static str,

    /// The help text for the command line option.
    pub option_help: &'static str,

    /// The text to show when opt-in is missing.
    pub message: &'static str,
}


//------------ Category ------------------------------------------------------

/// The category of a TAL.
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub enum Category {
    /// One of the five RIR TALs.
    Production,

    /// A TAL for a testbed of one of the five RIRs.
    RirTest,

    /// A TAL for a third-party test bed.
    Test,

    /// Any other TAL.
    Other,
}


//------------ All Bundled TALs ----------------------------------------------

/// All TALs bundled with Routinators.
pub static BUNDLED_TALS: &[BundledTal] = &[

    //--- Production RIR TALs.
    //
    BundledTal {
        name: "afrinic",
        description: "AFRINIC production TAL",
        category: Category::Production,
        opt_in: None,
        content: include_str!("../tals/afrinic.tal"),
    },
    BundledTal {
        name: "apnic",
        description: "APNIC production TAL",
        category: Category::Production,
        opt_in: None,
        content: include_str!("../tals/apnic.tal"),
    },
    BundledTal {
        name: "arin",
        description: "ARIN production TAL",
        category: Category::Production,
        opt_in: Some(OptIn {
            option_name: "accept-arin-rpa",
            option_help:
                "You have read and accept \
                 https://www.arin.net/resources/manage/rpki/rpa.pdf",
            message:
                "Before we can install the ARIN TAL, you must have read\n\
                 and agree to the ARIN Relying Party Agreement (RPA).\n\
                 It is available at\n\
                 \n\
                 https://www.arin.net/resources/manage/rpki/rpa.pdf\n\
                 \n\
                 If you agree to the RPA, please run the command\n\
                 again with the --accept-arin-rpa option."
        }),
        content: include_str!("../tals/arin.tal"),
    },
    BundledTal {
        name: "lacnic",
        description: "LACNIC production TAL",
        category: Category::Production,
        opt_in: None,
        content: include_str!("../tals/lacnic.tal"),
    },
    BundledTal {
        name: "ripe",
        description: "RIPE production TAL",
        category: Category::Production,
        opt_in: None,
        content: include_str!("../tals/ripe.tal"),
    },

    // RIR Testbed TALS
    BundledTal {
        name: "apnic-testbed",
        description: "APNIC RPKI Testbed",
        category: Category::RirTest,
        opt_in: None,
        content: include_str!("../tals/apnic-testbed.tal"),
    },
    BundledTal {
        name: "arin-ote",
        description: "ARIN Operational Test and Evaluation Environment",
        category: Category::RirTest,
        opt_in: None,
        content: include_str!("../tals/arin-ote.tal"),
    },
    BundledTal {
        name: "ripe-pilot",
        description: "RIPE NCC RPKI Test Environment",
        category: Category::RirTest,
        opt_in: None,
        content: include_str!("../tals/ripe-pilot.tal"),
    },

    // Other Testbed TALs
    BundledTal {
        name: "nlnetlabs-testbed",
        description: "NLnet Labs RPKI Testbed",
        category: Category::Test,
        opt_in: None,
        content: include_str!("../tals/nlnetlabs-testbed.tal"),
    }
];