Adding upstream version 0.0.22.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
2f814b513a
commit
b06d3acde8
190 changed files with 61565 additions and 0 deletions
24
icann-rdap-srv/src/rdap/autnum.rs
Normal file
24
icann-rdap-srv/src/rdap/autnum.rs
Normal file
|
@ -0,0 +1,24 @@
|
|||
use axum::{
|
||||
extract::{Path, State},
|
||||
response::Response,
|
||||
};
|
||||
|
||||
use crate::{error::RdapServerError, rdap::response::ResponseUtil, server::DynServiceState};
|
||||
|
||||
use super::ToBootStrap;
|
||||
|
||||
/// Gets an autnum object by the number path.
|
||||
#[axum_macros::debug_handler]
|
||||
#[tracing::instrument(level = "debug")]
|
||||
pub(crate) async fn autnum_by_num(
|
||||
Path(as_num): Path<u32>,
|
||||
state: State<DynServiceState>,
|
||||
) -> Result<Response, RdapServerError> {
|
||||
let storage = state.get_storage().await?;
|
||||
let autnum = storage.get_autnum_by_num(as_num).await?;
|
||||
Ok(if state.get_bootstrap() {
|
||||
autnum.to_autnum_bootstrap(as_num).response()
|
||||
} else {
|
||||
autnum.response()
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue