Astrolabe: BGP Geospatial Encoding

Astrolabe is a protocol for encoding geospatial data in BGP communities. It's designed to enhance routing decisions and network diagnostics without compromising the existing BGP infrastructure.

Technical Specifications

Encoding Scheme

ASN:GeospatialValue

Latitude:  600,000,000 to 633,554,431
Longitude: 900,000,000 to 967,108,863
Altitude:  681,611,393 to 698,388,607

Total BGP community space usage: 2.734%

Implementation

const LAT_SCALE: f64 = (1 << 25) as f64 - 1.0;
const LON_SCALE: f64 = (1 << 26) as f64 - 1.0;
const ALT_BASE: i32 = 690_000_000;
const ALT_MAX: i32 = 8_388_607;

pub fn encode_latitude(lat: f64) -> u32 {
    let lat = lat.clamp(-90.0, 90.0);
    let lat_normalized = ((lat + 90.0) * LAT_SCALE / 180.0).round() as u32;
    600_000_000 + lat_normalized
}

pub fn decode_latitude(lat_community: u32) -> f64 {
    let lat_normalized = (lat_community.saturating_sub(600_000_000)) as f64;
    ((lat_normalized * 180.0 / LAT_SCALE) - 90.0).clamp(-90.0, 90.0)
}

// Similar functions for longitude and altitude

Security Considerations

Mapcoder - About