commit a rustfmt toml and merge imports
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
edition = "2024"
|
||||
|
||||
# Merge imports from the same crate into one use statement
|
||||
imports_granularity = "Crate"
|
||||
@@ -4,8 +4,7 @@
|
||||
|
||||
use conf::{Conf, Subcommands};
|
||||
use hyper::service::service_fn;
|
||||
use hyper_util::rt::TokioIo;
|
||||
use hyper_util::server::conn::auto;
|
||||
use hyper_util::{rt::TokioIo, server::conn::auto};
|
||||
use signal_gateway::{Gateway, GatewayConfig};
|
||||
use std::{net::SocketAddr, sync::Arc, time::Duration};
|
||||
use tokio::net::TcpListener;
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
//! where values already exist, using a read lock first before falling back to a
|
||||
//! write lock for insertions.
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::hash::Hash;
|
||||
use std::{collections::HashMap, hash::Hash};
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
/// A concurrent hash map that uses read-preferring locking.
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
//!
|
||||
//! Wraps a circular buffer with a synchronous mutex for fast, blocking access.
|
||||
|
||||
use crate::circular_buffer::CircularBuffer;
|
||||
use crate::log_message::LogMessage;
|
||||
use crate::{circular_buffer::CircularBuffer, log_message::LogMessage};
|
||||
use std::sync::Mutex;
|
||||
|
||||
/// A thread-safe circular buffer for log messages.
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
use super::log_buffer::LogBuffer;
|
||||
use super::route::{Destination, Limit, Route};
|
||||
use super::{LimitResult, Limiter, LimiterSet, SignalAlertMessage, Summary};
|
||||
use super::{
|
||||
LimitResult, Limiter, LimiterSet, SignalAlertMessage, Summary,
|
||||
log_buffer::LogBuffer,
|
||||
route::{Destination, Limit, Route},
|
||||
};
|
||||
use crate::{
|
||||
concurrent_map::ConcurrentMap,
|
||||
log_format::LogFormatConfig,
|
||||
|
||||
@@ -20,8 +20,7 @@ use http::{Method, Request, Response, StatusCode};
|
||||
use http_body::Body;
|
||||
use http_body_util::BodyExt;
|
||||
use prometheus_http_client::{AlertStatus, ExtractLabels};
|
||||
use std::time::Duration;
|
||||
use std::{collections::HashMap, fmt::Write, net::SocketAddr, path::PathBuf};
|
||||
use std::{collections::HashMap, fmt::Write, net::SocketAddr, path::PathBuf, time::Duration};
|
||||
use tokio::{
|
||||
join,
|
||||
sync::{
|
||||
@@ -29,8 +28,7 @@ use tokio::{
|
||||
mpsc::{UnboundedReceiver, UnboundedSender, unbounded_channel},
|
||||
},
|
||||
};
|
||||
use tokio_util::bytes::Buf;
|
||||
use tokio_util::sync::CancellationToken;
|
||||
use tokio_util::{bytes::Buf, sync::CancellationToken};
|
||||
use tracing::{debug, error, info, warn};
|
||||
|
||||
mod log_buffer;
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
//! Rate limiter set for managing per-route rate limiting.
|
||||
|
||||
use crate::log_message::{LogMessage, Origin};
|
||||
use crate::rate_limiter::Limiter;
|
||||
use crate::{
|
||||
log_message::{LogMessage, Origin},
|
||||
rate_limiter::Limiter,
|
||||
};
|
||||
use std::collections::HashMap;
|
||||
|
||||
/// Result of evaluating a limiter set.
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
//! and destination overrides.
|
||||
|
||||
use super::rate_limiter_set::LimiterSet;
|
||||
use crate::log_message::{Level, LogFilter};
|
||||
use crate::rate_limiter::{Limiter, RateThreshold};
|
||||
use crate::{
|
||||
log_message::{Level, LogFilter},
|
||||
rate_limiter::{Limiter, RateThreshold},
|
||||
};
|
||||
use serde::Deserialize;
|
||||
|
||||
/// A rate limit rule for suppressing repeated alerts.
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
//! This copied from https://github.com/AsamK/signal-cli/blob/f9a36c6e0404d06bd396b24b5ea699e49ed29b89/client/src/jsonrpc.rs
|
||||
#![allow(clippy::too_many_arguments)]
|
||||
|
||||
use jsonrpsee::async_client::ClientBuilder;
|
||||
use jsonrpsee::core::client::SubscriptionClientT;
|
||||
use jsonrpsee::proc_macros::rpc;
|
||||
use jsonrpsee::{async_client::ClientBuilder, core::client::SubscriptionClientT, proc_macros::rpc};
|
||||
use serde::Deserialize;
|
||||
use serde_json::Value;
|
||||
use tokio::net::ToSocketAddrs;
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
use std::io::Error;
|
||||
use std::path::Path;
|
||||
use std::{io::Error, path::Path};
|
||||
|
||||
use futures_util::stream::StreamExt;
|
||||
use jsonrpsee::core::client::{TransportReceiverT, TransportSenderT};
|
||||
use tokio::net::UnixStream;
|
||||
use tokio_util::codec::Decoder;
|
||||
|
||||
use super::stream_codec::StreamCodec;
|
||||
use super::{Receiver, Sender};
|
||||
use super::{Receiver, Sender, stream_codec::StreamCodec};
|
||||
|
||||
/// Connect to a JSON-RPC server via Unix domain socket.
|
||||
pub async fn connect(
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
//! This copied from https://github.com/AsamK/signal-cli/blob/f9a36c6e0404d06bd396b24b5ea699e49ed29b89/client/src/jsonrpc.rs
|
||||
|
||||
use std::{io, str};
|
||||
use tokio_util::bytes::BytesMut;
|
||||
use tokio_util::codec::{Decoder, Encoder};
|
||||
use tokio_util::{
|
||||
bytes::BytesMut,
|
||||
codec::{Decoder, Encoder},
|
||||
};
|
||||
|
||||
type Separator = u8;
|
||||
|
||||
|
||||
@@ -5,8 +5,7 @@ use jsonrpsee::core::client::{TransportReceiverT, TransportSenderT};
|
||||
use tokio::net::{TcpStream, ToSocketAddrs};
|
||||
use tokio_util::codec::Decoder;
|
||||
|
||||
use super::stream_codec::StreamCodec;
|
||||
use super::{Receiver, Sender};
|
||||
use super::{Receiver, Sender, stream_codec::StreamCodec};
|
||||
|
||||
/// Connect to a JSON-RPC TCP server.
|
||||
pub async fn connect(
|
||||
|
||||
Reference in New Issue
Block a user