File tree Expand file tree Collapse file tree 6 files changed +18
-8
lines changed
Expand file tree Collapse file tree 6 files changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ pub struct Hysteria2 {
4141 pub obfs_password : Option < String > ,
4242 #[ serde( skip_serializing_if = "Option::is_none" ) ]
4343 pub sni : Option < String > ,
44- #[ serde( skip_serializing_if = "Option::is_none" ) ]
44+ #[ serde( skip_serializing_if = "Option::is_none" , rename = "skip-cert-verify" ) ]
4545 pub skip_cert_verify : Option < bool > ,
4646 #[ serde( skip_serializing_if = "Option::is_none" ) ]
4747 pub fingerprint : Option < String > ,
@@ -142,7 +142,7 @@ impl ProxyAdapter for Hysteria2 {
142142 }
143143
144144 let skip_cert_verify = params_map. get ( "insecure" ) . is_some_and ( |s| s == "1" ) ;
145- let sni = params_map. get ( "sni" ) . cloned ( ) ;
145+ let sni = params_map. get ( "sni" ) . or ( params_map . get ( "peer" ) ) . cloned ( ) ;
146146 let up = params_map. get ( "up" ) . cloned ( ) ;
147147 let down = params_map. get ( "down" ) . cloned ( ) ;
148148 let mut ports = params_map. get ( "mport" ) . cloned ( ) ;
Original file line number Diff line number Diff line change 1- mod hysteria2;
21mod ss;
32mod ssr;
43mod trojan;
54pub ( crate ) mod vless;
65pub ( crate ) mod vmess;
6+ pub ( crate ) mod hysteria2;
77
88use std:: any:: Any ;
99use std:: collections:: HashMap ;
Original file line number Diff line number Diff line change @@ -67,7 +67,11 @@ impl ProxyAdapter for Trojan {
67676868 // 4fee57cc-ee15-4800-888f-3493f7b261f2@hk1.ee2c9087-71b0-70af-7924-09d714b25b96.6df03129.
6969 // the-best-airport.com:443?type=tcp&sni=new.download.the-best-airport.com&allowInsecure=1
70- let parts: Vec < & str > = url. split ( "?" ) . collect ( ) ;
70+ // [email protected] :2095/?type=ws 71+ let mut parts: Vec < & str > = url. split ( "/?" ) . collect ( ) ;
72+ if parts. len ( ) == 1 {
73+ parts = url. split ( "?" ) . collect ( ) ;
74+ }
7175 let mut network = None ;
7276 let mut sni = None ;
7377 let mut skip_cert_verify = None ;
Original file line number Diff line number Diff line change @@ -79,7 +79,10 @@ impl ProxyAdapter for Vless {
7979
8080 let url = parts[ 0 ] ;
8181 let mut params_map: HashMap < & str , String > = HashMap :: new ( ) ;
82- let parts = url. split ( "?" ) . collect :: < Vec < _ > > ( ) ;
82+ let mut parts = url. split ( "/?" ) . collect :: < Vec < _ > > ( ) ;
83+ if parts. len ( ) == 1 {
84+ parts = url. split ( "?" ) . collect :: < Vec < _ > > ( ) ;
85+ }
8386
8487 if parts. len ( ) > 1 {
8588 let params = parts[ 1 ] ;
Original file line number Diff line number Diff line change @@ -232,7 +232,7 @@ impl ProxyAdapter for Vmess {
232232 }
233233 }
234234 let alter_id = params_map. get ( "alterId" ) . unwrap ( ) . parse :: < u16 > ( ) . unwrap ( ) ;
235- let name = params_map. get ( "remarks" ) . unwrap ( ) . to_string ( ) ;
235+ let name = urlencoding :: decode ( params_map. get ( "remarks" ) . unwrap ( ) ) . unwrap ( ) . to_string ( ) ;
236236
237237 // parse server port
238238 let url = base64decode ( parts[ 0 ] ) ;
Original file line number Diff line number Diff line change @@ -71,13 +71,16 @@ pub async fn youtube_music_is_ok(proxy_url: &str) -> Result<bool> {
7171
7272mod test {
7373 #[ tokio:: test]
74+ #[ ignore]
7475 async fn test_claude_is_ok ( ) {
7576 let result = super :: claude_is_ok ( "http://localhost:7890" ) . await ;
76- assert ! ( result. is_ok ( ) )
77+ println ! ( "{:?}" , result) ;
7778 }
79+
7880 #[ tokio:: test]
81+ #[ ignore]
7982 async fn test_openai_is_ok ( ) {
8083 let result = super :: openai_is_ok ( "http://localhost:7890" ) . await ;
81- println ! ( "{:# ?}" , result) ;
84+ println ! ( "{:?}" , result) ;
8285 }
8386}
You can’t perform that action at this time.
0 commit comments