@@ -449,7 +449,7 @@ impl Config {
449
449
Ok ( config)
450
450
}
451
451
452
- pub fn generate_ssr_url ( & self , include_ca_file : bool ) -> Result < String > {
452
+ pub fn generate_ssr_url ( & self ) -> Result < String > {
453
453
let client = self . client . as_ref ( ) . ok_or ( Error :: from ( "client is not set" ) ) ?;
454
454
let engine = crate :: Base64Engine :: UrlSafeNoPad ;
455
455
let method = self . method . as_ref ( ) . map_or ( "none" . to_string ( ) , |m| m. clone ( ) ) ;
@@ -467,26 +467,24 @@ impl Config {
467
467
let mut url = format ! ( "{host}:{port}:origin:{method}:plain:{password}/?remarks={remarks}&ot_enable=1" ) ;
468
468
url. push_str ( & format ! ( "&ot_domain={domain}&ot_path={tunnel_path}" ) ) ;
469
469
470
- if include_ca_file {
471
- if let Some ( ref ca) = client. certificate_content ( ) {
472
- let ca = crate :: base64_encode ( ca. as_bytes ( ) , engine) ;
473
- url. push_str ( & format ! ( "&ot_cert={}" , ca) ) ;
474
- }
470
+ if let Some ( ref ca) = client. certificate_content ( ) {
471
+ let ca = crate :: base64_encode ( ca. as_bytes ( ) , engine) ;
472
+ url. push_str ( & format ! ( "&ot_cert={}" , ca) ) ;
475
473
}
476
474
477
475
Ok ( format ! ( "ssr://{}" , crate :: base64_encode( url. as_bytes( ) , engine) ) )
478
476
}
479
477
}
480
478
481
- pub ( crate ) fn generate_ssr_url < P > ( path : P , include_ca_file : bool ) -> Result < String >
479
+ pub ( crate ) fn generate_ssr_url < P > ( path : P ) -> Result < String >
482
480
where
483
481
P : AsRef < std:: path:: Path > ,
484
482
{
485
483
let config = Config :: from_config_file ( path) ?;
486
- if config. certificate_content ( ) . is_some ( ) && !include_ca_file {
487
- log:: warn!( "Certificate content discarded " ) ;
484
+ if config. certificate_content ( ) . is_some ( ) {
485
+ log:: warn!( "Certificate content exists! " ) ;
488
486
}
489
- config. generate_ssr_url ( include_ca_file )
487
+ config. generate_ssr_url ( )
490
488
}
491
489
492
490
#[ test]
@@ -507,7 +505,7 @@ fn test_config() {
507
505
508
506
config. check_correctness ( false ) . unwrap ( ) ;
509
507
510
- let qrcode = config. generate_ssr_url ( true ) . unwrap ( ) ;
508
+ let qrcode = config. generate_ssr_url ( ) . unwrap ( ) ;
511
509
println ! ( "{:?}" , qrcode) ;
512
510
513
511
let config = Config :: from_ssr_url ( & qrcode) . unwrap ( ) ;
0 commit comments