mirror of
https://github.com/warp-tech/warpgate.git
synced 2024-09-20 06:46:17 +08:00
lint
This commit is contained in:
parent
9637f11cb9
commit
d9385ca44b
|
@ -48,8 +48,8 @@ impl ListApi {
|
|||
let mut roles = Role::Entity::find().order_by_asc(Role::Column::Name);
|
||||
|
||||
if let Some(ref search) = *search {
|
||||
let search = format!("%{}%", search);
|
||||
roles = roles.filter(Role::Column::Name.like(&*search));
|
||||
let search = format!("%{search}%");
|
||||
roles = roles.filter(Role::Column::Name.like(&search));
|
||||
}
|
||||
|
||||
let roles = roles
|
||||
|
|
|
@ -50,8 +50,8 @@ impl ListApi {
|
|||
let mut targets = Target::Entity::find().order_by_asc(Target::Column::Name);
|
||||
|
||||
if let Some(ref search) = *search {
|
||||
let search = format!("%{}%", search);
|
||||
targets = targets.filter(Target::Column::Name.like(&*search));
|
||||
let search = format!("%{search}%");
|
||||
targets = targets.filter(Target::Column::Name.like(&search));
|
||||
}
|
||||
|
||||
let targets = targets.all(&*db).await.map_err(WarpgateError::from)?;
|
||||
|
|
|
@ -53,8 +53,8 @@ impl ListApi {
|
|||
let mut users = User::Entity::find().order_by_asc(User::Column::Username);
|
||||
|
||||
if let Some(ref search) = *search {
|
||||
let search = format!("%{}%", search);
|
||||
users = users.filter(User::Column::Username.like(&*search));
|
||||
let search = format!("%{search}%");
|
||||
users = users.filter(User::Column::Username.like(&search));
|
||||
}
|
||||
|
||||
let users = users.all(&*db).await.map_err(WarpgateError::from)?;
|
||||
|
|
|
@ -6,7 +6,7 @@ use once_cell::sync::Lazy;
|
|||
use tokio::sync::{broadcast, Mutex};
|
||||
use uuid::Uuid;
|
||||
use warpgate_common::auth::{AuthResult, AuthState};
|
||||
use warpgate_common::{WarpgateError, SessionId};
|
||||
use warpgate_common::{SessionId, WarpgateError};
|
||||
|
||||
use crate::ConfigProvider;
|
||||
|
||||
|
|
|
@ -360,7 +360,7 @@ async fn serialize_auth_state_inner(
|
|||
Ok(AuthStateResponse::Ok(Json(AuthStateResponseInternal {
|
||||
protocol: state.protocol().to_string(),
|
||||
address: peer_addr.map(|x| x.ip().to_string()),
|
||||
started: state.started().clone(),
|
||||
started: *state.started(),
|
||||
state: state.verify().into(),
|
||||
identification_string: state.identification_string().to_owned(),
|
||||
})))
|
||||
|
|
|
@ -45,10 +45,7 @@ impl Api {
|
|||
};
|
||||
|
||||
if let Some(ref search) = *search {
|
||||
targets = targets
|
||||
.into_iter()
|
||||
.filter(|t| t.name.contains(search))
|
||||
.collect()
|
||||
targets.retain(|t| t.name.contains(search))
|
||||
}
|
||||
|
||||
let mut targets = stream::iter(targets)
|
||||
|
|
|
@ -8,7 +8,6 @@ use poem::web::{Data, Redirect};
|
|||
use poem::{Endpoint, EndpointExt, FromRequest, IntoResponse, Request, Response};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tokio::sync::Mutex;
|
||||
use tracing::*;
|
||||
use uuid::Uuid;
|
||||
use warpgate_common::auth::AuthState;
|
||||
use warpgate_common::{ProtocolName, TargetOptions, WarpgateError};
|
||||
|
|
|
@ -86,13 +86,15 @@ impl ProtocolServer for MySQLProtocolServer {
|
|||
.register_session(
|
||||
&crate::common::PROTOCOL_NAME,
|
||||
SessionStateInit {
|
||||
remote_address: Some(remote_address.clone()),
|
||||
remote_address: Some(remote_address),
|
||||
handle: Box::new(session_handle),
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
|
||||
let session = MySqlSession::new(server_handle, services, stream, tls_config, remote_address).await;
|
||||
let session =
|
||||
MySqlSession::new(server_handle, services, stream, tls_config, remote_address)
|
||||
.await;
|
||||
let span = session.make_logging_span();
|
||||
tokio::select! {
|
||||
result = session.run().instrument(span) => match result {
|
||||
|
|
|
@ -312,8 +312,7 @@ impl MySqlSession {
|
|||
handle.set_target(&target).await?;
|
||||
}
|
||||
|
||||
self.run_authorized_inner(handshake, mysql_options)
|
||||
.await
|
||||
self.run_authorized_inner(handshake, mysql_options).await
|
||||
}
|
||||
|
||||
async fn run_authorized_inner(
|
||||
|
|
|
@ -1325,7 +1325,6 @@ impl ServerSession {
|
|||
login_url,
|
||||
identification_string
|
||||
.chars()
|
||||
.into_iter()
|
||||
.map(|x| x.to_string())
|
||||
.collect::<Vec<_>>()
|
||||
.join(" ")
|
||||
|
|
Loading…
Reference in a new issue