Skip to content

Commit

Permalink
Refolder #2
Browse files Browse the repository at this point in the history
  • Loading branch information
HsuJv committed Nov 8, 2022
1 parent 7faea55 commit ddf0d33
Show file tree
Hide file tree
Showing 23 changed files with 27 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/algorithm/public_key/ed25519.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::algorithm::public_key::PublicKey;
use crate::data::Data;
use crate::model::Data;
use crate::SshError;
use ring::signature;

Expand Down
2 changes: 1 addition & 1 deletion src/algorithm/public_key/rsa.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::algorithm::public_key::PublicKey as PubK;
use crate::data::Data;
use crate::model::Data;
use crate::SshError;
use rsa::PublicKey;

Expand Down
2 changes: 1 addition & 1 deletion src/channel/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use super::channel_scp::ChannelScp;
use super::channel_shell::ChannelShell;
use crate::client::Client;
use crate::constant::ssh_msg_code;
use crate::data::Data;
use crate::error::{SshError, SshResult};
use crate::model::Data;
use crate::slog::log;
use crate::window_size::WindowSize;
use std::cell::RefCell;
Expand Down
2 changes: 1 addition & 1 deletion src/channel/channel_exec.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::channel::Channel;
use crate::constant::{ssh_msg_code, ssh_str};
use crate::data::Data;
use crate::error::SshResult;
use crate::model::Data;
use std::io::{Read, Write};

pub struct ChannelExec<S: Read + Write>(pub(crate) Channel<S>);
Expand Down
2 changes: 1 addition & 1 deletion src/channel/channel_scp.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::constant::{scp, ssh_msg_code, ssh_str};
use crate::data::Data;
use crate::error::{SshError, SshResult};
use crate::model::Data;
use crate::Channel;
use std::path::{Path, PathBuf};
use std::{
Expand Down
2 changes: 1 addition & 1 deletion src/channel/channel_shell.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::channel::Channel;
use crate::constant::{ssh_msg_code, ssh_str};
use crate::data::Data;
use crate::error::SshResult;
use crate::model::Data;
use std::io::{Read, Write};

pub struct ChannelShell<S: Read + Write>(pub(crate) Channel<S>);
Expand Down
1 change: 1 addition & 0 deletions src/channel/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#[allow(clippy::module_inception)]
pub mod channel;
pub mod channel_exec;
pub mod channel_scp;
Expand Down
3 changes: 1 addition & 2 deletions src/client/client_r.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ use crate::algorithm::{
};
use crate::client::Client;
use crate::constant::{size, ssh_msg_code};
use crate::data::Data;
use crate::h::H;
use crate::packet::Packet;
use crate::model::{Data, Packet};
use crate::window_size::WindowSize;
use crate::{algorithm::hash, config::version::SshVersion};
use crate::{algorithm::key_exchange::KeyExchange, config::algorithm::AlgList};
Expand Down
4 changes: 2 additions & 2 deletions src/client/client_w.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::data::Data;
use crate::packet::Packet;
use crate::model::Data;
use crate::model::Packet;
use crate::window_size::WindowSize;
use crate::{client::Client, config::version::SshVersion};
use crate::{constant, h::H, kex, SshError, SshResult};
Expand Down
1 change: 1 addition & 0 deletions src/client/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#[allow(clippy::module_inception)]
pub(crate) mod client;
pub(crate) mod client_r;
pub(crate) mod client_w;
Expand Down
2 changes: 1 addition & 1 deletion src/config/algorithm.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{
constant::algorithms as constant,
data::Data,
error::{SshError, SshResult},
model::Data,
util,
};

Expand Down
2 changes: 1 addition & 1 deletion src/config/auth.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::algorithm::hash::HashType;
use crate::data::Data;
use crate::h::H;
use crate::model::Data;
use crate::{algorithm::hash, constant::algorithms};
use crate::{SshError, SshResult};
use rsa::pkcs1::DecodeRsaPrivateKey;
Expand Down
2 changes: 1 addition & 1 deletion src/config/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use std::io::{Read, Write};

use crate::{
constant::CLIENT_VERSION,
data::Data,
error::{SshError, SshResult},
h::H,
model::Data,
};

type OurVer = String;
Expand Down
2 changes: 1 addition & 1 deletion src/h.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::data::Data;
use crate::model::Data;

/// 密钥交换产生两个值:一个共享秘密 K,以及一个交换哈希 H。加密和验证密钥来自它们。第一
/// 次密钥交换的交换哈希 H 也被用作会话标识,它是一个对该连接的唯一标识。它是验证方法中
Expand Down
2 changes: 1 addition & 1 deletion src/kex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use crate::algorithm::{
public_key::{self, PublicKey},
};
use crate::constant::ssh_msg_code;
use crate::data::Data;
use crate::error::{SshError, SshResult};
use crate::model::Data;
use crate::slog::log;
use crate::window_size::WindowSize;
use crate::{algorithm::hash, config::algorithm::AlgList};
Expand Down
3 changes: 1 addition & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,8 @@ mod channel;
mod client;
mod config;
mod constant;
mod data;
mod kex;
mod packet;
mod model;
mod session;
mod slog;
mod timeout;
Expand Down
File renamed without changes.
5 changes: 5 additions & 0 deletions src/model/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pub(crate) mod data;
pub(crate) mod packet;

pub(crate) use data::Data;
pub(crate) use packet::Packet;
2 changes: 1 addition & 1 deletion src/packet.rs → src/model/packet.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::algorithm::encryption::Encryption;
use crate::data::Data;
use crate::model::Data;

/// ## 数据包整体结构
///
Expand Down
1 change: 1 addition & 0 deletions src/session/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#[allow(clippy::module_inception)]
pub mod session;
mod session_auth;

Expand Down
2 changes: 1 addition & 1 deletion src/session/session.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::client::Client;
use crate::constant::{size, ssh_msg_code, ssh_str};
use crate::data::Data;
use crate::h::H;
use crate::kex;
use crate::model::Data;
use crate::slog::log;
use crate::window_size::WindowSize;
use crate::{algorithm::hash::HashType, config::Config};
Expand Down
2 changes: 1 addition & 1 deletion src/session/session_auth.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::constant::{ssh_msg_code, ssh_str};
use crate::data::Data;
use crate::h::H;
use crate::model::Data;
use crate::{algorithm::hash::HashType, config::auth::AuthInfo};
use crate::{Session, SshResult};
use std::io::{Read, Write};
Expand Down
2 changes: 1 addition & 1 deletion src/window_size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use std::io::{Read, Write};
use crate::client::Client;
use crate::constant::size::LOCAL_WINDOW_SIZE;
use crate::constant::ssh_msg_code;
use crate::data::Data;
use crate::error::SshResult;
use crate::model::Data;

pub struct WindowSize {
pub(crate) server_channel_no: u32,
Expand Down

0 comments on commit ddf0d33

Please sign in to comment.