输出增加颜色

This commit is contained in:
lubeilin
2024-03-07 12:25:52 +08:00
parent ae63ce80b5
commit 97b6db3485
3 changed files with 9 additions and 5 deletions
+5 -3
View File
@@ -1,5 +1,7 @@
use std::process;
use console::style;
use vnt::handle::callback::ConnectInfo;
use vnt::{DeviceInfo, ErrorInfo, HandshakeInfo, RegisterInfo, VntCallback};
@@ -8,7 +10,7 @@ pub struct VntHandler {}
impl VntCallback for VntHandler {
fn success(&self) {
println!(" ====== Connect Successfully ====== ")
println!(" {} ", style("====== Connect Successfully ======").green())
}
fn create_tun(&self, info: DeviceInfo) {
println!("create_tun {}", info)
@@ -24,12 +26,12 @@ impl VntCallback for VntHandler {
}
fn register(&self, info: RegisterInfo) -> bool {
println!("register {}", info);
println!("register {}", style(info).green());
true
}
fn error(&self, info: ErrorInfo) {
println!("error {}", info);
println!("{}", style(format!("error {}", info)).red());
}
fn stop(&self) {