Reformat imports properly
All checks were successful
Build and deploy / Build container and manifests (push) Successful in 5m43s
All checks were successful
Build and deploy / Build container and manifests (push) Successful in 5m43s
This commit is contained in:
parent
19ec3714a6
commit
e21c9fd428
2
.rustfmt.toml
Normal file
2
.rustfmt.toml
Normal file
|
@ -0,0 +1,2 @@
|
|||
imports_granularity = "Module"
|
||||
group_imports = "StdExternalCrate"
|
|
@ -2,7 +2,8 @@ use clap::Parser;
|
|||
use clio::Output;
|
||||
use color_eyre::eyre::Context;
|
||||
use rand::rngs::OsRng;
|
||||
use russh::keys::ssh_key::{LineEnding, sec1::der::Writer};
|
||||
use russh::keys::ssh_key::LineEnding;
|
||||
use russh::keys::ssh_key::sec1::der::Writer;
|
||||
|
||||
/// Simple program to generate a new private key in the correct format
|
||||
#[derive(Debug, Parser)]
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use std::sync::LazyLock;
|
||||
|
||||
use rand::{rngs::OsRng, seq::SliceRandom};
|
||||
use rand::rngs::OsRng;
|
||||
use rand::seq::SliceRandom;
|
||||
|
||||
pub fn get_animal_name() -> &'static str {
|
||||
static ANIMALS: LazyLock<Vec<&'static str>> = LazyLock::new(|| {
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
use std::{
|
||||
pin::Pin,
|
||||
sync::Arc,
|
||||
task::{Context, Poll},
|
||||
};
|
||||
use std::pin::Pin;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::task::{Context, Poll};
|
||||
|
||||
use pin_project_lite::pin_project;
|
||||
use russh::{ChannelStream, server::Msg};
|
||||
use russh::ChannelStream;
|
||||
use russh::server::Msg;
|
||||
|
||||
use crate::helper::Unit;
|
||||
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub struct Stats {
|
||||
connections: AtomicUsize,
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
use crossterm::{
|
||||
execute,
|
||||
terminal::{EnterAlternateScreen, LeaveAlternateScreen},
|
||||
};
|
||||
use russh::{ChannelId, server::Handle};
|
||||
use crossterm::execute;
|
||||
use crossterm::terminal::{EnterAlternateScreen, LeaveAlternateScreen};
|
||||
use russh::ChannelId;
|
||||
use russh::server::Handle;
|
||||
use tokio::sync::mpsc::{UnboundedSender, unbounded_channel};
|
||||
use tracing::error;
|
||||
|
||||
|
|
17
src/main.rs
17
src/main.rs
|
@ -1,4 +1,5 @@
|
|||
use std::{net::SocketAddr, path::Path};
|
||||
use std::net::SocketAddr;
|
||||
use std::path::Path;
|
||||
|
||||
use color_eyre::eyre::Context;
|
||||
use dotenvy::dotenv;
|
||||
|
@ -7,13 +8,13 @@ use hyper_util::rt::TokioIo;
|
|||
use rand::rngs::OsRng;
|
||||
use tokio::net::TcpListener;
|
||||
use tracing::{error, info, warn};
|
||||
use tracing_subscriber::{EnvFilter, layer::SubscriberExt, util::SubscriberInitExt};
|
||||
use tunnel_rs::{
|
||||
ldap::Ldap,
|
||||
ssh::Server,
|
||||
tunnel::Registry,
|
||||
web::{ForwardAuth, Service},
|
||||
};
|
||||
use tracing_subscriber::EnvFilter;
|
||||
use tracing_subscriber::layer::SubscriberExt;
|
||||
use tracing_subscriber::util::SubscriberInitExt;
|
||||
use tunnel_rs::ldap::Ldap;
|
||||
use tunnel_rs::ssh::Server;
|
||||
use tunnel_rs::tunnel::Registry;
|
||||
use tunnel_rs::web::{ForwardAuth, Service};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> color_eyre::Result<()> {
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
use std::{cmp::min, io::Write, iter::once};
|
||||
use std::cmp::min;
|
||||
use std::io::Write;
|
||||
use std::iter::once;
|
||||
|
||||
use clap::Parser;
|
||||
use ratatui::{Terminal, TerminalOptions, Viewport, layout::Rect, prelude::CrosstermBackend};
|
||||
use russh::{
|
||||
ChannelId,
|
||||
keys::ssh_key::PublicKey,
|
||||
server::{Auth, Msg, Session},
|
||||
};
|
||||
use ratatui::layout::Rect;
|
||||
use ratatui::prelude::CrosstermBackend;
|
||||
use ratatui::{Terminal, TerminalOptions, Viewport};
|
||||
use russh::ChannelId;
|
||||
use russh::keys::ssh_key::PublicKey;
|
||||
use russh::server::{Auth, Msg, Session};
|
||||
use tracing::{debug, trace, warn};
|
||||
|
||||
use crate::{
|
||||
io::{Input, TerminalHandle},
|
||||
ldap::{Ldap, LdapError},
|
||||
tunnel::{Registry, Tunnel, TunnelAccess},
|
||||
};
|
||||
use crate::io::{Input, TerminalHandle};
|
||||
use crate::ldap::{Ldap, LdapError};
|
||||
use crate::tunnel::{Registry, Tunnel, TunnelAccess};
|
||||
|
||||
/// Quickly create http tunnels for development
|
||||
#[derive(Parser, Debug)]
|
||||
|
|
|
@ -1,15 +1,20 @@
|
|||
mod handler;
|
||||
mod renderer;
|
||||
|
||||
use std::{net::SocketAddr, sync::Arc, time::Duration};
|
||||
use std::net::SocketAddr;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
use russh::{MethodKind, keys::PrivateKey, server::Server as _};
|
||||
use handler::Handler;
|
||||
use renderer::Renderer;
|
||||
use russh::MethodKind;
|
||||
use russh::keys::PrivateKey;
|
||||
use russh::server::Server as _;
|
||||
use tokio::net::ToSocketAddrs;
|
||||
use tracing::{debug, warn};
|
||||
|
||||
use crate::{ldap::Ldap, tunnel::Registry};
|
||||
use handler::Handler;
|
||||
use renderer::Renderer;
|
||||
use crate::ldap::Ldap;
|
||||
use crate::tunnel::Registry;
|
||||
|
||||
pub struct Server {
|
||||
ldap: Ldap,
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
use std::cmp::{self, max};
|
||||
|
||||
use futures::StreamExt;
|
||||
use ratatui::{
|
||||
Frame,
|
||||
layout::{Constraint, Flex, Layout, Position, Rect},
|
||||
style::{Style, Stylize as _},
|
||||
text::{Line, Span, Text},
|
||||
widgets::{
|
||||
Block, BorderType, Cell, Clear, HighlightSpacing, Paragraph, Row, Table, TableState,
|
||||
},
|
||||
use ratatui::Frame;
|
||||
use ratatui::layout::{Constraint, Flex, Layout, Position, Rect};
|
||||
use ratatui::style::{Style, Stylize as _};
|
||||
use ratatui::text::{Line, Span, Text};
|
||||
use ratatui::widgets::{
|
||||
Block, BorderType, Cell, Clear, HighlightSpacing, Paragraph, Row, Table, TableState,
|
||||
};
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
mod registry;
|
||||
mod tui;
|
||||
|
||||
use registry::RegistryEntry;
|
||||
use std::sync::Arc;
|
||||
use tracing::trace;
|
||||
|
||||
use russh::server::Handle;
|
||||
use tokio::sync::{RwLock, RwLockReadGuard};
|
||||
|
||||
pub use registry::Registry;
|
||||
use registry::RegistryEntry;
|
||||
use russh::server::Handle;
|
||||
use tokio::sync::{RwLock, RwLockReadGuard};
|
||||
use tracing::trace;
|
||||
|
||||
use crate::io::{Stats, TrackStats};
|
||||
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
use std::{
|
||||
collections::{HashMap, hash_map::Entry},
|
||||
sync::Arc,
|
||||
};
|
||||
use std::collections::HashMap;
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::sync::Arc;
|
||||
|
||||
use tokio::sync::RwLock;
|
||||
use tracing::trace;
|
||||
|
||||
use crate::{helper::get_animal_name, tunnel::Tunnel};
|
||||
|
||||
use super::TunnelInner;
|
||||
use crate::helper::get_animal_name;
|
||||
use crate::tunnel::Tunnel;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct RegistryEntry {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
use hyper::{
|
||||
HeaderMap, Method, StatusCode,
|
||||
header::{self, HeaderName, HeaderValue, ToStrError},
|
||||
};
|
||||
use hyper::header::{self, HeaderName, HeaderValue, ToStrError};
|
||||
use hyper::{HeaderMap, Method, StatusCode};
|
||||
use reqwest::redirect::Policy;
|
||||
use tracing::{debug, error};
|
||||
|
||||
|
|
|
@ -1,23 +1,22 @@
|
|||
mod auth;
|
||||
mod response;
|
||||
|
||||
use crate::tunnel::Registry;
|
||||
use std::{ops::Deref, pin::Pin};
|
||||
use std::ops::Deref;
|
||||
use std::pin::Pin;
|
||||
|
||||
use bytes::Bytes;
|
||||
use http_body_util::{BodyExt as _, Empty, combinators::BoxBody};
|
||||
use hyper::{
|
||||
Request, Response, StatusCode,
|
||||
body::Incoming,
|
||||
client::conn::http1::Builder,
|
||||
header::{self, HOST},
|
||||
};
|
||||
use tracing::{debug, error, trace, warn};
|
||||
|
||||
use crate::tunnel::TunnelAccess;
|
||||
use auth::AuthStatus;
|
||||
pub use auth::ForwardAuth;
|
||||
use bytes::Bytes;
|
||||
use http_body_util::combinators::BoxBody;
|
||||
use http_body_util::{BodyExt as _, Empty};
|
||||
use hyper::body::Incoming;
|
||||
use hyper::client::conn::http1::Builder;
|
||||
use hyper::header::{self, HOST};
|
||||
use hyper::{Request, Response, StatusCode};
|
||||
use response::response;
|
||||
use tracing::{debug, error, trace, warn};
|
||||
|
||||
use crate::tunnel::{Registry, TunnelAccess};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Service {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use bytes::Bytes;
|
||||
use http_body_util::{BodyExt as _, Full, combinators::BoxBody};
|
||||
use http_body_util::combinators::BoxBody;
|
||||
use http_body_util::{BodyExt as _, Full};
|
||||
use hyper::{Response, StatusCode};
|
||||
|
||||
pub fn response(
|
||||
|
|
Loading…
Reference in New Issue
Block a user