[mio] 适配新版vnt

This commit is contained in:
lubeilin
2024-02-29 22:29:14 +08:00
parent e3e2a262e4
commit ceadadee68
9 changed files with 195 additions and 249 deletions
+36
View File
@@ -0,0 +1,36 @@
use std::process;
use vnt::handle::callback::ConnectInfo;
use vnt::{DeviceInfo, ErrorInfo, HandshakeInfo, RegisterInfo, VntCallback};
#[derive(Clone)]
pub struct VntHandler {}
impl VntCallback for VntHandler {
fn create_tun(&self, info: DeviceInfo) {
println!("create_tun {}", info)
}
fn connect(&self, info: ConnectInfo) {
println!("connect {}", info)
}
fn handshake(&self, info: HandshakeInfo) -> bool {
println!("handshake {}", info);
true
}
fn register(&self, info: RegisterInfo) -> bool {
println!("register {}", info);
true
}
fn error(&self, info: ErrorInfo) {
println!("error {}", info);
}
fn stop(&self) {
println!("stopped");
process::exit(0)
}
}