Skip to content

Instantly share code, notes, and snippets.

@kid-oh
Forked from alanhg/wifi-changed.js
Last active August 2, 2022 13:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kid-oh/085c01e0c82d0fb4d2758f607f1c426b to your computer and use it in GitHub Desktop.
Save kid-oh/085c01e0c82d0fb4d2758f607f1c426b to your computer and use it in GitHub Desktop.
surge wifi changed ,auto change proxy
/**
* @description
* 如果是家里WI-FI则开启直连模式
* 如果不是家里WI-FI则开启代理模式
*/
const WIFI_DONT_NEED_PROXYS = ['Xiaomi_RQH'];
if (WIFI_DONT_NEED_PROXYS.includes($network.wifi.ssid)) {
$surge.setOutboundMode('direct');
} else {
$surge.setSelectGroupPolicy('Final-select', 'Group');
$surge.setOutboundMode('rule');
}
$done();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment