(proxies = [], targetPlatform, context)
| 1 | function operator(proxies = [], targetPlatform, context) { |
| 2 | // 过滤条件:1. 存在 obfs-opts 字段 2. obfs-opts 下存在 mode 字段 |
| 3 | const filteredProxies = proxies.filter(proxy => { |
| 4 | // 先判断 obfs-opts 存在且不为 null,再判断其下的 mode 存在且不为 null/undefined |
| 5 | return proxy['obfs-opts'] !== undefined && |
| 6 | proxy['obfs-opts'] !== null && |
| 7 | proxy['obfs-opts'].mode !== undefined && |
| 8 | proxy['obfs-opts'].mode !== null; |
| 9 | }); |
| 10 | |
| 11 | console.log(`原始节点数: ${proxies.length}, 过滤后节点数: ${filteredProxies.length}`); |
| 12 | |
| 13 | return filteredProxies; |
| 14 | } |