asterust_junos/protocols/bgp/peer_options/
multihop.rs1use crate::{statement_words, value_after};
9use asterust::config::ConfigLine;
10
11#[derive(Clone, Debug, PartialEq, Eq)]
13#[non_exhaustive]
14pub struct Multihop {
15 pub ttl: Option<String>,
16 pub no_nexthop_change: bool,
17}
18
19pub(super) fn parse_multihop(line: &ConfigLine) -> Option<Multihop> {
21 let words = statement_words(line, "multihop")?;
22 let bare_ttl = words
23 .first()
24 .filter(|word| word.chars().all(|c| c.is_ascii_digit()))
25 .map(|word| word.to_string());
26 Some(Multihop {
27 ttl: value_after(&words, "ttl").or(bare_ttl),
28 no_nexthop_change: words.contains(&"no-nexthop-change"),
29 })
30}