Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcelCoding committed Oct 8, 2023
1 parent 810bd41 commit 97ae66b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/views.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub async fn get_peer(
State(config): State<ConfigState>,
Path(identifier): Path<String>,
) -> Result<Json<ApiReturnTypes>, StatusCode> {
validate_identifier(&identifier).map_err(||StatusCode::BAD_REQUEST)?;
validate_identifier(&identifier).map_err(|| StatusCode::BAD_REQUEST)?;

info!("? {}", identifier);

Expand Down Expand Up @@ -88,9 +88,12 @@ pub async fn add_peer(
// todo sanitize addresses, user identifier, peer identifier

// generate the identifier, which is the user identifier + peer identifier
let identifier = format!("{}-{}", peer_data.user_identifier, peer_data.peer_identifier);
let identifier = format!(
"{}-{}",
peer_data.user_identifier, peer_data.peer_identifier
);
info!("+ {}", identifier);
validate_identifier(&identifier).map_err(||StatusCode::BAD_REQUEST)?;
validate_identifier(&identifier).map_err(|| StatusCode::BAD_REQUEST)?;

// VyOS allows the label for a peer to have 100 characters.
if identifier.len() > 100 {
Expand Down Expand Up @@ -159,7 +162,7 @@ pub async fn delete_peer(
State(config): State<ConfigState>,
Path(identifier): Path<String>,
) -> Result<Json<ApiReturnTypes>, StatusCode> {
validate_identifier(&identifier).map_err(||StatusCode::BAD_REQUEST)?;
validate_identifier(&identifier).map_err(|| StatusCode::BAD_REQUEST)?;
info!("- {}", identifier);

// get existing allowed ips for this identifier from current vyatta configuration
Expand Down

0 comments on commit 97ae66b

Please sign in to comment.