@@ -863,14 +863,50 @@ function URI_VLESS() {
863863 'It is too complex to convert the downloadSettings in extra into the Mihomo format, so it is not supported.' ,
864864 ) ;
865865 }
866- proxy [ `${ proxy . network } -opts` ] = {
867- 'no-grpc-header' : extra ?. [ 'noGRPCHeader' ] ,
868- 'x-padding-bytes' : extra ?. [ 'xPaddingBytes' ] ,
869- // 'sc-max-each-post-bytes': extra['scMaxEachPostBytes'],
870- // 'sc-min-posts-interval-ms': extra['scMinPostsIntervalMs'],
871- mode : params . mode ,
866+ const xhttpOpts = {
872867 ...proxy [ `${ proxy . network } -opts` ] ,
868+ mode : params . mode ,
873869 } ;
870+ if ( extra ?. [ 'noGRPCHeader' ] === true ) {
871+ xhttpOpts [ 'no-grpc-header' ] = true ;
872+ }
873+ if ( isNotBlank ( extra ?. [ 'xPaddingBytes' ] ) ) {
874+ xhttpOpts [ 'x-padding-bytes' ] = extra [ 'xPaddingBytes' ] ;
875+ }
876+ if (
877+ typeof extra ?. [ 'scMaxEachPostBytes' ] === 'number' &&
878+ Number . isFinite ( extra [ 'scMaxEachPostBytes' ] )
879+ ) {
880+ xhttpOpts [ 'sc-max-each-post-bytes' ] =
881+ extra [ 'scMaxEachPostBytes' ] ;
882+ }
883+ if ( isPlainObject ( extra ?. xmux ) ) {
884+ const reuseSettings = { } ;
885+ const xmuxFieldMap = {
886+ maxConnections : 'max-connections' ,
887+ maxConcurrency : 'max-concurrency' ,
888+ cMaxReuseTimes : 'c-max-reuse-times' ,
889+ hMaxRequestTimes : 'h-max-request-times' ,
890+ hMaxReusableSecs : 'h-max-reusable-secs' ,
891+ } ;
892+ for ( const [ sourceKey , targetKey ] of Object . entries (
893+ xmuxFieldMap ,
894+ ) ) {
895+ const value = extra . xmux [ sourceKey ] ;
896+ if ( typeof value === 'string' && value !== '' ) {
897+ reuseSettings [ targetKey ] = value ;
898+ } else if (
899+ typeof value === 'number' &&
900+ Number . isFinite ( value )
901+ ) {
902+ reuseSettings [ targetKey ] = `${ value } ` ;
903+ }
904+ }
905+ if ( Object . keys ( reuseSettings ) . length > 0 ) {
906+ xhttpOpts [ 'reuse-settings' ] = reuseSettings ;
907+ }
908+ }
909+ proxy [ `${ proxy . network } -opts` ] = xhttpOpts ;
874910 } else {
875911 proxy . _mode = params . mode ;
876912 }
0 commit comments