Skip to main content

classify

Function classify 

Source
pub fn classify(query: &str) -> Result<RdapRoute>
Expand description

Classifies a free-form RDAP query into an RdapRoute.

Rules (applied in order):

  1. If query parses as an IpAddr, route to RdapRoute::Ip.
  2. If query (case-insensitive) starts with AS, the remainder is all ASCII digits, and the trimmed query contains no ., route to RdapRoute::Asn.
  3. Otherwise, route to RdapRoute::Domain.

The contains('.') guard is the load-bearing check that prevents real domains like as1234.io from being misclassified as an ASN query — a regression that existed while RDAP auto-routing lived in the Python rdap() wrapper.