@@ -28,6 +28,8 @@ export default function Loon_Producer() {
2828 return shadowsocksr ( proxy ) ;
2929 case 'trojan' :
3030 return trojan ( proxy ) ;
31+ case 'anytls' :
32+ return anytls ( proxy ) ;
3133 case 'vmess' :
3234 return vmess ( proxy , opts [ 'include-unsupported-proxy' ] ) ;
3335 case 'vless' :
@@ -306,6 +308,61 @@ function trojan(proxy) {
306308 return result . toString ( ) ;
307309}
308310
311+ function anytls ( proxy ) {
312+ const result = new Result ( proxy ) ;
313+ result . append (
314+ `${ proxy . name } =anytls,${ proxy . server } ,${ proxy . port } ,"${ proxy . password } "` ,
315+ ) ;
316+
317+ for ( const key of [
318+ 'idle-session-check-interval' ,
319+ 'idle-session-timeout' ,
320+ 'min-idle-session' ,
321+ 'max-stream-count' ,
322+ ] ) {
323+ // 值为整数 才附加
324+ if ( isPresent ( proxy , key ) && Number . isInteger ( proxy [ key ] ) ) {
325+ result . append ( `,${ key } =${ proxy [ key ] } ` ) ;
326+ }
327+ }
328+
329+ // tls verification
330+ result . appendIfPresent (
331+ `,skip-cert-verify=${ proxy [ 'skip-cert-verify' ] } ` ,
332+ 'skip-cert-verify' ,
333+ ) ;
334+
335+ // sni
336+ result . appendIfPresent ( `,tls-name=${ proxy . sni } ` , 'sni' ) ;
337+ result . appendIfPresent (
338+ `,tls-cert-sha256=${ proxy [ 'tls-fingerprint' ] } ` ,
339+ 'tls-fingerprint' ,
340+ ) ;
341+ result . appendIfPresent (
342+ `,tls-pubkey-sha256=${ proxy [ 'tls-pubkey-sha256' ] } ` ,
343+ 'tls-pubkey-sha256' ,
344+ ) ;
345+
346+ // tfo
347+ result . appendIfPresent ( `,fast-open=${ proxy . tfo } ` , 'tfo' ) ;
348+
349+ // block-quic
350+ if ( proxy [ 'block-quic' ] === 'on' ) {
351+ result . append ( ',block-quic=true' ) ;
352+ } else if ( proxy [ 'block-quic' ] === 'off' ) {
353+ result . append ( ',block-quic=false' ) ;
354+ }
355+
356+ // udp
357+ if ( proxy . udp ) {
358+ result . append ( `,udp=true` ) ;
359+ }
360+ const ip_version = ipVersions [ proxy [ 'ip-version' ] ] || proxy [ 'ip-version' ] ;
361+ result . appendIfPresent ( `,ip-mode=${ ip_version } ` , 'ip-version' ) ;
362+
363+ return result . toString ( ) ;
364+ }
365+
309366function vmess ( proxy ) {
310367 const isReality = ! ! proxy [ 'reality-opts' ] ;
311368
0 commit comments