@@ -2,11 +2,10 @@ import { isPresent } from './utils';
22
33export default function Egern_Producer ( ) {
44 const type = 'ALL' ;
5- const produce = ( proxies , type ) => {
5+ const produce = ( proxies , type , opts = { } ) => {
66 // https://egernapp.com/zh-CN/docs/configuration/proxies
77 const list = proxies
88 . filter ( ( proxy ) => {
9- // if (opts['include-unsupported-proxy']) return true;
109 if (
1110 ! [
1211 'http' ,
@@ -60,8 +59,12 @@ export default function Egern_Producer() {
6059 ! [ 'http' , 'ws' , 'tcp' ] . includes ( proxy . network ) &&
6160 proxy . network ) ||
6261 ( proxy . type === 'vless' &&
63- ( typeof proxy . flow !== 'undefined' ||
64- proxy [ 'reality-opts' ] ||
62+ ( ( ! opts [ 'include-unsupported-proxy' ] &&
63+ ( typeof proxy . flow !== 'undefined' ||
64+ proxy [ 'reality-opts' ] ) ) ||
65+ ( opts [ 'include-unsupported-proxy' ] &&
66+ typeof proxy . flow !== 'undefined' &&
67+ proxy . flow !== 'xtls-rprx-vision' ) ||
6568 ( ! [ 'http' , 'ws' , 'tcp' ] . includes ( proxy . network ) &&
6669 proxy . network ) ) ) ||
6770 ( proxy . type === 'tuic' &&
@@ -74,6 +77,7 @@ export default function Egern_Producer() {
7477 } )
7578 . map ( ( proxy ) => {
7679 const original = { ...proxy } ;
80+ let flow ;
7781 if ( proxy . tls && ! proxy . sni ) {
7882 proxy . sni = proxy . server ;
7983 }
@@ -312,14 +316,27 @@ export default function Egern_Producer() {
312316 } ,
313317 } ;
314318 } else if ( proxy . network === 'tcp' || ! proxy . network ) {
319+ let reality ;
320+ if (
321+ proxy [ 'reality-opts' ] [ 'short-id' ] ||
322+ proxy [ 'reality-opts' ] [ 'public-key' ]
323+ ) {
324+ reality = {
325+ short_id : proxy [ 'reality-opts' ] [ 'short-id' ] ,
326+ public_key : proxy [ 'reality-opts' ] [ 'public-key' ] ,
327+ } ;
328+ }
315329 proxy . transport = {
316330 [ proxy . tls ? 'tls' : 'tcp' ] : {
317331 sni : proxy . tls ? proxy . sni : undefined ,
318332 skip_tls_verify : proxy . tls
319333 ? proxy [ 'skip-cert-verify' ]
320334 : undefined ,
335+ reality,
321336 } ,
322337 } ;
338+
339+ flow = proxy . flow ;
323340 }
324341 proxy = {
325342 type : 'vless' ,
@@ -333,6 +350,7 @@ export default function Egern_Producer() {
333350 proxy . udp || proxy . udp_relay || proxy . udp_relay ,
334351 next_hop : proxy . next_hop ,
335352 transport : proxy . transport ,
353+ flow,
336354 // sni: proxy.sni,
337355 // skip_tls_verify: proxy['skip-cert-verify'],
338356 } ;
0 commit comments