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 clio::Output;
|
||||||
use color_eyre::eyre::Context;
|
use color_eyre::eyre::Context;
|
||||||
use rand::rngs::OsRng;
|
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
|
/// Simple program to generate a new private key in the correct format
|
||||||
#[derive(Debug, Parser)]
|
#[derive(Debug, Parser)]
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use std::sync::LazyLock;
|
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 {
|
pub fn get_animal_name() -> &'static str {
|
||||||
static ANIMALS: LazyLock<Vec<&'static str>> = LazyLock::new(|| {
|
static ANIMALS: LazyLock<Vec<&'static str>> = LazyLock::new(|| {
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
use std::{
|
use std::pin::Pin;
|
||||||
pin::Pin,
|
use std::sync::Arc;
|
||||||
sync::Arc,
|
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||||
task::{Context, Poll},
|
use std::task::{Context, Poll};
|
||||||
};
|
|
||||||
|
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
use russh::{ChannelStream, server::Msg};
|
use russh::ChannelStream;
|
||||||
|
use russh::server::Msg;
|
||||||
|
|
||||||
use crate::helper::Unit;
|
use crate::helper::Unit;
|
||||||
|
|
||||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default)]
|
||||||
pub struct Stats {
|
pub struct Stats {
|
||||||
connections: AtomicUsize,
|
connections: AtomicUsize,
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
use crossterm::{
|
use crossterm::execute;
|
||||||
execute,
|
use crossterm::terminal::{EnterAlternateScreen, LeaveAlternateScreen};
|
||||||
terminal::{EnterAlternateScreen, LeaveAlternateScreen},
|
use russh::ChannelId;
|
||||||
};
|
use russh::server::Handle;
|
||||||
use russh::{ChannelId, server::Handle};
|
|
||||||
use tokio::sync::mpsc::{UnboundedSender, unbounded_channel};
|
use tokio::sync::mpsc::{UnboundedSender, unbounded_channel};
|
||||||
use tracing::error;
|
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 color_eyre::eyre::Context;
|
||||||
use dotenvy::dotenv;
|
use dotenvy::dotenv;
|
||||||
|
@ -7,13 +8,13 @@ use hyper_util::rt::TokioIo;
|
||||||
use rand::rngs::OsRng;
|
use rand::rngs::OsRng;
|
||||||
use tokio::net::TcpListener;
|
use tokio::net::TcpListener;
|
||||||
use tracing::{error, info, warn};
|
use tracing::{error, info, warn};
|
||||||
use tracing_subscriber::{EnvFilter, layer::SubscriberExt, util::SubscriberInitExt};
|
use tracing_subscriber::EnvFilter;
|
||||||
use tunnel_rs::{
|
use tracing_subscriber::layer::SubscriberExt;
|
||||||
ldap::Ldap,
|
use tracing_subscriber::util::SubscriberInitExt;
|
||||||
ssh::Server,
|
use tunnel_rs::ldap::Ldap;
|
||||||
tunnel::Registry,
|
use tunnel_rs::ssh::Server;
|
||||||
web::{ForwardAuth, Service},
|
use tunnel_rs::tunnel::Registry;
|
||||||
};
|
use tunnel_rs::web::{ForwardAuth, Service};
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> color_eyre::Result<()> {
|
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 clap::Parser;
|
||||||
use ratatui::{Terminal, TerminalOptions, Viewport, layout::Rect, prelude::CrosstermBackend};
|
use ratatui::layout::Rect;
|
||||||
use russh::{
|
use ratatui::prelude::CrosstermBackend;
|
||||||
ChannelId,
|
use ratatui::{Terminal, TerminalOptions, Viewport};
|
||||||
keys::ssh_key::PublicKey,
|
use russh::ChannelId;
|
||||||
server::{Auth, Msg, Session},
|
use russh::keys::ssh_key::PublicKey;
|
||||||
};
|
use russh::server::{Auth, Msg, Session};
|
||||||
use tracing::{debug, trace, warn};
|
use tracing::{debug, trace, warn};
|
||||||
|
|
||||||
use crate::{
|
use crate::io::{Input, TerminalHandle};
|
||||||
io::{Input, TerminalHandle},
|
use crate::ldap::{Ldap, LdapError};
|
||||||
ldap::{Ldap, LdapError},
|
use crate::tunnel::{Registry, Tunnel, TunnelAccess};
|
||||||
tunnel::{Registry, Tunnel, TunnelAccess},
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Quickly create http tunnels for development
|
/// Quickly create http tunnels for development
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
|
|
|
@ -1,15 +1,20 @@
|
||||||
mod handler;
|
mod handler;
|
||||||
mod renderer;
|
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 tokio::net::ToSocketAddrs;
|
||||||
use tracing::{debug, warn};
|
use tracing::{debug, warn};
|
||||||
|
|
||||||
use crate::{ldap::Ldap, tunnel::Registry};
|
use crate::ldap::Ldap;
|
||||||
use handler::Handler;
|
use crate::tunnel::Registry;
|
||||||
use renderer::Renderer;
|
|
||||||
|
|
||||||
pub struct Server {
|
pub struct Server {
|
||||||
ldap: Ldap,
|
ldap: Ldap,
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
use std::cmp::{self, max};
|
use std::cmp::{self, max};
|
||||||
|
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use ratatui::{
|
use ratatui::Frame;
|
||||||
Frame,
|
use ratatui::layout::{Constraint, Flex, Layout, Position, Rect};
|
||||||
layout::{Constraint, Flex, Layout, Position, Rect},
|
use ratatui::style::{Style, Stylize as _};
|
||||||
style::{Style, Stylize as _},
|
use ratatui::text::{Line, Span, Text};
|
||||||
text::{Line, Span, Text},
|
use ratatui::widgets::{
|
||||||
widgets::{
|
Block, BorderType, Cell, Clear, HighlightSpacing, Paragraph, Row, Table, TableState,
|
||||||
Block, BorderType, Cell, Clear, HighlightSpacing, Paragraph, Row, Table, TableState,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
use unicode_width::UnicodeWidthStr;
|
use unicode_width::UnicodeWidthStr;
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
mod registry;
|
mod registry;
|
||||||
mod tui;
|
mod tui;
|
||||||
|
|
||||||
use registry::RegistryEntry;
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use tracing::trace;
|
|
||||||
|
|
||||||
use russh::server::Handle;
|
|
||||||
use tokio::sync::{RwLock, RwLockReadGuard};
|
|
||||||
|
|
||||||
pub use registry::Registry;
|
pub use registry::Registry;
|
||||||
|
use registry::RegistryEntry;
|
||||||
|
use russh::server::Handle;
|
||||||
|
use tokio::sync::{RwLock, RwLockReadGuard};
|
||||||
|
use tracing::trace;
|
||||||
|
|
||||||
use crate::io::{Stats, TrackStats};
|
use crate::io::{Stats, TrackStats};
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
use std::{
|
use std::collections::HashMap;
|
||||||
collections::{HashMap, hash_map::Entry},
|
use std::collections::hash_map::Entry;
|
||||||
sync::Arc,
|
use std::sync::Arc;
|
||||||
};
|
|
||||||
|
|
||||||
use tokio::sync::RwLock;
|
use tokio::sync::RwLock;
|
||||||
use tracing::trace;
|
use tracing::trace;
|
||||||
|
|
||||||
use crate::{helper::get_animal_name, tunnel::Tunnel};
|
|
||||||
|
|
||||||
use super::TunnelInner;
|
use super::TunnelInner;
|
||||||
|
use crate::helper::get_animal_name;
|
||||||
|
use crate::tunnel::Tunnel;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(crate) struct RegistryEntry {
|
pub(crate) struct RegistryEntry {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
use hyper::{
|
use hyper::header::{self, HeaderName, HeaderValue, ToStrError};
|
||||||
HeaderMap, Method, StatusCode,
|
use hyper::{HeaderMap, Method, StatusCode};
|
||||||
header::{self, HeaderName, HeaderValue, ToStrError},
|
|
||||||
};
|
|
||||||
use reqwest::redirect::Policy;
|
use reqwest::redirect::Policy;
|
||||||
use tracing::{debug, error};
|
use tracing::{debug, error};
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,22 @@
|
||||||
mod auth;
|
mod auth;
|
||||||
mod response;
|
mod response;
|
||||||
|
|
||||||
use crate::tunnel::Registry;
|
use std::ops::Deref;
|
||||||
use std::{ops::Deref, pin::Pin};
|
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;
|
use auth::AuthStatus;
|
||||||
pub use auth::ForwardAuth;
|
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 response::response;
|
||||||
|
use tracing::{debug, error, trace, warn};
|
||||||
|
|
||||||
|
use crate::tunnel::{Registry, TunnelAccess};
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Service {
|
pub struct Service {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
use bytes::Bytes;
|
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};
|
use hyper::{Response, StatusCode};
|
||||||
|
|
||||||
pub fn response(
|
pub fn response(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user