优化代码结构

This commit is contained in:
lbl8603
2024-06-09 00:11:33 +08:00
parent 8294e46003
commit 16278dae62
4 changed files with 11 additions and 17 deletions
+3 -2
View File
@@ -2,8 +2,9 @@ use std::process;
use console::style; use console::style;
use vnt::handle::callback::{ConnectInfo, ErrorType}; use vnt::{
use vnt::{DeviceInfo, ErrorInfo, HandshakeInfo, RegisterInfo, VntCallback}; ConnectInfo, DeviceInfo, ErrorInfo, ErrorType, HandshakeInfo, RegisterInfo, VntCallback,
};
#[derive(Clone)] #[derive(Clone)]
pub struct VntHandler {} pub struct VntHandler {}
+2 -2
View File
@@ -138,7 +138,7 @@ impl RouteKey {
} }
} }
pub fn init_context( pub(crate) fn init_context(
ports: Vec<u16>, ports: Vec<u16>,
use_channel_type: UseChannelType, use_channel_type: UseChannelType,
first_latency: bool, first_latency: bool,
@@ -233,7 +233,7 @@ pub fn init_context(
Ok((context, tcp_listener)) Ok((context, tcp_listener))
} }
pub fn init_channel<H>( pub(crate) fn init_channel<H>(
tcp_listener: mio::net::TcpListener, tcp_listener: mio::net::TcpListener,
context: ChannelContext, context: ChannelContext,
stop_manager: StopManager, stop_manager: StopManager,
-7
View File
@@ -19,13 +19,6 @@ use crate::proto::message::SecretHandshakeRequest;
use crate::protocol::body::RSA_ENCRYPTION_RESERVED; use crate::protocol::body::RSA_ENCRYPTION_RESERVED;
use crate::protocol::{service_packet, NetPacket, Protocol, MAX_TTL}; use crate::protocol::{service_packet, NetPacket, Protocol, MAX_TTL};
pub enum HandshakeEnum {
NotSecret,
KeyError,
Timeout,
ServerError(String),
Other(String),
}
#[derive(Clone)] #[derive(Clone)]
pub struct Handshake { pub struct Handshake {
time: Arc<AtomicCell<Instant>>, time: Arc<AtomicCell<Instant>>,
+6 -6
View File
@@ -3,16 +3,16 @@ pub const VNT_VERSION: &'static str = env!("CARGO_PKG_VERSION");
pub mod channel; pub mod channel;
pub mod cipher; pub mod cipher;
pub mod core; pub mod core;
pub mod external_route; mod external_route;
pub mod handle; mod handle;
#[cfg(feature = "ip_proxy")] #[cfg(feature = "ip_proxy")]
pub mod ip_proxy; mod ip_proxy;
pub mod nat; pub mod nat;
#[cfg(feature = "port_mapping")] #[cfg(feature = "port_mapping")]
pub mod port_mapping; mod port_mapping;
pub mod proto; mod proto;
pub mod protocol; pub mod protocol;
pub mod tun_tap_device; mod tun_tap_device;
pub mod util; pub mod util;
pub use handle::callback::*; pub use handle::callback::*;