Skip to content

Commit 91ec50b

Browse files
author
cht
committed
去除不必要的代码,json写法未来用serde写,oh,未来不用json了
1 parent c4a4822 commit 91ec50b

1 file changed

Lines changed: 44 additions & 44 deletions

File tree

src/spider.rs

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -450,17 +450,17 @@ impl Information {
450450
format!(
451451
"{{
452452
\"urls\":\"{}\",
453-
\"func\":{},
454-
\"add\":{},
455-
\"aid\":{},
456-
\"host\":{},
457-
\"id\":{},
458-
\"net\":{},
459-
\"path\":{},
460-
\"port\":{},
461-
\"ps\":{},
462-
\"tls\":{},
463-
\"typpe\":{}
453+
\"func\":\"{}\",
454+
\"add\":\"{}\",
455+
\"aid\":\"{}\",
456+
\"host\":\"{}\",
457+
\"id\":\"{}\",
458+
\"net\":\"{}\",
459+
\"path\":\"{}\",
460+
\"port\":\"{}\",
461+
\"ps\":\"{}\",
462+
\"tls\":\"{}\",
463+
\"typpe\":\"{}\"
464464
}},\n",
465465

466466
self.urls,
@@ -499,31 +499,31 @@ impl Information {
499499
let header2 = ascii_to_string2(base64::decode(header.as_bytes()).unwrap());
500500
// 通过分号切开两个内容
501501
let header3: Vec<&str> = header2.split(':').collect();
502-
let net = format!("\"{}\"", header3[0]);
503-
let id = format!("\"{}\"", header3[1]);
502+
let net = format!("{}", header3[0]);
503+
let id = format!("{}", header3[1]);
504504

505505
let first_temp = first[1].to_string();
506506
let second: Vec<&str> = first_temp.split('#').collect();
507507
let ps0 = urlencoding::decode(second[1]).unwrap();
508-
let ps = format!("\"{}\"", ps0);
508+
let ps = format!("{}", ps0);
509509

510510
let second_temp = second[0].to_string();
511511
let third: Vec<&str> = second_temp.split(':').collect();
512-
let add = format!("\"{}\"", third[0]);
513-
let port = format!("\"{}\"", third[1]);
512+
let add = format!("{}", third[0]);
513+
let port = format!("{}", third[1]);
514514
Information {
515515
urls: url,
516-
func: "\"ss\"".to_string(),
516+
func: "ss".to_string(),
517517
add,
518-
aid: "\"unknown\"".to_string(),
519-
host: "\"\"".to_string(),
518+
aid: "unknown".to_string(),
519+
host: "".to_string(),
520520
id,
521521
net,
522-
path: "\"unknown\"".to_string(),
522+
path: "unknown".to_string(),
523523
port,
524524
ps,
525-
tls: "\"unknown\"".to_string(),
526-
typpe: "\"unknown\"".to_string(),
525+
tls: "unknown".to_string(),
526+
typpe: "unknown".to_string(),
527527
}
528528
}
529529
Tcp::V2 => {
@@ -535,32 +535,32 @@ impl Information {
535535
Information {
536536
//company : input["add"].to_string(),
537537
urls: url,
538-
func: "\"vmess\"".to_string(),
539-
add: input["add"].to_string(),
540-
aid: input["aid"].to_string(),
541-
host: input["host"].to_string(),
542-
id: input["id"].to_string(),
543-
net: input["net"].to_string(),
544-
path: input["path"].to_string(),
545-
port: input["port"].to_string(),
546-
ps: input["ps"].to_string(),
547-
tls: input["tls"].to_string(),
548-
typpe: input["type"].to_string(),
538+
func: "vmess".to_string(),
539+
add: remove_quotation(input["add"].to_string()),
540+
aid: remove_quotation(input["aid"].to_string()),
541+
host: remove_quotation(input["host"].to_string()),
542+
id: remove_quotation(input["id"].to_string()),
543+
net: remove_quotation(input["net"].to_string()),
544+
path: remove_quotation(input["path"].to_string()),
545+
port: remove_quotation(input["port"].to_string()),
546+
ps: remove_quotation(input["ps"].to_string()),
547+
tls: remove_quotation(input["tls"].to_string()),
548+
typpe: remove_quotation(input["type"].to_string()),
549549
}
550550
}
551551
Err(_) => Information {
552552
urls: url,
553-
func: "\"vmess\"".to_string(),
554-
add: "\"unknown\"".to_string(),
555-
aid: "\"unknown\"".to_string(),
556-
host: "\"unknown\"".to_string(),
557-
id: "\"unknown\"".to_string(),
558-
net: "\"unknown\"".to_string(),
559-
path: "\"unknown\"".to_string(),
560-
port: "\"unknown\"".to_string(),
561-
ps: "\"unknown\"".to_string(),
562-
tls: "\"unknown\"".to_string(),
563-
typpe: "\"unknown\"".to_string(),
553+
func: "vmess".to_string(),
554+
add: "unknown".to_string(),
555+
aid: "unknown".to_string(),
556+
host: "unknown".to_string(),
557+
id: "unknown".to_string(),
558+
net: "unknown".to_string(),
559+
path: "unknown".to_string(),
560+
port: "unknown".to_string(),
561+
ps: "unknown".to_string(),
562+
tls: "unknown".to_string(),
563+
typpe: "unknown".to_string(),
564564
},
565565
}
566566
}

0 commit comments

Comments
 (0)