Skip to main content

Crate asdot

Crate asdot 

Source
Expand description

RFC 5396-compliant Autonomous System Number (ASN) parsing and formatting.

Implements all three notation formats from RFC 5396:

  • ASPLAIN: plain decimal (65536)
  • ASDOT: dot notation for 4-byte AS numbers only; plain for 2-byte (1, 1.0)
  • ASDOT+: dot notation always (0.1, 1.0)

Display defaults to ASDOT notation. Use Asn::to_asplain or Asn::to_asdot_plus for the other formats.

§Example

use asdot::Asn;

// Parse any RFC 5396 notation
let asn: Asn = "1.0".parse().unwrap();
assert_eq!(asn.value(), 65536);

// Display defaults to ASDOT
assert_eq!(asn.to_string(), "1.0");

// Other formats available explicitly
assert_eq!(asn.to_asplain(), "65536");
assert_eq!(asn.to_asdot_plus(), "1.0");

Structs§

Asn
An Autonomous System Number, stored as a u32.

Enums§

ParseAsnError
Error returned when parsing an ASN string fails.