@@ -99,6 +99,89 @@ describe('Proxy structured producers', function () {
9999 } ) ;
100100 } ) ;
101101
102+ it ( 'keeps only websocket shadowsocks v2ray-plugin modes for Mihomo and Stash by default' , function ( ) {
103+ const buildProxy = ( name , mode ) => ( {
104+ type : 'ss' ,
105+ name,
106+ server : 'ss.example.com' ,
107+ port : 8388 ,
108+ cipher : 'aes-128-gcm' ,
109+ password : 'secret' ,
110+ plugin : 'v2ray-plugin' ,
111+ 'plugin-opts' : {
112+ mode,
113+ host : 'cdn.example.com' ,
114+ path : '/socket' ,
115+ tls : true ,
116+ } ,
117+ } ) ;
118+
119+ const proxies = [
120+ buildProxy ( 'WS' , 'websocket' ) ,
121+ buildProxy ( 'QUIC' , 'quic' ) ,
122+ ] ;
123+
124+ for ( const platform of [ 'Mihomo' , 'Stash' ] ) {
125+ const internal = produceInternal ( platform , proxies ) ;
126+ const external = loadProducedYaml ( platform , proxies , {
127+ 'include-unsupported-proxy' : true ,
128+ } ) ;
129+
130+ expect ( internal , platform ) . to . have . length ( 1 ) ;
131+ expect ( internal [ 0 ] . name , platform ) . to . equal ( 'WS' ) ;
132+ expect ( external . proxies . map ( ( proxy ) => proxy . name ) , platform ) . to
133+ . deep . equal ( [ 'WS' , 'QUIC' ] ) ;
134+ }
135+ } ) ;
136+
137+ it ( 'keeps only supported shadowsocks v2ray-plugin modes for Shadowrocket by default' , function ( ) {
138+ const buildProxy = ( name , mode ) => ( {
139+ type : 'ss' ,
140+ name,
141+ server : 'ss.example.com' ,
142+ port : 8388 ,
143+ cipher : 'aes-128-gcm' ,
144+ password : 'secret' ,
145+ plugin : 'v2ray-plugin' ,
146+ 'plugin-opts' : {
147+ mode,
148+ host : 'cdn.example.com' ,
149+ path : '/socket' ,
150+ tls : true ,
151+ } ,
152+ } ) ;
153+
154+ const proxies = [
155+ buildProxy ( 'WS' , 'websocket' ) ,
156+ buildProxy ( 'QUIC' , 'quic' ) ,
157+ buildProxy ( 'HTTP2' , 'http2' ) ,
158+ buildProxy ( 'MKCP' , 'mkcp' ) ,
159+ buildProxy ( 'GRPC' , 'grpc' ) ,
160+ buildProxy ( 'TLS' , 'tls' ) ,
161+ ] ;
162+
163+ const internal = produceInternal ( 'Shadowrocket' , proxies ) ;
164+ const external = loadProducedYaml ( 'Shadowrocket' , proxies , {
165+ 'include-unsupported-proxy' : true ,
166+ } ) ;
167+
168+ expect ( internal . map ( ( proxy ) => proxy . name ) ) . to . deep . equal ( [
169+ 'WS' ,
170+ 'QUIC' ,
171+ 'HTTP2' ,
172+ 'MKCP' ,
173+ 'GRPC' ,
174+ ] ) ;
175+ expect ( external . proxies . map ( ( proxy ) => proxy . name ) ) . to . deep . equal ( [
176+ 'WS' ,
177+ 'QUIC' ,
178+ 'HTTP2' ,
179+ 'MKCP' ,
180+ 'GRPC' ,
181+ 'TLS' ,
182+ ] ) ;
183+ } ) ;
184+
102185 it ( 'adds Clash.Meta reality defaults and preserves websocket early data' , function ( ) {
103186 const proxy = {
104187 type : 'vless' ,
0 commit comments