Skip to content

Commit

Permalink
remove unused dependencies
Browse files Browse the repository at this point in the history
reorganize use statements
  • Loading branch information
Keksoj committed Sep 13, 2023
1 parent 79b4b93 commit c25d483
Show file tree
Hide file tree
Showing 25 changed files with 71 additions and 173 deletions.
72 changes: 0 additions & 72 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions bin/src/command/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@ use anyhow::{bail, Context};
use async_dup::Arc;
use async_io::Async;
use futures::{
channel::{mpsc::*, oneshot},
channel::{
mpsc::{channel, Receiver, Sender},
oneshot,
},
{SinkExt, StreamExt},
};
use futures_lite::{future, io::*};
use futures_lite::{
future,
io::{AsyncBufReadExt, AsyncWriteExt, BufReader},
};
use nix::{
sys::signal::{kill, Signal},
unistd::Pid,
Expand Down
2 changes: 1 addition & 1 deletion bin/src/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use anyhow::{bail, Context};
use futures_lite::future;
use libc::{self, pid_t};
use mio::net::UnixStream;
use nix::unistd::*;
use nix::unistd::{fork, ForkResult};
use serde::{Deserialize, Serialize};

use tempfile::tempfile;
Expand Down
5 changes: 2 additions & 3 deletions command/src/proto/display.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use std::fmt::{Display, Formatter};

use crate::proto::command::TlsVersion;

use super::command::{
use crate::proto::command::{
request::RequestType, CertificateAndKey, CertificateSummary, QueryCertificatesFilters,
TlsVersion,
};

impl Display for CertificateAndKey {
Expand Down
1 change: 0 additions & 1 deletion e2e/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ edition = "2021"

[dependencies]
futures = "^0.3.28"
futures-lite = "^1.13.0"
hyper = { version = "^0.14.27", features = ["client", "http1"] }
hyper-rustls = { version = "^0.24.1", default-features = false, features = ["webpki-tokio", "http1", "tls12", "logging"] }
libc = "^0.2.147"
Expand Down
9 changes: 1 addition & 8 deletions lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,42 +30,35 @@ include = [
[dependencies]
anyhow = "^1.0.72"
cookie-factory = "^0.3.2"
foreign-types-shared = "^0.3.1"
hdrhistogram = "^7.5.2"
hex = "^0.4.3"
hpack = "^0.3.0"
idna = "^0.4.0"
kawa = { version = "^0.6.3", default-features = false }
lazycell = "^1.3.0"
libc = "^0.2.147"
log = "^0.4.19"
memchr = "^2.5.0"
mio = { version = "^0.8.8", features = ["os-poll", "os-ext", "net"] }
nom = { version = "^7.1.3", default-features = true, features = ["std"] }
pool = "^0.1.4"
poule = "^0.3.2"
rand = "^0.8.5"
regex = "^1.9.3"
rustls = "^0.21.6"
rustls-pemfile = "^1.0.3"
rusty_ulid = "^2.0.0"
serial_test = "^2.0.0"
sha2 = "^0.10.7"
slab = "^0.4.8"
socket2 = { version = "^0.5.3", features = ["all"] }
thiserror = "^1.0.44"
time = "^0.3.25"
url = "^2.4.0"
webpki = "^0.22.0"
x509-parser = "^0.15.1"

sozu-command-lib = { path = "../command", version = "^0.15.3" }

[dev-dependencies]
quickcheck = "^1.0.3"
rand = "^0.8.5"
serial_test = "^2.0.0"
tiny_http = "^0.12.0"
ureq = "^2.7.1"

[features]
default = ["simd"]
Expand Down
5 changes: 2 additions & 3 deletions lib/src/backends.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
use std::{cell::RefCell, collections::HashMap, net::SocketAddr, rc::Rc};

use mio::net::TcpStream;
use time::Duration;

use sozu_command::{
proto::command::{Event, EventKind, LoadBalancingAlgorithms, LoadBalancingParams, LoadMetric},
state::ClusterId,
};
use time::Duration;

use crate::{
load_balancing::{LeastLoaded, LoadBalancingAlgorithm, PowerOfTwo, Random, RoundRobin},
retry::{self, RetryPolicy},
server::{self, push_event},
PeakEWMA,
};

use super::load_balancing::*;

#[derive(thiserror::Error, Debug)]
pub enum BackendError {
#[error("No backend found for cluster {0}")]
Expand Down
16 changes: 1 addition & 15 deletions lib/src/buffer_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ use std::{
str,
};

use crate::{
pool::{Checkout, Pool},
pool_crate::Reset,
};
use crate::pool::{Checkout, Pool};

#[derive(Debug, PartialEq, Eq, Clone)]
pub enum InputElement {
Expand Down Expand Up @@ -483,17 +480,6 @@ impl Write for BufferQueue {
}
}

impl Reset for BufferQueue {
fn reset(&mut self) {
self.parsed_position = 0;
self.buffer_position = 0;
self.start_parsing_position = 0;
self.buffer.reset();
self.input_queue.clear();
self.output_queue.clear();
}
}

impl fmt::Debug for BufferQueue {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
//let b: &Buffer = &self.buffer;
Expand Down
22 changes: 12 additions & 10 deletions lib/src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ use std::{
};

use anyhow::Context;
use mio::{net::*, unix::SourceFd, *};
use mio::{
net::{TcpListener, TcpStream, UnixStream},
unix::SourceFd,
Interest, Poll, Registry, Token,
};
use rusty_ulid::Ulid;
use slab::Slab;
use time::{Duration, Instant};
Expand All @@ -28,12 +32,6 @@ use sozu_command::{
};

use crate::{
protocol::SessionState, router::Router, timer::TimeoutContainer, util::UnwrapLog, CachedTags,
FrontendFromRequestError, L7ListenerHandler, L7Proxy, ListenerError, ListenerHandler,
ProxyError, SessionIsToBeClosed, SessionResult, StateMachineBuilder,
};

use super::{
backends::BackendMap,
pool::Pool,
protocol::{
Expand All @@ -42,12 +40,16 @@ use super::{
parser::{hostname_and_port, Method},
},
proxy_protocol::expect::ExpectProxyProtocol,
{Http, Pipe},
Http, Pipe, SessionState,
},
router::Route,
router::{Route, Router},
server::{ListenSession, ListenToken, ProxyChannel, Server, SessionManager},
socket::server_bind,
AcceptError, Protocol, ProxyConfiguration, ProxySession, SessionMetrics, StateResult,
timer::TimeoutContainer,
util::UnwrapLog,
AcceptError, CachedTags, FrontendFromRequestError, L7ListenerHandler, L7Proxy, ListenerError,
ListenerHandler, Protocol, ProxyConfiguration, ProxyError, ProxySession, SessionIsToBeClosed,
SessionMetrics, SessionResult, StateMachineBuilder, StateResult,
};

#[derive(PartialEq, Eq)]
Expand Down
38 changes: 9 additions & 29 deletions lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,32 +324,11 @@
//! }
//! ```

extern crate hdrhistogram;
extern crate libc;
extern crate log;
extern crate mio;
extern crate nom;
extern crate pool as pool_crate;
extern crate rand;
extern crate rustls;
extern crate rusty_ulid;
extern crate slab;
extern crate socket2;
extern crate time;
extern crate url;
#[macro_use]
extern crate sozu_command_lib as sozu_command;
extern crate cookie_factory;
extern crate hpack;
extern crate idna;
extern crate lazycell;
extern crate poule;
extern crate regex;
extern crate webpki;
#[cfg(test)]
#[macro_use]
extern crate quickcheck;
extern crate foreign_types_shared;

#[macro_use]
pub mod util;
Expand Down Expand Up @@ -392,18 +371,19 @@ use backends::BackendError;
use mio::{net::TcpStream, Interest, Token};
use protocol::http::parser::Method;
use router::RouterError;
use time::{Duration, Instant};
use tls::GenericCertificateResolverError;

use sozu_command::{
proto::command::{ListenerType, RequestHttpFrontend},
ObjectKind,
};
use sozu_command_lib::{
proto::command::Cluster, ready::Ready, request::WorkerRequest, response::WorkerResponse,
proto::command::{Cluster, ListenerType, RequestHttpFrontend},
ready::Ready,
request::WorkerRequest,
response::WorkerResponse,
state::ClusterId,
ObjectKind,
};
use time::{Duration, Instant};
use tls::GenericCertificateResolverError;

use self::{backends::BackendMap, router::Route};
use crate::{backends::BackendMap, router::Route};

/// Anything that can be registered in mio (subscribe to kernel events)
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
Expand Down

0 comments on commit c25d483

Please sign in to comment.