1&&arguments[1]!==void 0?arguments[1]:{},n=t.match(e.matchPattern);if(!n)return null;var i=n[0],r=t.match(e.parsePattern);if(!r)return null;var o=e.valueCallback?e.valueCallback(r[0]):r[0];o=a.valueCallback?a.valueCallback(o):o;var s=t.slice(i.length);return{value:o,rest:s}}}var ie=/^(\d+)(th|st|nd|rd)?/i,oe=/\d+/i,ue={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},se={any:[/^b/i,/^(a|c)/i]},le={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},de={any:[/1/i,/2/i,/3/i,/4/i]},fe={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},me={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},he={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},ce={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},ve={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},ge={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},be={ordinalNumber:re({matchPattern:ie,parsePattern:oe,valueCallback:function(e){return parseInt(e,10)}}),era:v({matchPatterns:ue,defaultMatchWidth:"wide",parsePatterns:se,defaultParseWidth:"any"}),quarter:v({matchPatterns:le,defaultMatchWidth:"wide",parsePatterns:de,defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:v({matchPatterns:fe,defaultMatchWidth:"wide",parsePatterns:me,defaultParseWidth:"any"}),day:v({matchPatterns:he,defaultMatchWidth:"wide",parsePatterns:ce,defaultParseWidth:"any"}),dayPeriod:v({matchPatterns:ve,defaultMatchWidth:"any",parsePatterns:ge,defaultParseWidth:"any"})},Me=be,pe={code:"en-US",formatDistance:R,formatLong:q,formatRelative:J,localize:te,match:Me,options:{weekStartsOn:0,firstWeekContainsDate:1}},we=pe;function ye(e,t){if(e==null)throw new TypeError("assign requires that input parameter not be null or undefined");t=t||{};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}function De(e){return ye({},e)}var P=1440,Pe=2520,p=43200,Se=86400;function Te(e,t){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};m(2,arguments);var n=a.locale||we;if(!n.formatDistance)throw new RangeError("locale must contain formatDistance property");var i=g(e,t);if(isNaN(i))throw new RangeError("Invalid time value");var r=De(a);r.addSuffix=Boolean(a.addSuffix),r.comparison=i;var o,s;i>0?(o=l(t),s=l(e)):(o=l(e),s=l(t));var d=O(s,o),h=(y(s)-y(o))/1e3,u=Math.round((d-h)/60),f;if(u<2)return a.includeSeconds?d<5?n.formatDistance("lessThanXSeconds",5,r):d<10?n.formatDistance("lessThanXSeconds",10,r):d<20?n.formatDistance("lessThanXSeconds",20,r):d<40?n.formatDistance("halfAMinute",null,r):d<60?n.formatDistance("lessThanXMinutes",1,r):n.formatDistance("xMinutes",1,r):u===0?n.formatDistance("lessThanXMinutes",1,r):n.formatDistance("xMinutes",u,r);if(u<45)return n.formatDistance("xMinutes",u,r);if(u<90)return n.formatDistance("aboutXHours",1,r);if(ut in e?$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b=(e,t)=>{for(var n in t||(t={}))E.call(t,n)&&S(e,n,t[n]);if(h)for(var n of h(t))J.call(t,n)&&S(e,n,t[n]);return e},v=(e,t)=>k(e,y(t));import{J as O,K as R,L as u}from"./index.2523f2de.js";const D="/logs",x=new TextDecoder("utf-8"),A=()=>Math.floor((1+Math.random())*65536).toString(16);let p=!1,i=!1,f="",s,g;function m(e,t){let n;try{n=JSON.parse(e)}catch{console.log("JSON.parse error",JSON.parse(e))}const r=new Date,l=F(r);n.time=l,n.id=+r-0+A(),n.even=p=!p,t(n)}function F(e){const t=e.getFullYear()%100,n=u(e.getMonth()+1,2),r=u(e.getDate(),2),l=u(e.getHours(),2),o=u(e.getMinutes(),2),c=u(e.getSeconds(),2);return`${t}-${n}-${r} ${l}:${o}:${c}`}function M(e,t){return e.read().then(({done:n,value:r})=>{f+=x.decode(r,{stream:!n});const o=f.split(`
2 | `),c=o[o.length-1];for(let d=0;de[n]).join("|")}let w,a;function H(e,t){if(e.logLevel==="uninit"||i||s&&s.readyState===1)return;g=t;const n=O(e,D);s=new WebSocket(n),s.addEventListener("error",()=>{N(e,t)}),s.addEventListener("message",function(r){m(r.data,t)})}function Y(){s.close(),a&&a.abort()}function j(e){!g||!s||(s.close(),i=!1,H(e,g))}function N(e,t){if(a&&L(e)!==w)a.abort();else if(i)return;i=!0,w=L(e),a=new AbortController;const n=a.signal,{url:r,init:l}=R(e);fetch(r+D+"?level="+e.logLevel,v(b({},l),{signal:n})).then(o=>{const c=o.body.getReader();M(c,t)},o=>{i=!1,!n.aborted&&console.log("GET /logs error:",o.message)})}export{H as f,j as r,Y as s};
3 |
--------------------------------------------------------------------------------
/clash-dashboard/dist/assets/play.d2cf4f29.js:
--------------------------------------------------------------------------------
1 | var h=Object.defineProperty,d=Object.defineProperties;var w=Object.getOwnPropertyDescriptors;var y=Object.getOwnPropertySymbols;var b=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable;var v=(e,t,r)=>t in e?h(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,p=(e,t)=>{for(var r in t||(t={}))b.call(t,r)&&v(e,r,t[r]);if(y)for(var r of y(t))O.call(t,r)&&v(e,r,t[r]);return e},f=(e,t)=>d(e,w(t));import{r as g,b as j,j as a,P as s}from"./index.2523f2de.js";function P(e,t){if(e==null)return{};var r=k(e,t),i,o;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(o=0;o=0)&&(!Object.prototype.propertyIsEnumerable.call(e,i)||(r[i]=e[i]))}return r}function k(e,t){if(e==null)return{};var r={},i=Object.keys(e),o,n;for(n=0;n=0)&&(r[o]=e[o]);return r}var c=g.exports.forwardRef(function(e,t){var r=e.color,i=r===void 0?"currentColor":r,o=e.size,n=o===void 0?24:o,l=P(e,["color","size"]);return j("svg",f(p({ref:t,xmlns:"http://www.w3.org/2000/svg",width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:i,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},l),{children:[a("rect",{x:"6",y:"4",width:"4",height:"16"}),a("rect",{x:"14",y:"4",width:"4",height:"16"})]}))});c.propTypes={color:s.string,size:s.oneOfType([s.string,s.number])};c.displayName="Pause";var L=c;function x(e,t){if(e==null)return{};var r=m(e,t),i,o;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(o=0;o=0)&&(!Object.prototype.propertyIsEnumerable.call(e,i)||(r[i]=e[i]))}return r}function m(e,t){if(e==null)return{};var r={},i=Object.keys(e),o,n;for(n=0;n=0)&&(r[o]=e[o]);return r}var u=g.exports.forwardRef(function(e,t){var r=e.color,i=r===void 0?"currentColor":r,o=e.size,n=o===void 0?24:o,l=x(e,["color","size"]);return a("svg",f(p({ref:t,xmlns:"http://www.w3.org/2000/svg",width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:i,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},l),{children:a("polygon",{points:"5 3 19 12 5 21 5 3"})}))});u.propTypes={color:s.string,size:s.oneOfType([s.string,s.number])};u.displayName="Play";var W=u;export{W as P,L as a};
2 |
--------------------------------------------------------------------------------
/clash-dashboard/dist/assets/roboto-mono-latin-400-normal.2dfc0e86.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CloudF1are/Clash-meta-for-magisk/35594f3a3718371bc81eb9b2aab7b5c08390082e/clash-dashboard/dist/assets/roboto-mono-latin-400-normal.2dfc0e86.woff
--------------------------------------------------------------------------------
/clash-dashboard/dist/assets/roboto-mono-latin-400-normal.e1fd013a.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CloudF1are/Clash-meta-for-magisk/35594f3a3718371bc81eb9b2aab7b5c08390082e/clash-dashboard/dist/assets/roboto-mono-latin-400-normal.e1fd013a.woff2
--------------------------------------------------------------------------------
/clash-dashboard/dist/assets/rotate-cw.ce23167a.js:
--------------------------------------------------------------------------------
1 | var y=Object.defineProperty,g=Object.defineProperties;var w=Object.getOwnPropertyDescriptors;var p=Object.getOwnPropertySymbols;var h=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable;var l=(t,e,r)=>e in t?y(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,f=(t,e)=>{for(var r in e||(e={}))h.call(e,r)&&l(t,r,e[r]);if(p)for(var r of p(e))b.call(e,r)&&l(t,r,e[r]);return t},c=(t,e)=>g(t,w(e));import{r as d,b as j,j as v,P as s}from"./index.2523f2de.js";function O(t,e){if(t==null)return{};var r=k(t,e),i,o;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);for(o=0;o=0)&&(!Object.prototype.propertyIsEnumerable.call(t,i)||(r[i]=t[i]))}return r}function k(t,e){if(t==null)return{};var r={},i=Object.keys(t),o,n;for(n=0;n=0)&&(r[o]=t[o]);return r}var a=d.exports.forwardRef(function(t,e){var r=t.color,i=r===void 0?"currentColor":r,o=t.size,n=o===void 0?24:o,u=O(t,["color","size"]);return j("svg",c(f({ref:e,xmlns:"http://www.w3.org/2000/svg",width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:i,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},u),{children:[v("polyline",{points:"23 4 23 10 17 10"}),v("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})]}))});a.propTypes={color:s.string,size:s.oneOfType([s.string,s.number])};a.displayName="RotateCw";var P=a;export{P as R};
2 |
--------------------------------------------------------------------------------
/clash-dashboard/dist/assets/useRemainingViewPortHeight.597eff95.js:
--------------------------------------------------------------------------------
1 | import{h as r}from"./index.2523f2de.js";const{useState:s,useRef:u,useCallback:a,useLayoutEffect:c}=r;function d(){const t=u(null),[n,i]=s(200),e=a(()=>{const{top:o}=t.current.getBoundingClientRect();i(window.innerHeight-o)},[]);return c(()=>(e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}),[e]),[t,n]}export{d as u};
2 |
--------------------------------------------------------------------------------
/clash-dashboard/dist/assets/zh.c14b4bb9.js:
--------------------------------------------------------------------------------
1 | const u={Overview:"\u6982\u89C8",Proxies:"\u4EE3\u7406",Rules:"\u89C4\u5219",Conns:"\u8FDE\u63A5",Config:"\u914D\u7F6E",Logs:"\u65E5\u5FD7",Upload:"\u4E0A\u4F20",Download:"\u4E0B\u8F7D","Upload Total":"\u4E0A\u4F20\u603B\u91CF","Download Total":"\u4E0B\u8F7D\u603B\u91CF","Active Connections":"\u6D3B\u52A8\u8FDE\u63A5","Pause Refresh":"\u6682\u505C\u5237\u65B0","Resume Refresh":"\u7EE7\u7EED\u5237\u65B0",close_all_connections:"\u95ED\u5173\u6240\u6709\u8FDE\u63A5",Search:"\u67E5\u627E",Up:"\u4E0A\u4F20",Down:"\u4E0B\u8F7D","Test Latency":"\u5EF6\u8FDF\u6D4B\u901F",settings:"\u8BBE\u7F6E",sort_in_grp:"\u4EE3\u7406\u7EC4\u6761\u76EE\u6392\u5E8F",hide_unavail_proxies:"\u9690\u85CF\u4E0D\u53EF\u7528\u4EE3\u7406",auto_close_conns:"\u5207\u6362\u4EE3\u7406\u65F6\u81EA\u52A8\u65AD\u5F00\u65E7\u8FDE\u63A5",order_natural:"\u539F config \u6587\u4EF6\u4E2D\u7684\u6392\u5E8F",order_latency_asc:"\u6309\u5EF6\u8FDF\u4ECE\u5C0F\u5230\u5927",order_latency_desc:"\u6309\u5EF6\u8FDF\u4ECE\u5927\u5230\u5C0F",order_name_asc:"\u6309\u540D\u79F0\u5B57\u6BCD\u6392\u5E8F (A-Z)",order_name_desc:"\u6309\u540D\u79F0\u5B57\u6BCD\u6392\u5E8F (Z-A)",Connections:"\u8FDE\u63A5",Active:"\u6D3B\u52A8",Closed:"\u5DF2\u65AD\u5F00",switch_theme:"\u5207\u6362\u4E3B\u9898",theme:"\u4E3B\u9898",about:"\u5173\u4E8E",no_logs:"\u6682\u65E0\u65E5\u5FD7...",chart_style:"\u6D41\u91CF\u56FE\u6837\u5F0F",latency_test_url:"\u5EF6\u8FDF\u6D4B\u901F URL",lang:"\u8BED\u8A00",update_all_rule_provider:"\u66F4\u65B0\u6240\u6709 rule provider",update_all_proxy_provider:"\u66F4\u65B0\u6240\u6709 proxy providers",reload_config_file:"\u91CD\u8F7D\u914D\u7F6E\u6587\u4EF6",update_geo_databases_file:"\u66F4\u65B0 GEO \u6570\u636E\u5E93\u6587\u4EF6",flush_fake_ip_pool:"\u6E05\u7A7A FakeIP \u6570\u636E\u5E93",enable_tun_device:"\u5F00\u542F TUN \u8F6C\u53D1",allow_lan:"\u5141\u8BB8\u5C40\u57DF\u7F51\u8FDE\u63A5",tls_sniffing:"SNI \u55C5\u63A2",c_host:"\u57DF\u540D",c_process:"\u8FDB\u7A0B",c_dl:"\u4E0B\u8F7D",c_ul:"\u4E0A\u4F20",c_dl_speed:"\u4E0B\u8F7D\u901F\u7387",c_ul_speed:"\u4E0A\u4F20\u901F\u7387",c_chains:"\u8282\u70B9\u94FE",c_rule:"\u89C4\u5219",c_time:"\u8FDE\u63A5\u65F6\u95F4",c_source:"\u6765\u6E90",c_destination_ip:"\u76EE\u6807IP",c_type:"\u7C7B\u578B"};export{u as data};
2 |
--------------------------------------------------------------------------------
/clash-dashboard/dist/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | yacd
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/clash-dashboard/dist/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CloudF1are/Clash-meta-for-magisk/35594f3a3718371bc81eb9b2aab7b5c08390082e/clash-dashboard/dist/logo.png
--------------------------------------------------------------------------------
/clash-dashboard/dist/manifest.webmanifest:
--------------------------------------------------------------------------------
1 | {"name":"yacd","short_name":"yacd","start_url":"./","display":"standalone","background_color":"#ffffff","lang":"en","scope":"./"}
2 |
--------------------------------------------------------------------------------
/clash-dashboard/dist/registerSW.js:
--------------------------------------------------------------------------------
1 | if('serviceWorker' in navigator) {window.addEventListener('load', () => {navigator.serviceWorker.register('./sw.js', { scope: './' })})}
--------------------------------------------------------------------------------
/clash-dashboard/dist/subs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CloudF1are/Clash-meta-for-magisk/35594f3a3718371bc81eb9b2aab7b5c08390082e/clash-dashboard/dist/subs
--------------------------------------------------------------------------------
/clash-dashboard/dist/yacd.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CloudF1are/Clash-meta-for-magisk/35594f3a3718371bc81eb9b2aab7b5c08390082e/clash-dashboard/dist/yacd.ico
--------------------------------------------------------------------------------
/clash-dashboard/dist/yacd.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CloudF1are/Clash-meta-for-magisk/35594f3a3718371bc81eb9b2aab7b5c08390082e/clash-dashboard/dist/yacd.png
--------------------------------------------------------------------------------
/clash/Country.mmdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CloudF1are/Clash-meta-for-magisk/35594f3a3718371bc81eb9b2aab7b5c08390082e/clash/Country.mmdb
--------------------------------------------------------------------------------
/clash/GeoIP.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CloudF1are/Clash-meta-for-magisk/35594f3a3718371bc81eb9b2aab7b5c08390082e/clash/GeoIP.dat
--------------------------------------------------------------------------------
/clash/GeoSite.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CloudF1are/Clash-meta-for-magisk/35594f3a3718371bc81eb9b2aab7b5c08390082e/clash/GeoSite.dat
--------------------------------------------------------------------------------
/clash/clash.config:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 |
3 | auto_updateSubcript="false"
4 | update_subcriptInterval="0 5 * * *"
5 | auto_updateGeoIP="true"
6 | auto_updateGeoSite="true"
7 | Clash_port_skipdetection="false" #是否跳过端口检查
8 | update_geoXInterval="0 5 * * 7" # 每周日的半夜5点更新GeoX
9 | Subcript_url="" # 不用providers的订阅连接填这里 再把上面的开关打开 默认每天凌晨5点更新
10 | GeoIP_dat_url="https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat"
11 | Country_mmdb_url="https://github.com/Loyalsoldier/geoip/releases/latest/download/Country-only-cn-private.mmdb"
12 | GeoSite_url="https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat"
13 | #如果下载困难,可以使用以下反代地址
14 | #GeoIP_dat_url="https://ghproxy.com/https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat"
15 | #Country_mmdb_url="https://ghproxy.comhttps://github.com/Loyalsoldier/geoip/releases/latest/download/Country-only-cn-private.mmdb"
16 | #GeoSite_url="https://ghproxy.com/https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat"
17 | #规则文件 默认在 /data/clash/rule_providers/ 目录下
18 | proxy_file="AppProxy.yaml"
19 | direct_file="AppDirect.yaml"
20 | #走代理的app
21 | app_proxy="
22 | com.android.vending
23 | com.google.android.gms
24 | "
25 | #走直连的app 请填写包名
26 | app_direct="
27 | com.tencent.mobileqq
28 | com.tencent.mm
29 | com.eg.android.AlipayGphone
30 | com.unionpay
31 | "
32 | #
33 | # 上面的是给你操作的,下面的不懂就别乱改
34 | # Clash运行时别动下方的配置,如动了出问题重启手机
35 | ipv6="false"
36 | pref_id="5000"
37 | mark_id="2021"
38 | table_id="2021"
39 | mode="blacklist"
40 | static_dns="8.8.8.8"
41 | Clash_bin_name="clash"
42 | Clash_old_logs="true" #是否保存每次的运行日志
43 | Clash_data_dir="/data/clash"
44 | Clash_run_path="${Clash_data_dir}/run"
45 | busybox_path="/data/adb/magisk/busybox"
46 | CFM_logs_file="${Clash_run_path}/run.logs"
47 | CFM_OldLogs_file="${Clash_run_path}/run.old.logs"
48 | template_file="${Clash_data_dir}/template"
49 | appuid_file="${Clash_run_path}/appuid.list"
50 | Clash_pid_file="${Clash_run_path}/clash.pid"
51 | Clash_bin_path="/data/adb/modules/Clash_For_Magisk/system/bin/${Clash_bin_name}"
52 | Clash_config_file="${Clash_data_dir}/config.yaml"
53 | system_packages_file="/data/system/packages.list"
54 | temporary_config_file="${Clash_run_path}/config.yaml"
55 | filter_packages_file="${Clash_data_dir}/packages.list"
56 | Clash_GeoSite_file="${Clash_data_dir}/GeoSite.dat"
57 | geodata_mode=$(grep "geodata-mode" ${template_file} | awk -F ': ' '{print $2}')
58 | if "${geodata_mode}"; then
59 | Clash_GeoIP_file="${Clash_data_dir}/GeoIP.dat"
60 | GeoIP_url=${GeoIP_dat_url}
61 | else
62 | Clash_GeoIP_file="${Clash_data_dir}/Country.mmdb"
63 | GeoIP_url=${Country_mmdb_url}
64 | fi
65 |
66 | # 自动绕过本机ip,filter_local请勿轻易打开,打开后有可能引起设备软重启,如你手机有获取到公网ip.
67 | # 优先重启cfm,即可绕过本机ip,检查是否正常,次要选择尝试打开filter_local,如遇设备软重启,请关闭.
68 | filter_local="false"
69 | #请不要轻易打开. 不要轻易打开,不要轻易打开.
70 |
71 | Cgroup_memory_path=""
72 | # 留空则自动获取
73 | Cgroup_memory_limit=""
74 | # 限制内存使用,量力而行,限制太死会造成CPU占用过高,-1则不限制,留空则不操作
75 | # 更新限制请保存后执行 /data/clash/scripts/clash.tool -l
76 | Clash_permissions="6755"
77 | Clash_user_group="root:net_admin"
78 | iptables_wait="iptables -w 100"
79 | ip6tables_wait="ip6tables -w 100"
80 | Clash_user=$(echo ${Clash_user_group} | awk -F ':' '{print $1}')
81 | Clash_group=$(echo ${Clash_user_group} | awk -F ':' '{print $2}')
82 | Clash_dns_port=$(grep "listen" ${template_file} | awk -F ':' '{print $3}')
83 | Clash_enhanced_mode=$(grep "enhanced-mode" ${template_file} | awk -F ': ' '{print $2}')
84 | Clash_tproxy_port=$(grep "tproxy-port" ${template_file} | awk -F ': ' '{print $2}')
85 | Clash_tun_status=$(awk -F ': ' '/^tun: *$/{getline; print $2}' ${template_file})
86 | Clash_auto_route=$(grep "auto-route" ${template_file} | awk -F ': ' '{print $2}')
87 | tun_device=$(awk -F ': ' '/ +device: /{print $2}' ${template_file})
88 | if [ "${Clash_tun_status}" == "" ]; then
89 | Clash_tun_status="false"
90 | fi
91 | if [ "${Clash_auto_route}" == "" ]; then
92 | Clash_auto_route="true"
93 | fi
94 | if [ "${tun_device}" == "" ]; then
95 | tun_device="Meta"
96 | fi
97 | log() {
98 | if [ ${Clash_old_logs} == "true" ];then
99 | echo [`TZ=Asia/Shanghai date "+%H:%M:%S"`]$1>>${CFM_logs_file}
100 | echo [`TZ=Asia/Shanghai date "+%Y-%m-%d %H:%M:%S"`]$1>>${CFM_OldLogs_file}
101 | else
102 | echo [`TZ=Asia/Shanghai date "+%H:%M:%S"`]$1>>${CFM_logs_file}
103 | fi
104 | }
105 | #日志函数暂没启用,目前使用echo命令输出日志
106 | reserved_ip=(0.0.0.0/8 10.0.0.0/8 100.64.0.0/10 127.0.0.0/8 169.254.0.0/16 172.16.0.0/12 192.0.0.0/24 192.0.2.0/24 192.168.0.0/16 198.51.100.0/24 203.0.113.0/24 224.0.0.0/4 255.255.255.255/32 240.0.0.0/4)
107 | reserved_ip6=(::/128 ::1/128 ::ffff:0:0/96 100::/64 64:ff9b::/96 2001::/32 2001:10::/28 2001:20::/28 2001:db8::/32 2002::/16 fc00::/7 fe80::/10 ff00::/8)
108 | #Clash_auto_route="false" 有的人是true,不知道是什么意思,好想知道啥意思了,就是template没写时候默认是啥
--------------------------------------------------------------------------------
/clash/config.yaml:
--------------------------------------------------------------------------------
1 | proxies:
2 | proxy-providers:
3 |
4 | 可乐云:
5 | type: http
6 | url: "订阅链接"
7 | path: ./proxy_providers/可乐云.yaml
8 | interval: 10800
9 | health-check:
10 | enable: true
11 | url: http://www.gstatic.com/generate_204
12 | interval: 1800
13 | 魔戒:
14 | type: http
15 | url: "订阅链接"
16 | path: ./proxy_providers/魔戒.yaml
17 | interval: 10800
18 | health-check:
19 | enable: true
20 | url: http://www.gstatic.com/generate_204
21 | interval: 1800
22 | #如果无法正常更新订阅,请打开proxy provider 里面的机场yaml配置文件,如果是乱码,需要自己在订阅链接结尾加上 &flag=clash 强制订阅服务器下发clash的配置文件
23 | 备用:
24 | type: http
25 | url: "在下方选一个吧,有更好的欢迎提交"
26 | path: ./proxy_providers/备用.yaml
27 | interval: 10800
28 | health-check:
29 | enable: true
30 | url: http://www.gstatic.com/generate_204
31 | interval: 1800
32 |
33 | #欢迎提交更多白嫖订阅
34 | #https://pastebin.com/raw/GxR5pELe
35 | #https://openit.daycat.space/clash
36 | #https://nullnode.top/clash主站 下属 https://nullnode.top/clashnode
37 | #可以白嫖的机场 https://acec.cloud/
38 | # 魔戒 可乐云 为机场名,可以更换,要换必须全换,建议使用编辑器的查找功能避免遗漏
39 | proxy-groups:
40 | - name: 机场
41 | type: select
42 | proxies:
43 | - 可乐云
44 | - 魔戒
45 | - 备用
46 | - 美国节点
47 | - 负载均衡
48 |
49 | - name: 可乐云
50 | type: select
51 | use:
52 | - 可乐云
53 |
54 | - name: 魔戒
55 | type: select
56 | use:
57 | - 魔戒
58 |
59 | - name: 备用
60 | type: select
61 | use:
62 | - 备用
63 |
64 |
65 | - name: 美国节点
66 | type: select
67 | use:
68 | - 可乐云
69 | - 魔戒
70 | - 备用
71 | filter: '美国|USA|美國'
72 | #meta的特性,如果你经常使用某个地区节点可以使用过滤器便于选择 美国节点 可以改为其他,要改全改 ,过滤器内容用 | 分割,支持通配符
73 | #测试性增加了负载均衡节点
74 | - name: 负载均衡
75 | type: load-balance
76 | use:
77 | - 可乐云
78 | url: 'http://www.gstatic.com/generate_204'
79 | interval: 1800
80 | filter: '美国|USA|美國.*1.0'
81 | strategy: consistent-hashing
82 |
83 |
84 | - name: 墙内网址
85 | type: select
86 | proxies:
87 | - DIRECT
88 | - 机场
89 |
90 | - name: 其他
91 | type: select
92 | proxies:
93 | - DIRECT
94 | - 机场
95 | - 墙内网址
96 |
97 | rule-providers:
98 | AppProxy:
99 | type: file
100 | behavior: classical
101 | path: ./rule_providers/AppProxy.yaml
102 | AppDirect:
103 | type: file
104 | behavior: classical
105 | path: ./rule_providers/AppDirect.yaml
106 | userDirect:
107 | type: file
108 | behavior: classical
109 | path: ./rule_providers/userDirect.yaml
110 | #用户自定义直连,文件在data/clash/rule-provider/userdirect,需要的自己写入,格式参照备用里面的clash官方文档
111 | rules:
112 | - RULE-SET,AppProxy,机场
113 | - RULE-SET,AppDirect,墙内网址
114 | - RULE-SET,userDirect,墙内网址
115 | - GEOSITE,category-ads-all,REJECT
116 | - GEOSITE,geolocation-cn,墙内网址
117 | - GEOSITE,geolocation-!cn,机场
118 | - GEOIP,private,DIRECT
119 | - GEOIP,CN,墙内网址
120 | - GEOIP,!CN,机场
121 | - MATCH,其他
122 |
--------------------------------------------------------------------------------
/clash/proxy_providers/备用.yaml:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CloudF1are/Clash-meta-for-magisk/35594f3a3718371bc81eb9b2aab7b5c08390082e/clash/proxy_providers/备用.yaml
--------------------------------------------------------------------------------
/clash/rule_providers/AppDirect.yaml:
--------------------------------------------------------------------------------
1 | payload:
2 |
--------------------------------------------------------------------------------
/clash/rule_providers/AppProxy.yaml:
--------------------------------------------------------------------------------
1 | payload:
--------------------------------------------------------------------------------
/clash/rule_providers/special.yaml:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CloudF1are/Clash-meta-for-magisk/35594f3a3718371bc81eb9b2aab7b5c08390082e/clash/rule_providers/special.yaml
--------------------------------------------------------------------------------
/clash/rule_providers/userDirect.yaml:
--------------------------------------------------------------------------------
1 | payload:
2 | - DOMAIN,cdn.jsdelivr.net
3 | - DOMAIN,fastgit.org
4 | #- DOMAIN-SUFFIX,www.gstatic.com #检测连接的地址,要是不出问题应该不需要给手动改为直连
5 | - DOMAIN-SUFFIX,speedtest.net
6 | - DOMAIN-SUFFIX,10010.com #联通营业厅走直连,以免免流时出现问题
7 | - DOMAIN-SUFFIX,syncthing.net
8 | - PROCESS-NAME,libsyncthingnative.so
9 | - AND,((DST-PORT,5228-5230),(NETWORK,TCP),(DOMAIN-KEYWORD,google)) #谷歌推送
10 | - DOMAIN-SUFFIX,push.apple.com #苹果推送
11 | # > ghproxy.com 直连
12 | - AND,((NETWORK,TCP),(DOMAIN-SUFFIX,ghproxy.com),(DST-PORT,80/443))
13 | - AND,((NETWORK,UDP),(DOMAIN-SUFFIX,ghproxy.com))
14 | - DOMAIN-SUFFIX,ghproxy.com,🇨🇳 墙内
15 | #为稳定运行,国内DNS将全部设置为直连不走免流
16 | - AND,((NETWORK,TCP),(IP-CIDR,1.12.12.12/32,no-resolve),(DST-PORT,80/443))
17 | - AND,((NETWORK,UDP),(IP-CIDR,1.12.12.12/32,no-resolve))
18 | - IP-CIDR,1.12.12.12/32
19 | - AND,((NETWORK,TCP),(IP-CIDR,120.53.53.53/32,no-resolve),(DST-PORT,80/443))
20 | - AND,((NETWORK,UDP),(IP-CIDR,120.53.53.53/32,no-resolve))
21 | - IP-CIDR,120.53.53.53/32
22 | - AND,((NETWORK,TCP),(IP-CIDR,223.5.5.5/32,no-resolve),(DST-PORT,80/443))
23 | - AND,((NETWORK,UDP),(IP-CIDR,223.5.5.5/32,no-resolve))
24 | - IP-CIDR,223.5.5.5/32
25 | - AND,((NETWORK,TCP),(IP-CIDR,119.29.29.29/32,no-resolve),(DST-PORT,80/443))
26 | - AND,((NETWORK,UDP),(IP-CIDR,119.29.29.29/32,no-resolve))
27 | - IP-CIDR,119.29.29.29/32
28 | #原local内规则
29 | - DOMAIN-KEYWORD,announce
30 | - DOMAIN-KEYWORD,torrent
31 | - DOMAIN-KEYWORD,tracker
32 | - DOMAIN-SUFFIX,smtp
33 | - DOMAIN-SUFFIX,local
34 | - DST-PORT,22
35 | #补充lan规则
36 | # NAME: Lan
37 | # AUTHOR: blackmatrix7
38 | # REPO: https://github.com/blackmatrix7/ios_rule_script
39 | # UPDATED: 2022-07-25 21:11:41
40 | # DOMAIN: 3
41 | # DOMAIN-SUFFIX: 114
42 | # IP-CIDR: 14
43 | # IP-CIDR6: 3
44 | # TOTAL: 134
45 | - DOMAIN,instant.arubanetworks.com
46 | - DOMAIN,router.asus.com
47 | - DOMAIN,setmeup.arubanetworks.com
48 | - DOMAIN-SUFFIX,0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa
49 | - DOMAIN-SUFFIX,0.in-addr.arpa
50 | - DOMAIN-SUFFIX,1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa
51 | - DOMAIN-SUFFIX,10.in-addr.arpa
52 | - DOMAIN-SUFFIX,100.100.in-addr.arpa
53 | - DOMAIN-SUFFIX,100.51.198.in-addr.arpa
54 | - DOMAIN-SUFFIX,101.100.in-addr.arpa
55 | - DOMAIN-SUFFIX,102.100.in-addr.arpa
56 | - DOMAIN-SUFFIX,103.100.in-addr.arpa
57 | - DOMAIN-SUFFIX,104.100.in-addr.arpa
58 | - DOMAIN-SUFFIX,105.100.in-addr.arpa
59 | - DOMAIN-SUFFIX,106.100.in-addr.arpa
60 | - DOMAIN-SUFFIX,107.100.in-addr.arpa
61 | - DOMAIN-SUFFIX,108.100.in-addr.arpa
62 | - DOMAIN-SUFFIX,109.100.in-addr.arpa
63 | - DOMAIN-SUFFIX,110.100.in-addr.arpa
64 | - DOMAIN-SUFFIX,111.100.in-addr.arpa
65 | - DOMAIN-SUFFIX,112.100.in-addr.arpa
66 | - DOMAIN-SUFFIX,113.0.203.in-addr.arpa
67 | - DOMAIN-SUFFIX,113.100.in-addr.arpa
68 | - DOMAIN-SUFFIX,114.100.in-addr.arpa
69 | - DOMAIN-SUFFIX,115.100.in-addr.arpa
70 | - DOMAIN-SUFFIX,116.100.in-addr.arpa
71 | - DOMAIN-SUFFIX,117.100.in-addr.arpa
72 | - DOMAIN-SUFFIX,118.100.in-addr.arpa
73 | - DOMAIN-SUFFIX,119.100.in-addr.arpa
74 | - DOMAIN-SUFFIX,120.100.in-addr.arpa
75 | - DOMAIN-SUFFIX,121.100.in-addr.arpa
76 | - DOMAIN-SUFFIX,122.100.in-addr.arpa
77 | - DOMAIN-SUFFIX,123.100.in-addr.arpa
78 | - DOMAIN-SUFFIX,124.100.in-addr.arpa
79 | - DOMAIN-SUFFIX,125.100.in-addr.arpa
80 | - DOMAIN-SUFFIX,126.100.in-addr.arpa
81 | - DOMAIN-SUFFIX,127.100.in-addr.arpa
82 | - DOMAIN-SUFFIX,127.in-addr.arpa
83 | - DOMAIN-SUFFIX,16.172.in-addr.arpa
84 | - DOMAIN-SUFFIX,168.192.in-addr.arpa
85 | - DOMAIN-SUFFIX,17.172.in-addr.arpa
86 | - DOMAIN-SUFFIX,18.172.in-addr.arpa
87 | - DOMAIN-SUFFIX,19.172.in-addr.arpa
88 | - DOMAIN-SUFFIX,2.0.192.in-addr.arpa
89 | - DOMAIN-SUFFIX,20.172.in-addr.arpa
90 | - DOMAIN-SUFFIX,21.172.in-addr.arpa
91 | - DOMAIN-SUFFIX,22.172.in-addr.arpa
92 | - DOMAIN-SUFFIX,23.172.in-addr.arpa
93 | - DOMAIN-SUFFIX,24.172.in-addr.arpa
94 | - DOMAIN-SUFFIX,25.172.in-addr.arpa
95 | - DOMAIN-SUFFIX,254.169.in-addr.arpa
96 | - DOMAIN-SUFFIX,255.255.255.255.in-addr.arpa
97 | - DOMAIN-SUFFIX,26.172.in-addr.arpa
98 | - DOMAIN-SUFFIX,27.172.in-addr.arpa
99 | - DOMAIN-SUFFIX,28.172.in-addr.arpa
100 | - DOMAIN-SUFFIX,29.172.in-addr.arpa
101 | - DOMAIN-SUFFIX,30.172.in-addr.arpa
102 | - DOMAIN-SUFFIX,31.172.in-addr.arpa
103 | - DOMAIN-SUFFIX,64.100.in-addr.arpa
104 | - DOMAIN-SUFFIX,65.100.in-addr.arpa
105 | - DOMAIN-SUFFIX,66.100.in-addr.arpa
106 | - DOMAIN-SUFFIX,67.100.in-addr.arpa
107 | - DOMAIN-SUFFIX,68.100.in-addr.arpa
108 | - DOMAIN-SUFFIX,69.100.in-addr.arpa
109 | - DOMAIN-SUFFIX,70.100.in-addr.arpa
110 | - DOMAIN-SUFFIX,71.100.in-addr.arpa
111 | - DOMAIN-SUFFIX,72.100.in-addr.arpa
112 | - DOMAIN-SUFFIX,73.100.in-addr.arpa
113 | - DOMAIN-SUFFIX,74.100.in-addr.arpa
114 | - DOMAIN-SUFFIX,75.100.in-addr.arpa
115 | - DOMAIN-SUFFIX,76.100.in-addr.arpa
116 | - DOMAIN-SUFFIX,77.100.in-addr.arpa
117 | - DOMAIN-SUFFIX,78.100.in-addr.arpa
118 | - DOMAIN-SUFFIX,79.100.in-addr.arpa
119 | - DOMAIN-SUFFIX,8.b.d.0.1.0.0.2.ip6.arpa
120 | - DOMAIN-SUFFIX,8.e.f.ip6.arpa
121 | - DOMAIN-SUFFIX,80.100.in-addr.arpa
122 | - DOMAIN-SUFFIX,81.100.in-addr.arpa
123 | - DOMAIN-SUFFIX,82.100.in-addr.arpa
124 | - DOMAIN-SUFFIX,83.100.in-addr.arpa
125 | - DOMAIN-SUFFIX,84.100.in-addr.arpa
126 | - DOMAIN-SUFFIX,85.100.in-addr.arpa
127 | - DOMAIN-SUFFIX,86.100.in-addr.arpa
128 | - DOMAIN-SUFFIX,87.100.in-addr.arpa
129 | - DOMAIN-SUFFIX,88.100.in-addr.arpa
130 | - DOMAIN-SUFFIX,89.100.in-addr.arpa
131 | - DOMAIN-SUFFIX,9.e.f.ip6.arpa
132 | - DOMAIN-SUFFIX,90.100.in-addr.arpa
133 | - DOMAIN-SUFFIX,91.100.in-addr.arpa
134 | - DOMAIN-SUFFIX,92.100.in-addr.arpa
135 | - DOMAIN-SUFFIX,93.100.in-addr.arpa
136 | - DOMAIN-SUFFIX,94.100.in-addr.arpa
137 | - DOMAIN-SUFFIX,95.100.in-addr.arpa
138 | - DOMAIN-SUFFIX,96.100.in-addr.arpa
139 | - DOMAIN-SUFFIX,97.100.in-addr.arpa
140 | - DOMAIN-SUFFIX,98.100.in-addr.arpa
141 | - DOMAIN-SUFFIX,99.100.in-addr.arpa
142 | - DOMAIN-SUFFIX,a.e.f.ip6.arpa
143 | - DOMAIN-SUFFIX,acl4.ssr
144 | - DOMAIN-SUFFIX,b.e.f.ip6.arpa
145 | - DOMAIN-SUFFIX,d.f.ip6.arpa
146 | - DOMAIN-SUFFIX,hiwifi.com
147 | - DOMAIN-SUFFIX,home.arpa
148 | - DOMAIN-SUFFIX,leike.cc
149 | - DOMAIN-SUFFIX,localhost.ptlogin2.qq.com
150 | - DOMAIN-SUFFIX,localhost.sec.qq.com
151 | - DOMAIN-SUFFIX,miwifi.com
152 | - DOMAIN-SUFFIX,msftconnecttest.com
153 | - DOMAIN-SUFFIX,msftncsi.com
154 | - DOMAIN-SUFFIX,my.router
155 | - DOMAIN-SUFFIX,p.to
156 | - DOMAIN-SUFFIX,peiluyou.com
157 | - DOMAIN-SUFFIX,phicomm.me
158 | - DOMAIN-SUFFIX,router.ctc
159 | - DOMAIN-SUFFIX,routerlogin.com
160 | - DOMAIN-SUFFIX,tendawifi.com
161 | - DOMAIN-SUFFIX,zte.home
162 | - IP-CIDR,0.0.0.0/8
163 | - IP-CIDR,10.0.0.0/8
164 | - IP-CIDR,100.64.0.0/10
165 | - IP-CIDR,127.0.0.0/8
166 | - IP-CIDR,169.254.0.0/16
167 | - IP-CIDR,172.16.0.0/12
168 | - IP-CIDR,192.0.0.0/24
169 | - IP-CIDR,192.0.2.0/24
170 | - IP-CIDR,192.168.0.0/16
171 | - IP-CIDR,192.88.99.0/24
172 | - IP-CIDR,198.18.0.0/15
173 | - IP-CIDR,198.51.100.0/24
174 | - IP-CIDR,203.0.113.0/24
175 | - IP-CIDR,224.0.0.0/3
176 | - IP-CIDR6,::1/128
177 | - IP-CIDR6,fc00::/7
178 | - IP-CIDR6,fe80::/10
179 |
--------------------------------------------------------------------------------
/clash/scripts/clash.cron:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 | scripts=`realpath $0`
3 | scripts_dir=`dirname ${scripts}`
4 | . /data/clash/clash.config
5 |
6 | step=5 #间隔的秒数,不能大于60
7 | i=0
8 | while ((i < 60)) ; do
9 | i=$i+step
10 | ${scripts_dir}/clash.tool -m
11 | sleep $step
12 | done
13 | exit 0
--------------------------------------------------------------------------------
/clash/scripts/clash.inotify:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 |
3 | scripts=`realpath $0`
4 | scripts_dir=`dirname ${scripts}`
5 | service_path="${scripts_dir}/clash.service"
6 | tproxy_path="${scripts_dir}/clash.iptables"
7 | signal_file="${scripts_dir}/../run/cmdRunning"
8 |
9 | events=$1
10 | monitor_dir=$2
11 | monitor_file=$3
12 |
13 | service_control() {
14 | if [ "${monitor_file}" = "disable" ] ; then
15 | touch ${signal_file}
16 | if [ "${events}" = "d" ] ; then
17 | ${service_path} -s && ${tproxy_path} -s
18 | elif [ "${events}" = "n" ] ; then
19 | ${service_path} -k && ${tproxy_path} -k
20 | fi
21 | rm ${signal_file}
22 | fi
23 | }
24 |
25 | service_control
--------------------------------------------------------------------------------
/clash/scripts/clash.iptables:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 |
3 | scripts=`realpath $0`
4 | scripts_dir=`dirname ${scripts}`
5 | . /data/clash/clash.config
6 |
7 | create_rule_rules() {
8 | ip -4 rule add fwmark ${mark_id} table ${table_id} pref ${pref_id}
9 | ip -4 route add local default dev lo table ${table_id}
10 | if [ "${ipv6}" = "true" ] ; then
11 | ip -6 rule add fwmark ${mark_id} table ${table_id} pref ${pref_id}
12 | ip -6 route add local default dev lo table ${table_id}
13 | fi
14 | }
15 |
16 | flush_rule_rules() {
17 | ip rule del fwmark ${mark_id} table ${table_id}
18 | ip route flush table ${table_id}
19 | if [ "${ipv6}" = "true" ] ; then
20 | ip -6 rule del fwmark ${mark_id} table ${table_id}
21 | ip -6 route flush table ${table_id}
22 | fi
23 | }
24 |
25 | create_mangle_prerouting_chain() {
26 | ${iptables_wait} -t mangle -N CLASH_PRE
27 |
28 | ${iptables_wait} -t mangle -A CLASH_PRE -p tcp -j TPROXY --on-port ${Clash_tproxy_port} --tproxy-mark ${mark_id} && echo "" || echo "你的系统可能阉割了Tproxy-TCP" >> ${CFM_logs_file}
29 | ${iptables_wait} -t mangle -A CLASH_PRE -p udp ! --dport 53 -j TPROXY --on-port ${Clash_tproxy_port} --tproxy-mark ${mark_id} && echo "" || echo "你的系统可能阉割了Tproxy-UDP" >> ${CFM_logs_file}
30 | if [ "${ipv6}" = "true" ] ; then
31 | ${ip6tables_wait} -t mangle -N CLASH_PRE
32 |
33 | ${ip6tables_wait} -t mangle -A CLASH_PRE -p tcp -j TPROXY --on-port ${Clash_tproxy_port} --tproxy-mark ${mark_id} && echo "" || echo "你的系统可能阉割了Tproxy-TCP6" >> ${CFM_logs_file}
34 | ${ip6tables_wait} -t mangle -A CLASH_PRE -p udp ! --dport 53 -j TPROXY --on-port ${Clash_tproxy_port} --tproxy-mark ${mark_id} && echo "" || echo "你的系统可能阉割了Tproxy-UDP6" >> ${CFM_logs_file}
35 | fi
36 | }
37 |
38 | create_mangle_output_chain() {
39 | ${iptables_wait} -t mangle -N CLASH_OUT
40 |
41 | ${iptables_wait} -t mangle -A CLASH_OUT -p tcp -j MARK --set-mark ${mark_id}
42 | ${iptables_wait} -t mangle -A CLASH_OUT -p udp -j MARK --set-mark ${mark_id}
43 | if [ "${ipv6}" = "true" ] ; then
44 | ${ip6tables_wait} -t mangle -N CLASH_OUT
45 |
46 | ${ip6tables_wait} -t mangle -A CLASH_OUT -p tcp -j MARK --set-mark ${mark_id}
47 | ${ip6tables_wait} -t mangle -A CLASH_OUT -p udp -j MARK --set-mark ${mark_id}
48 | fi
49 | }
50 |
51 | create_mangle_prerouting_filter() {
52 | ${iptables_wait} -t mangle -N FILTER_PRE_CLASH
53 |
54 | for subnet in ${reserved_ip[*]} ; do
55 | ${iptables_wait} -t mangle -A FILTER_PRE_CLASH -d ${subnet} -j ACCEPT
56 | done
57 |
58 | ${iptables_wait} -t mangle -A FILTER_PRE_CLASH -j CLASH_PRE
59 | if [ "${ipv6}" = "true" ] ; then
60 | ${ip6tables_wait} -t mangle -N FILTER_PRE_CLASH
61 |
62 | for subnet6 in ${reserved_ip6[*]} ; do
63 | ${ip6tables_wait} -t mangle -A FILTER_PRE_CLASH -d ${subnet6} -j ACCEPT
64 | done
65 |
66 | ${ip6tables_wait} -t mangle -A FILTER_PRE_CLASH -j CLASH_PRE
67 | fi
68 | }
69 |
70 | create_mangle_output_filter() {
71 | ${scripts_dir}/clash.tool -f
72 |
73 | ${iptables_wait} -t mangle -N FILTER_OUT_CLASH
74 |
75 | for subnet in ${reserved_ip[*]} ; do
76 | ${iptables_wait} -t mangle -A FILTER_OUT_CLASH -d ${subnet} -j ACCEPT
77 | done
78 |
79 | if [ "${Clash_enhanced_mode}" == "fake-ip" ]; then
80 | mode="blacklist"
81 | fi
82 | apps=`cat ${appuid_file} | sort -u`
83 | if [ "${mode}" = "blacklist" ] ; then
84 | for appuid in ${apps} ; do
85 | ${iptables_wait} -t mangle -A FILTER_OUT_CLASH -m owner --uid-owner ${appuid} -j ACCEPT
86 | done
87 |
88 | ${iptables_wait} -t mangle -A FILTER_OUT_CLASH -m owner ! --gid-owner ${Clash_group} -j CLASH_OUT
89 | elif [ "${mode}" = "whitelist" ] ; then
90 | for appuid in ${apps} ; do
91 | ${iptables_wait} -t mangle -A FILTER_OUT_CLASH -m owner --uid-owner ${appuid} -j CLASH_OUT
92 | done
93 | fi
94 |
95 | if [ "${ipv6}" = "true" ] ; then
96 | ${ip6tables_wait} -t mangle -N FILTER_OUT_CLASH
97 |
98 | for subnet6 in ${reserved_ip6[*]} ; do
99 | ${ip6tables_wait} -t mangle -A FILTER_OUT_CLASH -d ${subnet6} -j ACCEPT
100 | done
101 |
102 | if [ "${mode}" = "blacklist" ] ; then
103 | for appuid in ${apps} ; do
104 | ${ip6tables_wait} -t mangle -A FILTER_OUT_CLASH -m owner --uid-owner ${appuid} -j ACCEPT
105 | done
106 |
107 | ${ip6tables_wait} -t mangle -A FILTER_OUT_CLASH -m owner ! --gid-owner ${Clash_group} -j CLASH_OUT
108 | elif [ "${mode}" = "whitelist" ] ; then
109 | for appuid in ${apps} ; do
110 | ${ip6tables_wait} -t mangle -A FILTER_OUT_CLASH -m owner --uid-owner ${appuid} -j CLASH_OUT
111 | done
112 | fi
113 | fi
114 | }
115 |
116 | create_nat_prerouting_dns() {
117 | ${iptables_wait} -t nat -N DNS_PRE
118 |
119 | ${iptables_wait} -t nat -A DNS_PRE -p udp -j REDIRECT --to-ports ${Clash_dns_port}
120 | if [ "${ipv6}" = "true" ] ; then
121 | if [ "${nat_kernel}" = "true" ] ; then
122 | ${ip6tables_wait} -t nat -N DNS_PRE
123 |
124 | ${ip6tables_wait} -t nat -A DNS_PRE -p udp -j REDIRECT --to-ports ${Clash_dns_port}
125 | fi
126 | fi
127 | }
128 |
129 | create_nat_output_dns() {
130 | ${iptables_wait} -t nat -N DNS_OUT
131 |
132 | ${iptables_wait} -t nat -A DNS_OUT -p udp -j REDIRECT --to-ports ${Clash_dns_port}
133 | if [ "${ipv6}" = "true" ] ; then
134 | if [ "${nat_kernel}" = "true" ] ; then
135 | ${ip6tables_wait} -t nat -N DNS_OUT
136 |
137 | ${ip6tables_wait} -t nat -A DNS_OUT -p udp -j REDIRECT --to-ports ${Clash_dns_port}
138 | fi
139 | fi
140 | }
141 |
142 | create_nat_output_filter() {
143 | ${iptables_wait} -t nat -N FILTER_OUT_DNS
144 |
145 | ${iptables_wait} -t nat -A FILTER_OUT_DNS -m owner --gid-owner ${Clash_group} -j ACCEPT
146 | ${iptables_wait} -t nat -A FILTER_OUT_DNS -p udp --dport 53 -j DNS_OUT
147 | if [ "${ipv6}" = "true" ] ; then
148 | if [ "${nat_kernel}" = "true" ] ; then
149 | ${ip6tables_wait} -t nat -N FILTER_OUT_DNS
150 |
151 | ${ip6tables_wait} -t nat -A FILTER_OUT_DNS -m owner --gid-owner ${Clash_group} -j ACCEPT
152 | ${ip6tables_wait} -t nat -A FILTER_OUT_DNS -p udp --dport 53 -j DNS_OUT
153 | fi
154 | fi
155 | }
156 |
157 | create_nat_prerouting_filter() {
158 | ${iptables_wait} -t nat -N FILTER_PRE_DNS
159 |
160 | ${iptables_wait} -t nat -A FILTER_PRE_DNS -p udp --dport 53 -j DNS_PRE
161 | if [ "${ipv6}" = "true" ] ; then
162 | if [ "${nat_kernel}" = "true" ] ; then
163 | ${ip6tables_wait} -t nat -N FILTER_PRE_DNS
164 |
165 | ${ip6tables_wait} -t nat -A FILTER_PRE_DNS -p udp --dport 53 -j DNS_PRE
166 | fi
167 | fi
168 | }
169 |
170 | creat_pre_divert() {
171 | ${iptables_wait} -t mangle -N DIVERT
172 |
173 | ${iptables_wait} -t mangle -A DIVERT -j MARK --set-mark ${mark_id}
174 |
175 | ${iptables_wait} -t mangle -A DIVERT -j ACCEPT
176 | if [ "${ipv6}" = "true" ] ; then
177 | ${ip6tables_wait} -t mangle -N DIVERT
178 |
179 | ${ip6tables_wait} -t mangle -A DIVERT -j MARK --set-mark ${mark_id}
180 |
181 | ${ip6tables_wait} -t mangle -A DIVERT -j ACCEPT
182 | fi
183 | }
184 |
185 | apply_rules() {
186 | create_mangle_prerouting_chain
187 | create_mangle_prerouting_filter
188 |
189 | create_mangle_output_chain
190 | create_mangle_output_filter
191 |
192 | create_nat_prerouting_dns
193 | create_nat_prerouting_filter
194 |
195 | create_nat_output_dns
196 | create_nat_output_filter
197 |
198 | creat_pre_divert
199 | ${iptables_wait} -t mangle -A PREROUTING -p tcp -m socket -j DIVERT
200 | ${iptables_wait} -t mangle -A PREROUTING -p udp -m socket -j DIVERT
201 |
202 | ${iptables_wait} -t mangle -N FILTER_LOCAL_IP
203 | ${iptables_wait} -t mangle -A PREROUTING -j FILTER_LOCAL_IP
204 | ${iptables_wait} -t mangle -A OUTPUT -j FILTER_LOCAL_IP
205 |
206 | ${iptables_wait} -t mangle -A PREROUTING -j FILTER_PRE_CLASH
207 | ${iptables_wait} -t mangle -A OUTPUT -j FILTER_OUT_CLASH
208 |
209 | ${iptables_wait} -t nat -A PREROUTING -j FILTER_PRE_DNS
210 | ${iptables_wait} -t nat -A OUTPUT -j FILTER_OUT_DNS
211 |
212 | if [ "${ipv6}" = "true" ] ; then
213 | ${ip6tables_wait} -t mangle -A PREROUTING -p tcp -m socket -j DIVERT
214 | ${ip6tables_wait} -t mangle -A PREROUTING -p udp -m socket -j DIVERT
215 |
216 | ${ip6tables_wait} -t mangle -N FILTER_LOCAL_IP
217 | ${ip6tables_wait} -t mangle -A PREROUTING -j FILTER_LOCAL_IP
218 | ${ip6tables_wait} -t mangle -A OUTPUT -j FILTER_LOCAL_IP
219 |
220 | ${ip6tables_wait} -t mangle -A PREROUTING -j FILTER_PRE_CLASH
221 | ${ip6tables_wait} -t mangle -A OUTPUT -j FILTER_OUT_CLASH
222 |
223 | if [ "${nat_kernel}" = "true" ] ; then
224 | ${ip6tables_wait} -t nat -A PREROUTING -j FILTER_PRE_DNS
225 | ${ip6tables_wait} -t nat -A OUTPUT -j FILTER_OUT_DNS
226 | else
227 | ${ip6tables_wait} -I OUTPUT -p udp --dport 53 -j DROP
228 | fi
229 | fi
230 |
231 | ${scripts_dir}/clash.tool -m
232 | }
233 |
234 | flush_rules() {
235 | ${iptables_wait} -t nat -D OUTPUT -j FILTER_OUT_DNS
236 | ${iptables_wait} -t nat -D PREROUTING -j FILTER_PRE_DNS
237 |
238 | ${iptables_wait} -t mangle -D OUTPUT -j FILTER_OUT_CLASH
239 | ${iptables_wait} -t mangle -D PREROUTING -j FILTER_PRE_CLASH
240 |
241 | ${iptables_wait} -t mangle -D OUTPUT -j FILTER_LOCAL_IP
242 | ${iptables_wait} -t mangle -D PREROUTING -j FILTER_LOCAL_IP
243 | ${iptables_wait} -t mangle -F FILTER_LOCAL_IP
244 | ${iptables_wait} -t mangle -X FILTER_LOCAL_IP
245 |
246 | ${iptables_wait} -t mangle -D PREROUTING -p tcp -m socket -j DIVERT
247 | ${iptables_wait} -t mangle -D PREROUTING -p udp -m socket -j DIVERT
248 | ${iptables_wait} -t mangle -F DIVERT
249 | ${iptables_wait} -t mangle -X DIVERT
250 |
251 | ${iptables_wait} -t nat -F FILTER_OUT_DNS
252 | ${iptables_wait} -t nat -X FILTER_OUT_DNS
253 | ${iptables_wait} -t nat -F DNS_OUT
254 | ${iptables_wait} -t nat -X DNS_OUT
255 |
256 | ${iptables_wait} -t nat -F FILTER_PRE_DNS
257 | ${iptables_wait} -t nat -X FILTER_PRE_DNS
258 | ${iptables_wait} -t nat -F DNS_PRE
259 | ${iptables_wait} -t nat -X DNS_PRE
260 |
261 | ${iptables_wait} -t mangle -F FILTER_OUT_CLASH
262 | ${iptables_wait} -t mangle -X FILTER_OUT_CLASH
263 | ${iptables_wait} -t mangle -F CLASH_OUT
264 | ${iptables_wait} -t mangle -X CLASH_OUT
265 |
266 | ${iptables_wait} -t mangle -F FILTER_PRE_CLASH
267 | ${iptables_wait} -t mangle -X FILTER_PRE_CLASH
268 | ${iptables_wait} -t mangle -F CLASH_PRE
269 | ${iptables_wait} -t mangle -X CLASH_PRE
270 |
271 | if [ "${ipv6}" = "true" ] ; then
272 |
273 | if [ "${nat_kernel}" = "true" ] ; then
274 | ${ip6tables_wait} -t nat -D OUTPUT -j FILTER_OUT_DNS
275 | ${ip6tables_wait} -t nat -D PREROUTING -j FILTER_PRE_DNS
276 | ${ip6tables_wait} -t nat -F FILTER_OUT_DNS
277 | ${ip6tables_wait} -t nat -X FILTER_OUT_DNS
278 | ${ip6tables_wait} -t nat -F DNS_OUT
279 | ${ip6tables_wait} -t nat -X DNS_OUT
280 | ${ip6tables_wait} -t nat -F FILTER_PRE_DNS
281 | ${ip6tables_wait} -t nat -X FILTER_PRE_DNS
282 | ${ip6tables_wait} -t nat -F DNS_PRE
283 | ${ip6tables_wait} -t nat -X DNS_PRE
284 | else
285 | ${ip6tables_wait} -D OUTPUT -p udp --dport 53 -j DROP
286 | fi
287 |
288 | ${ip6tables_wait} -t mangle -D OUTPUT -j FILTER_OUT_CLASH
289 | ${ip6tables_wait} -t mangle -D PREROUTING -j FILTER_PRE_CLASH
290 |
291 | ${ip6tables_wait} -t mangle -D OUTPUT -j FILTER_LOCAL_IP
292 | ${ip6tables_wait} -t mangle -D PREROUTING -j FILTER_LOCAL_IP
293 | ${ip6tables_wait} -t mangle -F FILTER_LOCAL_IP
294 | ${ip6tables_wait} -t mangle -X FILTER_LOCAL_IP
295 |
296 | ${ip6tables_wait} -t mangle -D PREROUTING -p tcp -m socket -j DIVERT
297 | ${ip6tables_wait} -t mangle -D PREROUTING -p udp -m socket -j DIVERT
298 | ${ip6tables_wait} -t mangle -F DIVERT
299 | ${ip6tables_wait} -t mangle -X DIVERT
300 |
301 | ${ip6tables_wait} -t mangle -F FILTER_OUT_CLASH
302 | ${ip6tables_wait} -t mangle -X FILTER_OUT_CLASH
303 | ${ip6tables_wait} -t mangle -F CLASH_OUT
304 | ${ip6tables_wait} -t mangle -X CLASH_OUT
305 |
306 | ${ip6tables_wait} -t mangle -F FILTER_PRE_CLASH
307 | ${ip6tables_wait} -t mangle -X FILTER_PRE_CLASH
308 | ${ip6tables_wait} -t mangle -F CLASH_PRE
309 | ${ip6tables_wait} -t mangle -X CLASH_PRE
310 | fi
311 |
312 | }
313 |
314 | set_tun(){
315 | ip -4 rule add fwmark ${mark_id} table ${table_id} pref ${pref_id}
316 | while [ "$(ip -4 route show table ${table_id} 2> /dev/null)" == "" ]
317 | do
318 | ip -4 route add default dev ${tun_device} table ${table_id}
319 | done
320 | ${iptables_wait} -I FORWARD -o ${tun_device} -j ACCEPT
321 | ${iptables_wait} -I FORWARD -i ${tun_device} -j ACCEPT
322 |
323 | ${iptables_wait} -t mangle -N CLASH_OUT
324 | ${iptables_wait} -t mangle -A CLASH_OUT -m owner --uid-owner ${Clash_user} --gid-owner ${Clash_group} -j RETURN
325 | for subnet in ${reserved_ip[*]} ; do
326 | ${iptables_wait} -t mangle -A CLASH_OUT -d ${subnet} -j RETURN
327 | done
328 | ${scripts_dir}/clash.tool -f
329 | apps=`cat ${appuid_file} | sort -u`
330 | if [ "${mode}" = "blacklist" ] ; then
331 | for appuid in ${apps} ; do
332 | ${iptables_wait} -t mangle -A CLASH_OUT -m owner --uid-owner ${appuid} -j RETURN
333 | done
334 | ${iptables_wait} -t mangle -A CLASH_OUT -j MARK --set-xmark ${mark_id}
335 | elif [ "${mode}" = "whitelist" ] ; then
336 | for appuid in ${apps} ; do
337 | ${iptables_wait} -t mangle -A CLASH_OUT -m owner --uid-owner ${appuid} -j MARK --set-xmark ${mark_id}
338 | done
339 | fi
340 | ${iptables_wait} -t mangle -A OUTPUT -j CLASH_OUT
341 |
342 | ${iptables_wait} -t mangle -N CLASH_PRE
343 | for subnet in ${reserved_ip[*]} ; do
344 | ${iptables_wait} -t mangle -A CLASH_PRE -d ${subnet} -j RETURN
345 | done
346 | ${iptables_wait} -t mangle -A CLASH_PRE -j MARK --set-xmark ${mark_id}
347 | ${iptables_wait} -t mangle -A PREROUTING -j CLASH_PRE
348 |
349 | if [ "${ipv6}" = "true" ] ; then
350 | ip -6 rule add fwmark ${mark_id} table ${table_id} pref ${pref_id}
351 | while [ "$(ip -6 route show table ${table_id} 2> /dev/null)" == "" ]
352 | do
353 | ip -6 route add default dev ${tun_device} table ${table_id}
354 | done
355 | ${ip6tables_wait} -I FORWARD -o ${tun_device} -j ACCEPT
356 | ${ip6tables_wait} -I FORWARD -i ${tun_device} -j ACCEPT
357 |
358 | ${ip6tables_wait} -t mangle -N CLASH_OUT
359 | ${ip6tables_wait} -t mangle -A CLASH_OUT -m owner --uid-owner ${Clash_user} --gid-owner ${Clash_group} -j RETURN
360 | for subnet in ${reserved_ip6[*]} ; do
361 | ${ip6tables_wait} -t mangle -A CLASH_OUT -d ${subnet} -j RETURN
362 | done
363 | if [ "${mode}" = "blacklist" ] ; then
364 | for appuid in ${apps} ; do
365 | ${ip6tables_wait} -t mangle -A CLASH_OUT -m owner --uid-owner ${appuid} -j RETURN
366 | done
367 | ${ip6tables_wait} -t mangle -A CLASH_OUT -j MARK --set-xmark ${mark_id}
368 | elif [ "${mode}" = "whitelist" ] ; then
369 | for appuid in ${apps} ; do
370 | ${ip6tables_wait} -t mangle -A CLASH_OUT -m owner --uid-owner ${appuid} -j MARK --set-xmark ${mark_id}
371 | done
372 | fi
373 | ${ip6tables_wait} -t mangle -I OUTPUT -j CLASH_OUT
374 |
375 | ${ip6tables_wait} -t mangle -N CLASH_PRE
376 | for subnet in ${reserved_ip6[*]} ; do
377 | ${ip6tables_wait} -t mangle -A CLASH_PRE -d ${subnet} -j RETURN
378 | done
379 | ${ip6tables_wait} -t mangle -A CLASH_PRE -j MARK --set-xmark ${mark_id}
380 | ${ip6tables_wait} -t mangle -I PREROUTING -j CLASH_PRE
381 | else
382 | echo 1 > /proc/sys/net/ipv6/conf/${tun_device}/disable_ipv6
383 | echo dr
384 | ${ip6tables_wait} -t mangle -I OUTPUT -j DROP
385 | fi
386 | }
387 |
388 | del_tun(){
389 | ip -4 rule del fwmark ${mark_id} lookup ${table_id}
390 | ip -4 route del default dev ${tun_device} table ${table_id}
391 |
392 | ${iptables_wait} -D FORWARD -o ${tun_device} -j ACCEPT
393 | ${iptables_wait} -D FORWARD -i ${tun_device} -j ACCEPT
394 |
395 | ${iptables_wait} -t mangle -D OUTPUT -j CLASH_OUT
396 | ${iptables_wait} -t mangle -F CLASH_OUT
397 | ${iptables_wait} -t mangle -X CLASH_OUT
398 |
399 | ${iptables_wait} -t mangle -D PREROUTING -j CLASH_PRE
400 | ${iptables_wait} -t mangle -F CLASH_PRE
401 | ${iptables_wait} -t mangle -X CLASH_PRE
402 |
403 | ip -6 rule del fwmark ${mark_id} lookup ${table_id}
404 | ip -6 route del default dev ${tun_device} table ${table_id}
405 |
406 | ${ip6tables_wait} -D FORWARD -o ${tun_device} -j ACCEPT
407 | ${ip6tables_wait} -D FORWARD -i ${tun_device} -j ACCEPT
408 |
409 | ${ip6tables_wait} -t mangle -D OUTPUT -j CLASH_OUT
410 | ${ip6tables_wait} -t mangle -F CLASH_OUT
411 | ${ip6tables_wait} -t mangle -X CLASH_OUT
412 |
413 | ${ip6tables_wait} -t mangle -D PREROUTING -j CLASH_PRE
414 | ${ip6tables_wait} -t mangle -F CLASH_PRE
415 | ${ip6tables_wait} -t mangle -X CLASH_PRE
416 |
417 | ${ip6tables_wait} -t mangle -D OUTPUT -j DROP
418 | }
419 |
420 |
421 | while getopts ":sk" signal ; do
422 | case ${signal} in
423 | s)
424 | if [ "${mode}" = "blacklist" ] || [ "${mode}" = "whitelist" ] ; then
425 | if [ "${Clash_tun_status}" == "true" ]; then
426 | echo [`TZ=Asia/Shanghai date "+%H:%M:%S"`]"info: use Tun." >> ${CFM_logs_file}
427 | if [ "${Clash_auto_route}" == "true" ]; then
428 | ${iptables_wait} -I FORWARD -o ${tun_device} -j ACCEPT
429 | ${iptables_wait} -I FORWARD -i ${tun_device} -j ACCEPT
430 | ${ip6tables_wait} -I FORWARD -o ${tun_device} -j ACCEPT
431 | ${ip6tables_wait} -I FORWARD -i ${tun_device} -j ACCEPT
432 | exit 0
433 | else
434 | set_tun
435 | fi
436 | else
437 | echo [`TZ=Asia/Shanghai date "+%H:%M:%S"`]"info: use tproxy." >> ${CFM_logs_file}
438 | create_rule_rules && apply_rules
439 | fi
440 | echo [`TZ=Asia/Shanghai date "+%H:%M:%S"`]"info: iptables规则已应用." >> ${CFM_logs_file}
441 | else
442 | exit 0
443 | fi
444 | ;;
445 | k)
446 | if [ "${mode}" = "blacklist" ] || [ "${mode}" = "whitelist" ] ; then
447 | del_tun
448 | flush_rule_rules && flush_rules
449 | echo [`TZ=Asia/Shanghai date "+%H:%M:%S"`]"info: iptables规则已清空." >> ${CFM_logs_file}
450 | else
451 | exit 0
452 | fi
453 | ;;
454 | ?)
455 | echo ""
456 | ;;
457 | esac
458 | done
459 |
--------------------------------------------------------------------------------
/clash/scripts/clash.service:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 |
3 | scripts=`realpath $0`
4 | scripts_dir=`dirname ${scripts}`
5 | . /data/clash/clash.config
6 |
7 | get_uid(){
8 | uid_proxy="payload:"
9 | for app in $1 ; do
10 | app_uid=$(dumpsys package $app | grep "userId" | tail -n -1 | cut -c 12-)
11 | if [ -n "$app_uid" ] ; then
12 | uid_proxy+="\n - UID,"${app_uid}
13 | fi
14 | done
15 | echo $uid_proxy > $2
16 | }
17 |
18 | start_clash() {
19 | if [ -n "$app_proxy" ] ; then
20 | get_uid "$app_proxy" "${Clash_data_dir}/rule_providers/${proxy_file}"
21 | fi
22 | if [ -n "$app_direct" ] ; then
23 | get_uid "$app_direct" "${Clash_data_dir}/rule_providers/${direct_file}"
24 | fi
25 | if [ "${ipv6}" = "false" ] ; then
26 | for net in /proc/sys/net/ipv6/conf/{wlan*,*data*} ; do
27 | echo ${net} | grep -q wlan
28 | if [ $? -eq 0 ] ; then
29 | echo 0 > ${net}/accept_ra
30 | fi
31 | echo 1 > ${net}/disable_ipv6
32 | done
33 | else
34 | for net in /proc/sys/net/ipv6/conf/{wlan*,*data*} ; do
35 | echo ${net} | grep -q wlan
36 | if [ $? -eq 0 ] ; then
37 | echo 1 > ${net}/accept_ra
38 | fi
39 | echo 0 > ${net}/disable_ipv6
40 | done
41 | fi
42 | echo "" > ${CFM_logs_file}
43 | pid=`cat ${Clash_pid_file} 2> /dev/null`
44 | if (cat /proc/${pid}/cmdline | grep -q clash) ; then
45 | echo [`TZ=Asia/Shanghai date "+%H:%M:%S"`]"info: 检测到clash已启动,此次不启动." >> ${CFM_logs_file}
46 | exit 1
47 | fi
48 |
49 | if [ "${Clash_tproxy_port}" == 0 ] || [ "${Clash_tproxy_port}" == "" ]; then
50 | if [ "${Clash_tun_status}" != "true" ]; then
51 | echo [`TZ=Asia/Shanghai date "+%H:%M:%S"`]"err: tproxy和tun得二选一." >> ${CFM_logs_file}
52 | exit 1
53 | fi
54 | fi
55 |
56 | cp -f ${template_file} ${temporary_config_file}.swp && echo "\n" >> ${temporary_config_file}.swp
57 | sed -n -E '/^proxies:.*$/,$p' ${Clash_config_file} >> ${temporary_config_file}.swp
58 | sed -i '/^[ ]*$/d' ${temporary_config_file}.swp
59 |
60 | mv -f ${temporary_config_file}.swp ${temporary_config_file} \
61 | && echo "" >> ${CFM_logs_file} || echo [`TZ=Asia/Shanghai date "+%H:%M:%S"`]"err:配置文件合并失败"
62 |
63 | if [ -f "${Clash_bin_path}" ] ; then
64 | mkdir -p ${Clash_run_path}
65 | chown ${Clash_user_group} ${Clash_bin_path}
66 | chmod ${Clash_permissions} ${Clash_bin_path}
67 | chown ${Clash_user_group} ${temporary_config_file}
68 | chmod 0644 ${temporary_config_file}
69 |
70 | ${busybox_path} crontab -c ${Clash_run_path} -r
71 | touch ${Clash_run_path}/root
72 | chmod 0600 ${Clash_run_path}/root
73 |
74 | if [ "${auto_updateGeoSite}" == "true" ]; then
75 | echo "${update_geoXInterval} ${scripts_dir}/clash.tool -u" >> ${Clash_run_path}/root \
76 | && echo [`TZ=Asia/Shanghai date "+%H:%M:%S"`]"info: 自动更新GeoX定时已开启." >> ${CFM_logs_file}
77 | fi
78 |
79 | if [ "${auto_updateSubcript}" == "true" ]; then
80 | echo "${update_subcriptInterval} ${scripts_dir}/clash.tool -s" >> ${Clash_run_path}/root \
81 | && echo [`TZ=Asia/Shanghai date "+%H:%M:%S"`]"info: 自动更新订阅定时已开启." >> ${CFM_logs_file}
82 | fi
83 |
84 | sed -i '/^[ ]*$/d' ${CFM_logs_file}
85 | if [ "${filter_local}" = "true" ] ; then
86 | com="${scripts_dir}/clash.tool -m ; sleep 10 ;${scripts_dir}/clash.tool -m ; sleep 10; ${scripts_dir}/clash.tool -m ;sleep 10; ${scripts_dir}/clash.tool -m;sleep 10;${scripts_dir}/clash.tool -m ; sleep 10;${scripts_dir}/clash.tool -m"
87 | echo "*/1 * * * * ${com}" >> ${Clash_run_path}/root && echo [`TZ=Asia/Shanghai date "+%H:%M:%S"`]"info: 自动绕过本地ip段已打开." >> ${CFM_logs_file}
88 | fi
89 | else
90 | echo [`TZ=Asia/Shanghai date "+%H:%M:%S"`]"err: clash内核丢失." >> ${CFM_logs_file}
91 | exit 1
92 | fi
93 |
94 | if [ -f ${temporary_config_file} ] && [ -f ${Clash_GeoIP_file} ] ; then
95 | if $(${Clash_bin_path} -d ${Clash_data_dir} -t -f ${temporary_config_file} > /dev/null) ; then
96 | if [ "${Clash_tun_status}" == "true" ]; then
97 | mkdir -p /dev/net
98 | ln -sf /dev/tun /dev/net/tun
99 | fi
100 | mv /data/clash/run/kernel.log /data/clash/run/kernel.old.log
101 | ulimit -SHn 1000000
102 | nohup ${busybox_path} setuidgid ${Clash_user_group} ${Clash_bin_path} -d ${Clash_data_dir} -f ${temporary_config_file} > /data/clash/run/kernel.log 2>&1 &
103 | echo -n $! > ${Clash_pid_file}
104 | ${scripts_dir}/clash.tool -l
105 | echo [`TZ=Asia/Shanghai date "+%H:%M:%S"`]"info: clash内核已启动." >> ${CFM_logs_file}
106 | ${scripts_dir}/upSub.sh -s
107 | echo "0 * * * * ${scripts_dir}/upSub.sh -s " >> ${Clash_run_path}/root \
108 | && echo [`TZ=Asia/Shanghai date "+%H:%M:%S"`]"info: 自动更新套餐流量已开启." >> ${CFM_logs_file}
109 | else
110 | echo [`TZ=Asia/Shanghai date "+%H:%M:%S"`]"info: Clash启动失败 配置错误 错误信息" >> ${CFM_logs_file}
111 | $(${Clash_bin_path} -d ${Clash_data_dir} -f ${Clash_config_file} -t | grep error| awk -F 'msg=' '{print $2}'>> ${CFM_logs_file})
112 | kill -15 cat ${Clash_pid_file}
113 | exit 1
114 | fi
115 | else
116 | echo [`TZ=Asia/Shanghai date "+%H:%M:%S"`]"info: 文件缺失." >> ${CFM_logs_file}
117 | exit 1
118 | fi
119 |
120 | #return # 去掉端口检查
121 |
122 | if [ "${Clash_tun_status}" == "true" ]; then
123 | return
124 | fi
125 | sleep 5
126 | if ! (${scripts_dir}/clash.tool -p) ; then
127 | kill -15 `cat ${Clash_pid_file}`
128 | rm -rf ${Clash_pid_file}
129 | echo [`TZ=Asia/Shanghai date "+%H:%M:%S"`]"err: 端口未检测到,已停止clash内核以及后续逻辑." >> ${CFM_logs_file}
130 | exit 1
131 | fi
132 | }
133 |
134 | stop_clash() {
135 | kill -15 `cat ${Clash_pid_file}`
136 | echo [`TZ=Asia/Shanghai date "+%H:%M:%S"`]"info: 停止clash内核.\n" >> ${CFM_logs_file}
137 | rm -rf ${Clash_run_path}/root \
138 | && echo [`TZ=Asia/Shanghai date "+%H:%M:%S"`]"info: 自动更新流量信息已关闭." >> ${CFM_logs_file}
139 | }
140 |
141 | while getopts ":sk" signal ; do
142 | case ${signal} in
143 | s)
144 | start_clash
145 | ;;
146 | k)
147 | stop_clash
148 | ;;
149 | ?)
150 | echo ""
151 | ;;
152 | esac
153 | done
154 |
--------------------------------------------------------------------------------
/clash/scripts/clash.tool:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 |
3 | scripts=$(realpath $0)
4 | scripts_dir=$(dirname ${scripts})
5 | . /data/clash/clash.config
6 |
7 | monitor_local_ipv4() {
8 |
9 | change=false
10 |
11 | wifistatus=$(dumpsys connectivity | grep "WIFI" | grep "state:" | awk -F ", " '{print $2}' | awk -F "=" '{print $2}' 2>&1)
12 |
13 | if [ ! -z "${wifistatus}" ]; then
14 | if test ! "${wifistatus}" = "$(cat ${Clash_run_path}/lastwifi)"; then
15 | change=true
16 | echo "${wifistatus}" >${Clash_run_path}/lastwifi
17 | elif [ "$(ip route get 1.2.3.4 | awk '{print $5}' 2>&1)" != "wlan0" ]; then
18 | change=true
19 | echo "${wifistatus}" >${Clash_run_path}/lastwifi
20 | fi
21 | else
22 | echo "" >${Clash_run_path}/lastwifi
23 | fi
24 |
25 | if [ "$(settings get global mobile_data 2>&1)" -eq 1 ] || [ "$(settings get global mobile_data1 2>&1)" -eq 1 ]; then
26 | if [ ! "${mobilestatus}" = "$(cat ${Clash_run_path}/lastmobile)" ]; then
27 | change=true
28 | echo "${mobilestatus}" >${Clash_run_path}/lastmobile
29 | fi
30 | fi
31 |
32 | if [ ${change} == true ]; then
33 |
34 | local_ipv4=$(ip a | awk '$1~/inet$/{print $2}')
35 | local_ipv6=$(ip -6 a | awk '$1~/inet6$/{print $2}')
36 | rules_ipv4=$(${iptables_wait} -t mangle -nvL FILTER_LOCAL_IP | grep "ACCEPT" | awk '{print $9}' 2>&1)
37 | rules_ipv6=$(${ip6tables_wait} -t mangle -nvL FILTER_LOCAL_IP | grep "ACCEPT" | awk '{print $8}' 2>&1)
38 |
39 | for rules_subnet in ${rules_ipv4[*]}; do
40 | ${iptables_wait} -t mangle -D FILTER_LOCAL_IP -d ${rules_subnet} -j ACCEPT
41 | done
42 |
43 | for subnet in ${local_ipv4[*]}; do
44 | if ! (${iptables_wait} -t mangle -C FILTER_LOCAL_IP -d ${subnet} -j ACCEPT >/dev/null 2>&1); then
45 | ${iptables_wait} -t mangle -I FILTER_LOCAL_IP -d ${subnet} -j ACCEPT
46 | fi
47 | done
48 |
49 | for rules_subnet6 in ${rules_ipv6[*]}; do
50 | ${ip6tables_wait} -t mangle -D FILTER_LOCAL_IP -d ${rules_subnet6} -j ACCEPT
51 | done
52 |
53 | for subnet6 in ${local_ipv6[*]}; do
54 | if ! (${ip6tables_wait} -t mangle -C FILTER_LOCAL_IP -d ${subnet6} -j ACCEPT >/dev/null 2>&1); then
55 | ${ip6tables_wait} -t mangle -I FILTER_LOCAL_IP -d ${subnet6} -j ACCEPT
56 | fi
57 | done
58 | fi
59 |
60 | unset local_ipv4
61 | unset rules_ipv4
62 | unset local_ipv6
63 | unset rules_ipv6
64 | unset wifistatus
65 | unset mobilestatus
66 | unset change
67 | }
68 |
69 | restart_clash() {
70 | ${scripts_dir}/clash.service -k && ${scripts_dir}/clash.iptables -k
71 | ${scripts_dir}/clash.service -s && ${scripts_dir}/clash.iptables -s
72 | if [ "$?" == "0" ]; then
73 | echo [$(TZ=Asia/Shanghai date "+%H:%M:%S")]"info: 内核成功重启." >>${CFM_logs_file}
74 | else
75 | echo [$(TZ=Asia/Shanghai date "+%H:%M:%S")]"err: 内核重启失败." >>${CFM_logs_file}
76 | fi
77 | }
78 |
79 | keep_dns() {
80 | local_dns=$(getprop net.dns1)
81 |
82 | if [ "${local_dns}" != "${static_dns}" ]; then
83 | for count in $(seq 1 $(getprop | grep dns | wc -l)); do
84 | setprop net.dns${count} ${static_dns}
85 | done
86 | fi
87 |
88 | if [ $(sysctl net.ipv4.ip_forward) != "1" ]; then
89 | sysctl -w net.ipv4.ip_forward=1
90 | fi
91 |
92 | unset local_dns
93 | }
94 |
95 | updateFile() {
96 | file="$1"
97 | file_bk="${file}.bk"
98 | update_url="$2"
99 |
100 | mv -f ${file} ${file_bk}
101 | echo "curl -L -A 'clash' ${update_url} -o ${file} "
102 | curl -L -A 'clash' ${update_url} -o ${file} 2>&1 # >> /dev/null 2>&1
103 |
104 | sleep 1
105 |
106 | if [ -f "${file}" ]; then
107 | rm -rf ${file_bk}
108 |
109 | echo [$(TZ=Asia/Shanghai date "+%H:%M:%S")]"info: ${file}更新成功." >>${CFM_logs_file}
110 | else
111 | mv ${file_bk} ${file}
112 | echo [$(TZ=Asia/Shanghai date "+%H:%M:%S")]"war: ${file}更新失败,文件已恢复.." >>${CFM_logs_file}
113 | return 1
114 | fi
115 | }
116 |
117 | find_packages_uid() {
118 | rm -f ${appuid_file}.tmp
119 | hd=""
120 | for package in $(cat ${filter_packages_file}); do
121 | if [ "${Clash_enhanced_mode}" == "fake-ip" ] && [ "${Clash_tun_status}" != "true" ]; then
122 | echo [$(TZ=Asia/Shanghai date "+%H:%M:%S")]"war: Tproxy_fake-ip下禁用黑白名单." >>${CFM_logs_file}
123 | return
124 | fi
125 | nhd=$(awk -F ">" '/^[0-9]+>$/{print $1}' <<< "${package}")
126 | if [ "${nhd}" != "" ]; then
127 | hd=${nhd}
128 | continue
129 | fi
130 | uid=$(awk '$1~/'^"${package}"$'/{print $2}' ${system_packages_file})
131 | if [ "${uid}" == "" ]; then
132 | echo [$(TZ=Asia/Shanghai date "+%H:%M:%S")]"warn: ${package}未找到." >>${CFM_logs_file}
133 | continue
134 | fi
135 | echo "${hd}${uid}" >> ${appuid_file}.tmp
136 | if [ "${mode}" = "blacklist" ]; then
137 | echo [$(TZ=Asia/Shanghai date "+%H:%M:%S")]"info: ${hd}${package}已过滤." >>${CFM_logs_file}
138 | elif [ "${mode}" = "whitelist" ]; then
139 | echo [$(TZ=Asia/Shanghai date "+%H:%M:%S")]"info: ${hd}${package}已代理." >>${CFM_logs_file}
140 | fi
141 | done
142 | rm -f ${appuid_file}
143 | for uid in $(cat ${appuid_file}.tmp | sort -u); do
144 | echo ${uid} >> ${appuid_file}
145 | done
146 | rm -f ${appuid_file}.tmp
147 | }
148 |
149 | port_detection() {
150 | clash_pid=$(cat ${Clash_pid_file})
151 | match_count=0
152 |
153 | if ! (ss -h >/dev/null 2>&1); then
154 | clash_port=$(netstat -anlp | grep -v p6 | grep "clash" | awk '$6~/'"${clash_pid}"*'/{print $4}' | awk -F ':' '{print $2}' | sort -u)
155 | else
156 | clash_port=$(ss -antup | grep "clash" | awk '$7~/'pid="${clash_pid}"*'/{print $5}' | awk -F ':' '{print $2}' | sort -u)
157 | fi
158 |
159 | if ! (echo ${clash_port} | grep ${Clash_tproxy_port}); then
160 | echo [$(TZ=Asia/Shanghai date "+%H:%M:%S")]"err: tproxy端口未启动." >>${CFM_logs_file}
161 | exit 1
162 | fi
163 |
164 | if ! (echo ${clash_port} | grep ${Clash_dns_port}); then
165 | echo [$(TZ=Asia/Shanghai date "+%H:%M:%S")]"err: dns端口未启动." >>${CFM_logs_file}
166 | exit 1
167 | fi
168 | echo [$(TZ=Asia/Shanghai date "+%H:%M:%S")]"info: tproxy和dns端口已启动." >>${CFM_logs_file}
169 | exit 0
170 | }
171 |
172 | update_pre() {
173 | flag=false
174 |
175 | if [ ${auto_updateGeoIP} == "true" ]; then
176 | updateFile ${Clash_GeoIP_file} ${GeoIP_url}
177 | if [ "$?" = "0" ]; then
178 | flag=true
179 | fi
180 | fi
181 |
182 | if [ ${auto_updateGeoSite} == "true" ]; then
183 | updateFile ${Clash_GeoSite_file} ${GeoSite_url}
184 | if [ "$?" = "0" ]; then
185 | flag=true
186 | fi
187 | fi
188 |
189 | if [ -f "${Clash_pid_file}" ] && [ ${flag} == true ]; then
190 | restart_clash
191 | fi
192 | }
193 |
194 | limit_clash() {
195 | if [ "${Cgroup_memory_limit}" == "" ]; then
196 | return
197 | fi
198 |
199 | if [ "${Cgroup_memory_path}" == "" ]; then
200 | Cgroup_memory_path=$(mount | grep cgroup | awk '/memory/{print $3}' | head -1)
201 | if [ "${Cgroup_memory_path}" == "" ]; then
202 | echo [$(TZ=Asia/Shanghai date "+%H:%M:%S")]"err: 自动获取Cgroup_memory_path失败." >>${CFM_logs_file}
203 | return
204 | fi
205 | fi
206 |
207 | mkdir "${Cgroup_memory_path}/clash"
208 | echo $(cat ${Clash_pid_file}) >"${Cgroup_memory_path}/clash/cgroup.procs"
209 | echo "${Cgroup_memory_limit}" >"${Cgroup_memory_path}/clash/memory.limit_in_bytes"
210 |
211 | echo [$(TZ=Asia/Shanghai date "+%H:%M:%S")]"info: 限制内存: ${Cgroup_memory_limit}." >>${CFM_logs_file}
212 | }
213 |
214 | while getopts ":kfmpusl" signal; do
215 | case ${signal} in
216 | u)
217 | update_pre
218 | ;;
219 | s)
220 | flag=false
221 | if [ ${auto_updateSubcript} == "true" ]; then
222 | updateFile ${Clash_config_file} ${Subcript_url}
223 | if [ "$?" = "0" ] && [ -f "${Clash_pid_file}" ]; then
224 | restart_clash
225 | fi
226 | fi
227 | ;;
228 | k)
229 | if [ "${mode}" = "blacklist" ] || [ "${mode}" = "whitelist" ]; then
230 | keep_dns
231 | else
232 | exit 0
233 | fi
234 | ;;
235 | f)
236 | find_packages_uid
237 | ;;
238 | m)
239 | if [ "${mode}" = "blacklist" ] && [ -f "${Clash_pid_file}" ]; then
240 | monitor_local_ipv4
241 | else
242 | exit 0
243 | fi
244 | ;;
245 | p)
246 | port_detection
247 | ;;
248 | l)
249 | limit_clash
250 | ;;
251 | ?)
252 | echo ""
253 | ;;
254 | esac
255 | done
256 |
--------------------------------------------------------------------------------
/clash/scripts/upSub.sh:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 | . /data/clash/clash.config
3 | scripts=`realpath $0`
4 | scripts_dir=`dirname ${scripts}`
5 | subItem=""
6 | bkPath="/data/clash/clash-dashboard/dist/subs"
7 | gotoUrl(){
8 | name="$1"
9 | url=${2}
10 | textIndex=1
11 | #echo ${name} ${url}
12 | echo "$(curl -H 'User-Agent:ClashforWindows/0.19.23' -I ${url})" >${scripts_dir}/${1//:/}
13 | hsums=$(cat "${scripts_dir}/${1//:/}" | wc -l)
14 | while (($textIndex<=$hsums)) do
15 | lin=$(sed -n ${textIndex},${textIndex}p "${scripts_dir}/${1//:/}");
16 | result=$(echo ${lin} | grep 'subscription-userinfo:')
17 | if [ "${result}" != "" ]; then
18 | echo ${lin//subscription-userinfo:/$1} >> "${bkPath}.bk"
19 | #subItem+=${lin//subscription-userinfo:/$1}"\n"
20 | rm -rf "${scripts_dir}/${1//:/}"
21 | # echo ${subItem}>>""
22 | break
23 | fi
24 | let 'textIndex++';
25 | done
26 | }
27 | UpStart(){
28 | i=1;
29 |
30 | echo [`TZ=Asia/Shanghai date "+%H:%M:%S"`]"info: 更新订阅流量." >> ${CFM_logs_file}
31 |
32 | sums=$(cat "${Clash_config_file}" | wc -l)
33 | #echo $(($sums-1))
34 | while (($i <= $sums )) do
35 | lin="$(sed -n ${i},${i}p "${Clash_config_file}")";
36 | lin2="";
37 | if [ ${i} -ge 2 ]; then
38 | Index=$(expr ${i} - 2)
39 | lin2="$(sed -n ${Index},"${Index}"p "${Clash_config_file}")";
40 | fi
41 | #echo ${lin}
42 | lin=${lin// /}
43 | result=$(echo ${lin} | grep 'url:"http')
44 | if [ "${result}" != "" ]; then
45 | {
46 | #echo ${lin2//:/}
47 | lin=${lin//"url:"/}
48 | #echo ${lin//'"'/}"&flag=clash"
49 | gotoUrl ${lin2} ${lin//'"'/}"&flag=clash"
50 | # sleep 5
51 | }&
52 | fi
53 | result=$(echo ${lin} | grep 'proxy-groups:')
54 | if [ "${result}" != "" ]; then
55 | #echo ${lin2//:/}
56 | #lin=${lin//"url:"/}
57 |
58 | break
59 | # sleep 5
60 | fi
61 | let 'i++';
62 | done;
63 | wait;
64 | echo `TZ=Asia/Shanghai date "+%Y-%m-%d %H:%M:%S"`>"${bkPath}";
65 | cat "${bkPath}.bk" >>"${bkPath}"
66 | rm "${bkPath}.bk";
67 |
68 | echo "解析完成 ${subItem}"
69 | }
70 | while getopts ":kfmpusl" signal; do
71 | case ${signal} in
72 | s)
73 | UpStart
74 | ;;
75 | k)
76 |
77 | ;;
78 | ?)
79 | echo ""
80 | ;;
81 | esac
82 | done
--------------------------------------------------------------------------------
/clash/scripts/更新hosts.sh:
--------------------------------------------------------------------------------
1 | mkdir -p /data/adb/modules/Clash_For_Magisk/system/etc/
2 | curl https://gitlab.com/ineo6/hosts/-/raw/master/next-hosts -o /data/adb/modules/Clash_For_Magisk/system/etc/hosts
--------------------------------------------------------------------------------
/clash/scripts/更新内核.sh:
--------------------------------------------------------------------------------
1 | url=$(curl -s https://api.github.com/repos/MetaCubeX/Clash.Meta/releases/tags/Prerelease-Alpha \
2 | | grep "download/Prerelease-Alpha/Clash.Meta-android-arm64-alpha" \
3 | | cut -d : -f 2,3 \
4 | | tr -d \")
5 |
6 | curl -L $url -o clash.gz
7 |
8 | gunzip clash.gz
9 |
10 | mv /data/adb/modules/Clash_For_Magisk/system/bin/clash /data/adb/modules/Clash_For_Magisk/system/bin/clash.bak
11 |
12 | mv clash /data/adb/modules/Clash_For_Magisk/system/bin/clash
13 |
14 | chmod 777 /data/adb/modules/Clash_For_Magisk/system/bin/clash
15 | echo 已安装最新版 meta alpha内核
--------------------------------------------------------------------------------
/clash/scripts/更新面板.sh:
--------------------------------------------------------------------------------
1 | cd /data/clash/clash-dashboard
2 | rm -rf gh-pages.zip
3 | wget https://github.com/MetaCubeX/Yacd-meta/archive/gh-pages.zip
4 | unzip gh-pages.zip
5 | rm -rf dist
6 | rm -rf gh-pages.zip
7 | mv Yacd-meta-gh-pages dist
--------------------------------------------------------------------------------
/clash/template:
--------------------------------------------------------------------------------
1 | tproxy-port: 7893
2 | mixd-prot: 7890
3 | allow-lan: true
4 | geodata-mode: true
5 | unified-delay: false
6 | mode: rule
7 | log-level: info
8 | ipv6: false
9 | udp: true
10 | tcp-concurrent: false
11 | enable-process: true
12 |
13 | sniffer:
14 | enable: false
15 | sniffing:
16 | - tls
17 | - http
18 | skip-domain:
19 | - 'Mijia Cloud'
20 | - 'dlg.io.mi.com'
21 | - '+.apple.com'
22 | - '*.baidu.com'
23 | force-domain:
24 | - '+'
25 | - 'google.com'
26 | port-whitelist:
27 | - 80
28 | - 443
29 | - 8000-9000
30 |
31 |
32 | profile:
33 | store-fake-ip: true
34 | store-selected: true
35 | external-controller: 0.0.0.0:9090
36 | external-ui: clash-dashboard/dist
37 |
38 | tun:
39 | enable: false
40 | device: Meta
41 | stack: system # gvisor
42 | dns-hijack:
43 | - any:53
44 | auto-route: true
45 | auto-detect-interface: true
46 | # 技术原因,enable必须在tun:的下一行
47 |
48 | dns:
49 | enable: true
50 | listen: 0.0.0.0:1053
51 | ipv6: false
52 | default-nameserver:
53 | - 8.8.8.8
54 | - 223.5.5.5
55 | enhanced-mode: redir-host # fake-ip
56 | use-hosts: true
57 | fake-ip-range: 198.18.0.1/16
58 | fake-ip-filter:
59 | - localhost.ptlogin2.qq.com
60 | - '*.lan'
61 | - '*.linksys.com'
62 | - '*.ntp.*'
63 | nameserver:
64 | - 119.29.29.29
65 | - 223.5.5.5
66 | fallback:
67 | - 1.1.1.1
68 | - 8.8.4.4#机场
69 | fallback-filter:
70 | geosite: ["!CN"]
71 | ipcidr:
72 | - 240.0.0.0/4
73 | - 0.0.0.0/32
74 | domain:
75 | - +.google.com
76 | - +.facebook.com
77 | - +.twitter.com
78 | - +.youtube.com
79 | - +.google.cn
80 | - +.googleapis.cn
81 | - +.googlevideo.com
82 | - +.github.com
83 | - +.githubusercontent.com
84 |
--------------------------------------------------------------------------------
/clash/备用/可参考模板/clash meta 官方文档的教程.yaml:
--------------------------------------------------------------------------------
1 | 官网地址 https://docs.metacubex.one/function/
2 |
3 |
4 | # port: 7890 #本地http代理端口
5 | # socks-port: 7891 #本地socks5代理端口
6 | mixed-port: 7890 #本地混合代理(http和socks5合并)端口
7 | # redir-port: 7892 #本地Linux/macOS Redir代理端口
8 | # tproxy-port: 7893 #本地Linux Tproxy代理端口
9 |
10 | # authentication: # 本地SOCKS5/HTTP(S)代理端口认证设置
11 | # - "user1:pass1"
12 | # - "user2:pass2"
13 |
14 | # geodata-mode: true #【Meta专属】使用geoip.dat数据库(默认:false使用mmdb数据库)
15 | tcp-concurrent: true #【Meta专属】TCP连接并发,如果域名解析结果对应多个IP,
16 | # 并发所有IP,选择握手最快的IP进行连接
17 |
18 | allow-lan: false #允许局域网连接(false/true)
19 | bind-address: #监听IP白名单(当allow-lan:true),只允许列表设备
20 | '*' #全部设备
21 | # 192.168.122.11 #单个ip4地址
22 | # "[aaaa::a8aa:ff:fe09:57d8]" #单个ip6地址
23 |
24 | mode: rule #clash工作模式(rule/global/direct,meta暂不支持script)
25 |
26 | log-level: info #日志等级(info/warning/error/debug/silent)
27 |
28 | ipv6: false #ip6开关,当为false时,停止解析hostanmes为ip6地址
29 |
30 | external-controller: 127.0.0.1:9090 #控制器监听地址
31 | external-ui: folder #http服务路径,可以放静态web网页,如yacd的控制面板
32 | #可通过`http://{{external-controller}}/ui`直接使用
33 | # secret: "" #控制器登录密码
34 |
35 |
36 | interface-name: en0 #出口网卡名称
37 | routing-mark: 6666 #流量标记(仅Linux)
38 |
39 | profile: #缓存设置(文件位置./cache.db)
40 | store-selected: false #节点状态记忆(若不同配置有同代理名称,设置值共享)
41 | store-fake-ip: true #fake-ip缓存
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | dns配置
52 | sniffer: #【Meta专属】sniffer域名嗅探器
53 | enable: true #嗅探开关
54 | sniffing: #嗅探协议对象:目前支持tls/http
55 | - tls
56 | - http
57 | skip-domain: #列表中的sni字段,保留mapping结果,不通过嗅探还原域名
58 | #优先级比force-domain高
59 | - 'Mijia Cloud' #米家设备,建议加
60 | - 'dlg.io.mi.com'
61 | - '+.apple.com' #苹果域名,建议加
62 | # - '*.baidu.com' #支持通配符
63 |
64 | force-domain: #需要强制嗅探的域名,默认只对IP嗅探
65 | # - '+' #去掉注释后等于全局嗅探
66 | - 'google.com'
67 |
68 | #port-whitelist: #端口白名单,只对名单内的端口进行还原域名
69 | # - 80
70 | # - 443
71 | # - 8000-9000
72 |
73 | hosts: #host,支持通配符(非通配符域名优先级高于通配符域名)
74 | # '*.clash.dev': 127.0.0.1 #例如foo.example.com>*.example.com>.example.com
75 | # '.dev': 127.0.0.1
76 | # 'alpha.clash.dev': '::1'
77 | dns:
78 | enable: true #DNS开关(false/true)
79 | listen: 0.0.0.0:53 #DNS监听地址
80 | # ipv6: false #IP6解析开关;如果为false,将返回ip6结果为空
81 |
82 | default-nameserver: #解析非IP的dns用的dns服务器,只支持纯IP
83 | - 114.114.114.114
84 | - 8.8.8.8
85 |
86 | #nameserver-policy: #指定域名使用自定义DNS解析
87 | # 'www.baidu.com': 'https://223.5.5.5/dns-query'
88 | # '+.internal.crop.com': '114.114.114.114'
89 |
90 | enhanced-mode: redir-host #DNS模式(redir-host/fake-ip)
91 | #【Meta专属】redir-host传递域名,可远程解析
92 | fake-ip-range: 198.18.0.1/16 #Fake-IP解析地址池
93 | # use-hosts: true #查询hosts配置并返回真实IP
94 |
95 | # fake-ip-filter: #Fake-ip过滤,列表中的域名返回真实ip
96 | # - '*.lan'
97 | # - '*.linksys.com'
98 | # - '+.pool.ntp.org'
99 | # - localhost.ptlogin2.qq.com
100 |
101 | #proxy-server-nameserver: #【Meta专属】解析代理服务器域名的dns
102 | # - tls://1.0.0.1:853 # 不写时用nameserver解析
103 |
104 | nameserver: #默认DNS服务器,支持udp/tcp/dot/doh/doq
105 | - 114.114.114.114
106 | - https://doh.pub/dns-query
107 | - tls://101.101.101.101:853
108 | # - dhcp://en0 #dns from dhcp
109 |
110 | fallback: #回落DNS服务器,支持udp/tcp/dot/doh/doq
111 | - https://doh.dns.sb/dns-query
112 | - tcp://208.67.222.222:443
113 | - quic://a.passcloud.xyz:784 #【Meta专属】Dns over quic
114 | - 'tls://8.8.4.4:853#DNSg' #【Meta专属】"#DNSg"代表该DNS服务器通过
115 | # 名为"DNSg"的proxy Group访问
116 |
117 | fallback-filter: #回落DNS服务器过滤
118 | geoip: true #为真时,不匹配为geoip规则的使用fallback返回结果
119 | geoip-code: CN #geoip匹配区域设定
120 | geosite: #【Meta专属】设定geosite某分类使用fallback返回结果
121 | - gfw
122 | ipcidr: #列表中的ip使用fallback返回解析结果
123 | - 240.0.0.0/4
124 | domain: #列表中的域名使用fallback返回解析结果
125 | - '+.google.com'
126 | - '+.facebook.com'
127 | - '+.youtube.com'
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 | 代理配置 这个事情一般是机场操心
138 |
139 |
140 |
141 |
142 |
143 |
144 | 代理组配置
145 |
146 |
147 | proxy-groups:
148 | - name: DNSg #【Meta专属】DNS代理组,配合上文"DNS配置"使用
149 | type: url-test #可任意name/type,此处仅做举例
150 | proxies:
151 | - ss1
152 | - ss2
153 |
154 | - name: "relay" #【Meta专属】relay支持UDP over TCP
155 | type: relay #中继代理,不能中继套娃中继
156 | proxies: #流量走向:clash <-> http <-> vmess <-> ss1 <-> Internet
157 | - http
158 | - vmess
159 | - ss1
160 |
161 | - name: "auto"
162 | type: url-test #通过httping URL 自动切换延迟最低的节点
163 | proxies:
164 | - ss1
165 | - ss2
166 | - vmess1
167 | # tolerance: 150 #容差值:节点差值低于设定值时,不自动切换
168 | # lazy: true #为true时,未被使用时不进行测ping
169 | url: 'http://www.gstatic.com/generate_204' #用来测ping的地址
170 | interval: 300 #测ping时间(秒)
171 | # disable-udp: true #关闭UDP
172 | # filter: 'HK' #【Meta专属】代理筛选
173 |
174 | - name: "fallback-auto"
175 | type: fallback #通过httping URL,当没有ping值时,自动切换下一个节点
176 | proxies:
177 | - ss1
178 | - ss2
179 | - vmess1
180 | url: 'http://www.gstatic.com/generate_204'
181 | interval: 300
182 | # lazy: true
183 | # disable-udp: true
184 | # filter: 'HK' #【Meta专属】代理筛选
185 |
186 | - name: "load-balance"
187 | type: load-balance #负载均衡:同一域名(eTLD+1)使用同一代理
188 | proxies:
189 | - ss1
190 | - ss2
191 | - vmess1
192 | url: 'http://www.gstatic.com/generate_204'
193 | interval: 300
194 | # lazy: true
195 | # disable-udp: true
196 | # filter: 'HK' #【Meta专属】代理筛选
197 | # strategy: round-robin #策略:round-robin :所有请求不使用同一代理
198 | #consistent-hashing:同一有效顶级域名(eTLD)使用同一代理
199 |
200 | - name: Proxy
201 | type: select #手动代理组
202 | # disable-udp: true
203 | proxies:
204 | - PASS #【Meta专属】跳过:命中的规则会被忽略,继续向下查询
205 | - ss1
206 | - ss2
207 | - vmess1
208 | - auto
209 | # filter: 'HK' #【Meta专属】代理筛选
210 |
211 | - name: en1
212 | type: select
213 | interface-name: en1 #指定网口
214 | proxies:
215 | - DIRECT
216 |
217 | - name: UseProvider
218 | type: select
219 | use:
220 | - provider1
221 | # filter: 'HK' #【Meta专属】代理筛选
222 | proxies:
223 | - Proxy
224 | - DIRECT
225 |
226 | proxy-providers:
227 | provider1:
228 | type: http
229 | url: "https://abc.com/xhYdgd" #【Meta专属】支持解析V2rayN等工具使用的普通订阅
230 | interval: 3600
231 | path: ./provider1.yaml
232 | health-check:
233 | enable: true
234 | interval: 600
235 | # lazy: true
236 | url: http://www.gstatic.com/generate_204
237 | test:
238 | type: file
239 | path: /test.yaml
240 | health-check:
241 | enable: true
242 | interval: 36000
243 | url: http://www.gstatic.com/generate_204
244 |
245 | rule-providers:
246 | google:
247 | type: http
248 | behavior: classical
249 | path: ./rule1.yaml
250 | #【Meta专属】URL可根据rule设定匹配对应的策略,方便更新provider
251 | url: "https://raw.githubusercontent.com/../Google.yaml"
252 | interval: 600
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 | 规则配置
261 |
262 |
263 | rules:
264 | #目的域名后缀规则
265 | - DOMAIN-SUFFIX,githubusercontent.com,auto
266 | - DOMAIN-SUFFIX,ad.com,REJECT
267 | - DOMAIN-SUFFIX,bilibili.com,DIRECT,tcp #【Meta专属】可指定协议类型(tcp/udp)
268 |
269 | #目的域名规则
270 | - DOMAIN,google.com,auto
271 |
272 | #目的域名关键字规则
273 | - DOMAIN-KEYWORD,google,auto
274 |
275 | #目的IP规则
276 | - IP-CIDR,127.0.0.0/8,DIRECT
277 | - IP-CIDR,122.122.0.0/8,DIRECT,no-resolve #no-resolve:不解析,可应用于GEOIP, IP-CIDR
278 |
279 | #来源IP规则
280 | - SRC-IP-CIDR,192.168.1.201/32,DIRECT
281 |
282 | #目的端口规则
283 | - DST-PORT,123/136/137-139,DIRECT #【Meta专属】可指定端口范围
284 |
285 | #来源端口规则
286 | - SRC-PORT,123/136/137-139,DIRECT,udp #【Meta专属】可指定端口范围
287 |
288 | #【Meta专属】入站规则
289 | #支持HTTP/HTTPS/SOCKS5/SOCKS4/SOCKS/TUN/TPROXY/REDIR/INNER
290 | - IN-TYPE,SOCKS5/HTTP,auto
291 |
292 | #【Meta专属】逻辑判断规则
293 | - AND,((DOMAIN,baidu.com),(NETWORK,UDP)),DIRECT #AND(和):域名为baidu.com的UDP协议
294 | - OR,((NETWORK,UDP),(DOMAIN,baidu.com)),REJECT #OR(或):UDP的协议,或者域名为baidu.com
295 | - NOT,((DOMAIN,baidu.com)),PROXY #NOT(否):域名不为baidu.com访问
296 | #域名关键词为bilibili或者douyu的UDP协议
297 | - AND,((OR,((DOMAIN-KEYWORD,bilibili),(DOMAIN-KEYWORD,douyu))),(NETWORK,UDP)),REJECT
298 |
299 | #【Meta专属】GEOSITE规则
300 | - GEOSITE,category-ads-all,REJECT
301 | - GEOSITE,icloud@cn,DIRECT
302 | - GEOSITE,apple@cn,DIRECT
303 | - GEOSITE,apple-cn,DIRECT
304 | - GEOSITE,microsoft@cn,DIRECT
305 | - GEOSITE,facebook,PROXY
306 | - GEOSITE,youtube,PROXY
307 | - GEOSITE,geolocation-cn,DIRECT
308 | - GEOSITE,geolocation-!cn,PROXY
309 |
310 | #GEOIP规则
311 | - GEOIP,telegram,PROXY,no-resolve
312 | - GEOIP,private,DIRECT,no-resolve
313 | - GEOIP,cn,DIRECT
314 |
315 | #Rule Provider规则
316 | - RULE-SET,google,REJECT # Meta支持RULE-SET规则
317 |
318 | #兜底规则
319 | - MATCH,auto
--------------------------------------------------------------------------------
/clash/备用/可参考模板/config.yaml 第三方教程.txt:
--------------------------------------------------------------------------------
1 | #Tproxy模式必须开启,该模式赖以工作的条件
2 | tproxy-port: 7893
3 | #真实延迟检测是否开启
4 | unified-delay: true
5 | #地理模式是否开启
6 | geodata-mode: true
7 | # HTTP 代理端口
8 | port: 7890
9 | #SOCKS5 代理端口
10 | socks-port: 7891
11 | #HTTP(S)和 SOCKS 代理混合端口
12 | mixed-port: 10801
13 | #是否允许局域网的连接
14 | allow-lan: false
15 | #绑定局域网IP地址*为所有地址
16 | bind-address:"*"
17 | #运行模式
18 | #rule: 基于规则策
19 | #global: 全局代理
20 | #direct: 不代理,全局直连。
21 | mode: rule
22 | #日志输出级别
23 | #info默认/ warning警告 / error 错误/ debug调试/ silent安静,内容少
24 | log-level: warning
25 | #ipv6是否开启,false关闭,true开启
26 | ipv6: false
27 | #udp是否开启
28 | udp: true
29 | #嗅探域名是否开启
30 | sniffer
31 | enable: true
32 | #TCP并发连接所有IP, 将使用最快握手的TCP
33 | tcp-concurrent:true
34 | profile:
35 | #是否开启存储select选择记录
36 | store-selected: false
37 | #是否持久化
38 | store-fake-ip: true
39 | #网页面板监听地址
40 | external-controller: 0.0.0.0:9090
41 | #本地网页面板的的相对路径(相对/data/clash
42 | external-ui: yacd
43 | #网页面板的密码
44 | secret: 'clash'
45 | #Tun模式
46 | tun:
47 | #是否启用TUN模式,优先级高于Tproxy
48 | enable: true
49 | #system/gvisor二选一,system性能更好,但兼容性较差
50 | stack: system
51 | dns-hijack:
52 | - 0.0.0.0:53
53 | #必须为true或者不写
54 | auto-route: true
55 | #DNS配置
56 | dns:
57 | #关闭将使用系统DNS,Tproxy模式下必须为true
58 | enable: true
59 | #开启DNS服务器监听,如无必要不要改
60 | listen: 0.0.0.0:53
61 | # IPV6是否开启。
62 | ipv6: false
63 | #用于解析nameserver,fallbacky以及其他DNS服务器配置的,DNS服务域名
64 | #只能使用纯IP地址,可使用加密DNS
65 | default-nameserver:
66 | - 114.114.114.114
67 | - 8.8.8.8
68 | - tls://1.12.12.12:853
69 | - tls://223.5.5.5:853
70 | #两种模式 fake-ip /redir-host,
71 | enhanced-mode: redir-host
72 | #如果是fake-ip模式,则哪些url不走fake-ip
73 | fake-ip-filter:
74 | - '+.lan'
75 | - '+.cn'
76 | - '+.10010.com'
77 | - '+.chinaunicom.com'
78 | - '+.baidu.com'
79 | - '*.alipay.com'
80 | - '*.alipayobjects.com'
81 | - '*.jijifun.com'
82 | - localhost.ptlogin2.qq.com
83 | #国内的dns解析服务
84 | nameserver:
85 | - https://rubyfish.cn/dns-query
86 | - https://dns.alidns.com/dns-query
87 | - https://doh.pub/dns-query
88 | #国外的dns解析服务
89 | fallback:
90 | - https://doh.opendns.com/dns-query
91 | - https://dns.adguard.com/dns-query
92 | - https://doh.dns.sb/dns-query
93 | - https://dns64.dns.google/dns-query
94 | - https://dns.google/dns-query
95 | - https://cloudflare-dns.com/dns-query
96 | #代理,不用也要保留,模块合并文件时的缺点
97 | proxies:
98 | #代理组
99 | proxy-providers:
100 | # 机场名字
101 | SpeederOne:
102 | # 订阅类型,订阅链接的用http,本地文件用file
103 | type: http
104 | # 机场订阅链接
105 | url: "机场订阅链接"
106 | # 下载好的文件的存储相对位置(相对/data/clash)
107 | path: ./proxy_providers/SpeederOne.yaml
108 | # 自动更新订阅间隔,秒为单位
109 | interval: 3600
110 | # 健康检查:检查节点可用性
111 | health-check:
112 | # 开启健康检查
113 | enable: true
114 | # 健康检查用的网址
115 | url: http://www.gstatic.com/generate_204
116 | # 定时健康检查
117 | interval: 300
118 | # 过滤部分节点,请自行学习正则表达式
119 | filter: "香港|美国|HK|US"
120 | #本地机场文件名字
121 | BaiPiao:
122 | #本地机场文件用file,
123 | type: file
124 | #本地机场文件地址
125 | path: ./proxy_providers/BaiPiao.yaml
126 | #健康检查
127 | health-check:
128 | #开启本地检查
129 | enable: true
130 | #健康检查的网扯
131 | url: http://www.gstatic.com/generate_204
132 | #定时检查
133 | interval: 300
134 | #代理组
135 | proxy-groups:
136 | #组名
137 | name: Proxy
138 | #行为,有多种,如自动选延迟低的、负载均衡啥的
139 | select:手动选择一个节点。
140 | url-test:自动测速,自动选择延迟最低的策略。其中有以下几个参数需要注意:url:用于测试的,测试地址:http://www.gstatic.com/generate_204
141 | type: select
142 | #把前面的机场名字放到组里面,机场得放在use下,
143 | use:
144 | - SpeederOne
145 | - BaiPiao
146 | -国内流量分组
147 | name: Domestic
148 | type: select
149 | #同上 机场得放在use下,
150 | use:
151 | - BaiPiao
152 | #可以引用其他的组,但是得放在proxies下
153 | proxies:
154 | #直连
155 | - DIRECT
156 | #代理
157 | - Proxy
158 | #其他分组
159 | name: Others
160 | type: select
161 | proxies:
162 | #代理组
163 | - Proxy
164 | #国内流量组
165 | - Domestic
166 | # 规则策略组
167 | rule-providers:
168 | #规则名
169 | Ad:
170 | #规则类型 file为文件保存在本地,要更新得手动, http是在网上的规则
171 | type: file
172 | # 行为看文档
173 | behavior: classical
174 | #规则的保存位置
175 | path: ./rule_providers/Ad.yaml
176 | #规则名字
177 | GoogleDrive:
178 | #规则类型,http为网站
179 | type: http
180 | #行为看文档
181 | behavior: classical
182 | # 规则的链接
183 | url: "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/GoogleDrive/GoogleDrive.yaml"
184 | # 下载下来存哪儿
185 | path: ./rule_providers/GoogleDrive.yaml
186 | #使用规则,按顺序从上到下一一匹配
187 | rules:
188 | #防止Clash回环并屏蔽Clash联网,
189 | - PROCESS-NAME,clash,REJECT
190 | #no-resolve表示不要解析这条规则,只处理ip访问请求
191 | - RULE-SET,Local,DIRECT,no-resolve
192 | #使用上面规则,规则名,此处行为为拒绝,即没网
193 | - RULE-SET,Ad,REJECT
194 | # 匹配国内的流量,此处为直连,不走代理
195 | - GEOIP,CN,Domestic
196 | # 匹配国内的流量,此处为直连,不走代理
197 | - GEOSITE,CN,Domestic
198 | #没匹配到的,走代理
199 | - MATCH,proxy
200 | ————————————————————————
201 | #表示包含完整的域名
202 | DOMAIN 表示包含完整的域名
203 | #表示包含什么后缀的域名
204 | DOMAIN-SUFFIX
205 | #表示包含 xxx域名关键字的链接
206 | DOMAIN-KEYWORD
207 | #应用分流规则网站,如YouTube,奈飞
208 | https://github.com/blackmatrix7/ios_rule_script/tree/master/rule/Clash
209 | #IPV4匹配
210 | IP-CIDR
211 | #IPV6 匹配
212 | IP-CIDR6
213 | #表示进程名称
214 | PROCESS-NAME
215 | #数据库(国家代码)匹配
216 | GEOIP
217 | #没有匹配(一般放在最后)
218 | MATCH
--------------------------------------------------------------------------------
/clash/备用/可参考模板/修复流量更新那一版本的clash.tool:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 | #这份clash.tool来自///cfm魔2套餐信息修复版,和原版差距很大
3 | scripts=$(realpath $0)
4 | scripts_dir=$(dirname ${scripts})
5 | . /data/clash/clash.config
6 |
7 | monitor_local_ipv4() {
8 |
9 | change=false
10 |
11 | wifistatus=$(dumpsys connectivity | grep "WIFI" | grep "state:" | awk -F ", " '{print $2}' | awk -F "=" '{print $2}' 2>&1)
12 |
13 | if [ ! -z "${wifistatus}" ]; then
14 | echo "" >${Clash_run_path}/lastmobile
15 | if test ! "${wifistatus}" = "$(cat ${Clash_run_path}/lastwifi)"; then
16 | change=true
17 | echo "${wifistatus}" >${Clash_run_path}/lastwifi
18 | elif [ "$(ip route get 1.2.3.4 | awk '{print $5}' 2>&1)" != "wlan0" ]; then
19 | change=true
20 | echo "${wifistatus}" >${Clash_run_path}/lastwifi
21 | fi
22 | else
23 | echo "" >${Clash_run_path}/lastwifi
24 | fi
25 |
26 | if [ "$(settings get global mobile_data 2>&1)" -eq 1 ] && [ -z "${wifistatus}" ] ; then
27 | echo "" >${Clash_run_path}/lastwifi
28 | card1="$(settings get global mobile_data1 2>&1)"
29 | card2="$(settings get global mobile_data2 2>&1)"
30 | if [ "${card1}" = 1 ] ; then
31 | mobilestatus=1
32 | fi
33 | if [ "${card2}" = 1 ] ; then
34 | mobilestatus=2
35 | fi
36 | if [ ! "${mobilestatus}" = "$(cat ${Clash_run_path}/lastmobile)" ]; then
37 | change=true
38 | echo "${mobilestatus}" >${Clash_run_path}/lastmobile
39 | fi
40 | else
41 | echo "" >${Clash_run_path}/lastmobile
42 | fi
43 |
44 | testv4=$(${iptables_wait} -t mangle -nvL FILTER_LOCAL_IP | grep "ACCEPT" | awk '{print $9}' 2>&1)
45 | testv6=$(${ip6tables_wait} -t mangle -nvL FILTER_LOCAL_IP | grep "ACCEPT" | awk '{print $8}' 2>&1)
46 | if test -z "$testv4" || test -z "$testv6" ; then
47 | change=true
48 | fi
49 |
50 | if [ "${change}" = true ]; then
51 |
52 | local_ipv4=$(ip a | awk '$1~/inet$/{print $2}' 2>&1)
53 | local_ipv6=$(ip -6 a | awk '$1~/inet6$/{print $2}' | grep '^2' 2>&1)
54 | rules_ipv4=$(${iptables_wait} -t mangle -nvL FILTER_LOCAL_IP | grep "ACCEPT" | awk '{print $9}' 2>&1)
55 | rules_ipv6=$(${ip6tables_wait} -t mangle -nvL FILTER_LOCAL_IP | grep "ACCEPT" | awk '{print $8}' 2>&1)
56 |
57 | for rules_subnet in ${rules_ipv4[*]}; do
58 | ${iptables_wait} -t mangle -D FILTER_LOCAL_IP -d ${rules_subnet} -j ACCEPT
59 | done
60 |
61 | for subnet in ${local_ipv4[*]}; do
62 | ${iptables_wait} -t mangle -I FILTER_LOCAL_IP -d ${subnet} -j ACCEPT
63 | done
64 |
65 | for rules_subnet6 in ${rules_ipv6[*]}; do
66 | ${ip6tables_wait} -t mangle -D FILTER_LOCAL_IP -d ${rules_subnet6} -j ACCEPT
67 | done
68 |
69 | for subnet6 in ${local_ipv6[*]}; do
70 | ${ip6tables_wait} -t mangle -I FILTER_LOCAL_IP -d ${subnet6} -j ACCEPT
71 | done
72 |
73 | fi
74 |
75 | unset local_ipv4
76 | unset rules_ipv4
77 | unset local_ipv6
78 | unset rules_ipv6
79 | unset wifistatus
80 | unset mobilestatus
81 | unset change
82 | }
83 |
84 | restart_clash() {
85 | ${scripts_dir}/clash.service -k && ${scripts_dir}/clash.iptables -k
86 | ${scripts_dir}/clash.service -s && ${scripts_dir}/clash.iptables -s
87 | if [ "$?" == "0" ]; then
88 | echo [$(TZ=Asia/Shanghai date "+%H:%M:%S")]"info: 内核成功重启." >>${CFM_logs_file}
89 | else
90 | echo [$(TZ=Asia/Shanghai date "+%H:%M:%S")]"err: 内核重启失败." >>${CFM_logs_file}
91 | fi
92 | }
93 |
94 | keep_dns() {
95 | local_dns=$(getprop net.dns1)
96 |
97 | if [ "${local_dns}" != "${static_dns}" ]; then
98 | for count in $(seq 1 $(getprop | grep dns | wc -l)); do
99 | setprop net.dns${count} ${static_dns}
100 | done
101 | fi
102 |
103 | if [ $(sysctl net.ipv4.ip_forward) != "1" ]; then
104 | sysctl -w net.ipv4.ip_forward=1
105 | fi
106 |
107 | unset local_dns
108 | }
109 |
110 | updateFile() {
111 | file="$1"
112 | file_bk="${file}.bk"
113 | update_url="$2"
114 |
115 | mv -f ${file} ${file_bk}
116 | echo "curl -L -A 'clash' ${update_url} -o ${file} "
117 | /data/adb/magisk/busybox wget --no-check-certificate -U clash -O ${file} ${update_url} 2>&1 # >> /dev/null 2>&1
118 |
119 | sleep 1
120 |
121 | if [ -f "${file}" ]; then
122 | rm -rf ${file_bk}
123 |
124 | echo [$(TZ=Asia/Shanghai date "+%H:%M:%S")]"info: ${file}更新成功." >>${CFM_logs_file}
125 | else
126 | mv ${file_bk} ${file}
127 | echo [$(TZ=Asia/Shanghai date "+%H:%M:%S")]"war: ${file}更新失败,文件已恢复.." >>${CFM_logs_file}
128 | return 1
129 | fi
130 | }
131 |
132 | find_packages_uid() {
133 | rm -f ${appuid_file}.tmp
134 | hd=""
135 | for package in $(cat ${filter_packages_file}); do
136 | if [ "${Clash_enhanced_mode}" == "fake-ip" ] && [ "${Clash_tun_status}" != "true" ]; then
137 | echo [$(TZ=Asia/Shanghai date "+%H:%M:%S")]"war: Tproxy_fake-ip下禁用黑白名单." >>${CFM_logs_file}
138 | return
139 | fi
140 | nhd=$(awk -F ">" '/^[0-9]+>$/{print $1}' <<< "${package}")
141 | if [ "${nhd}" != "" ]; then
142 | hd=${nhd}
143 | continue
144 | fi
145 | uid=$(awk '$1~/'^"${package}"$'/{print $2}' ${system_packages_file})
146 | if [ "${uid}" == "" ]; then
147 | echo [$(TZ=Asia/Shanghai date "+%H:%M:%S")]"warn: ${package}未找到." >>${CFM_logs_file}
148 | continue
149 | fi
150 | echo "${hd}${uid}" >> ${appuid_file}.tmp
151 | if [ "${mode}" = "blacklist" ]; then
152 | echo [$(TZ=Asia/Shanghai date "+%H:%M:%S")]"info: ${hd}${package}已过滤." >>${CFM_logs_file}
153 | elif [ "${mode}" = "whitelist" ]; then
154 | echo [$(TZ=Asia/Shanghai date "+%H:%M:%S")]"info: ${hd}${package}已代理." >>${CFM_logs_file}
155 | fi
156 | done
157 | rm -f ${appuid_file}
158 | for uid in $(cat ${appuid_file}.tmp | sort -u); do
159 | echo ${uid} >> ${appuid_file}
160 | done
161 | rm -f ${appuid_file}.tmp
162 | }
163 |
164 | port_detection() {
165 | clash_pid=$(cat ${Clash_pid_file})
166 | match_count=0
167 | sleep 5
168 | if ! (ss -h >/dev/null 2>&1); then
169 | clash_port=$(netstat -anlp | grep -v p6 | grep "clash" | awk '$6~/'"${clash_pid}"*'/{print $4}' | awk -F ':' '{print $2}' | sort -u)
170 | else
171 | clash_port=$(ss -antup | grep "clash" | awk '$7~/'pid="${clash_pid}"*'/{print $5}' | awk -F ':' '{print $2}' | sort -u)
172 | fi
173 |
174 | if ! (echo ${clash_port} | grep ${Clash_tproxy_port}); then
175 | echo [$(TZ=Asia/Shanghai date "+%H:%M:%S")]"err: tproxy端口未启动." >>${CFM_logs_file}
176 | exit 1
177 | fi
178 |
179 | if ! (echo ${clash_port} | grep ${Clash_dns_port}); then
180 | echo [$(TZ=Asia/Shanghai date "+%H:%M:%S")]"err: dns端口未启动." >>${CFM_logs_file}
181 | exit 1
182 | fi
183 | echo [$(TZ=Asia/Shanghai date "+%H:%M:%S")]"info: tproxy和dns端口已启动." >>${CFM_logs_file}
184 | exit 0
185 | }
186 |
187 | update_pre() {
188 | flag=false
189 |
190 | if [ ${auto_updateGeoIP} == "true" ]; then
191 | updateFile ${Clash_GeoIP_file} ${GeoIP_url}
192 | if [ "$?" = "0" ]; then
193 | flag=true
194 | fi
195 | fi
196 |
197 | if [ ${auto_updateGeoSite} == "true" ]; then
198 | updateFile ${Clash_GeoSite_file} ${GeoSite_url}
199 | if [ "$?" = "0" ]; then
200 | flag=true
201 | fi
202 | fi
203 |
204 | if [ -f "${Clash_pid_file}" ] && [ ${flag} == true ]; then
205 | restart_clash
206 | fi
207 | }
208 |
209 | limit_clash() {
210 | if [ "${Cgroup_memory_limit}" == "" ]; then
211 | return
212 | fi
213 |
214 | if [ "${Cgroup_memory_path}" == "" ]; then
215 | Cgroup_memory_path=$(mount | grep cgroup | awk '/memory/{print $3}' | head -1)
216 | if [ "${Cgroup_memory_path}" == "" ]; then
217 | echo [$(TZ=Asia/Shanghai date "+%H:%M:%S")]"err: 自动获取Cgroup_memory_path失败." >>${CFM_logs_file}
218 | return
219 | fi
220 | fi
221 |
222 | mkdir "${Cgroup_memory_path}/clash"
223 | echo $(cat ${Clash_pid_file}) >"${Cgroup_memory_path}/clash/cgroup.procs"
224 | echo "${Cgroup_memory_limit}" >"${Cgroup_memory_path}/clash/memory.limit_in_bytes"
225 |
226 | echo [$(TZ=Asia/Shanghai date "+%H:%M:%S")]"info: 限制内存: ${Cgroup_memory_limit}." >>${CFM_logs_file}
227 | }
228 |
229 | while getopts ":kfmpusl" signal; do
230 | case ${signal} in
231 | u)
232 | update_pre
233 | ;;
234 | s)
235 | flag=false
236 | if [ ${auto_updateSubcript} == "true" ]; then
237 | updateFile ${Clash_config_file} ${Subcript_url}
238 | if [ "$?" = "0" ] && [ -f "${Clash_pid_file}" ]; then
239 | restart_clash
240 | fi
241 | fi
242 | ;;
243 | k)
244 | if [ "${mode}" = "blacklist" ] || [ "${mode}" = "whitelist" ]; then
245 | keep_dns
246 | else
247 | exit 0
248 | fi
249 | ;;
250 | f)
251 | find_packages_uid
252 | ;;
253 | m)
254 | if [ "${mode}" = "blacklist" ] && [ -f "${Clash_pid_file}" ]; then
255 | monitor_local_ipv4
256 | else
257 | exit 0
258 | fi
259 | ;;
260 | p)
261 | exit 0
262 | ;;
263 | l)
264 | limit_clash
265 | ;;
266 | ?)
267 | echo ""
268 | ;;
269 | esac
270 | done
271 |
--------------------------------------------------------------------------------
/clash/备用/完全免流/config.yaml:
--------------------------------------------------------------------------------
1 | proxies:
2 | # - name: "自建免流 UDP 代理 - WS"
3 | # type: vmess
4 | # server: abc.com
5 | # port: 443
6 | # uuid: 7faee31e-0253-4abf-a529-7f1948a6f054
7 | # alterId: 4
8 | # cipher: auto
9 | # tls: true
10 | # udp: true
11 | # servername: abc.com
12 | # tls-hostname: abc.com
13 | # sni: abc.com
14 | # skip-cert-verify: true
15 | # network: ws
16 | # ws-opts:
17 | # path: /neuromancer
18 | # headers:
19 | # Host: abc.com
20 | # - name: "自建免流 UDP 代理 - HTTP"
21 | # type: "vmess"
22 | # server: "abc.com"
23 | # port: "80"
24 | # uuid: "f18f5469-28b2-4f30-8589-21a5ed6848c1"
25 | # alterId: 0
26 | # tls: false
27 | # tfo: true
28 | # udp: true
29 | # cipher: auto
30 | # skip-cert-verify: true
31 | # vmess-aead: true
32 | # network: "http"
33 | # http-opts:
34 | # path:
35 | # - "/"
36 | # headers:
37 | # method:
38 | # - "GET"
39 | # Host:
40 | # - abc.com
41 | - name: "🆓 百度免流"
42 | type: http
43 | server: 157.0.148.53
44 | port: 443
45 | headers:
46 | X-T5-Auth: "1962898709"
47 | User-Agent:
48 | "okhttp/3.11.0 Dalvik/2.1.0 (Linux; U; Android 11; Redmi K30 5G Build/RKQ1.200826.002)
49 | baiduboxapp/11.0.5.12 (Baidu; P1 11)"
50 | # - name: "🆓 UC 免流"
51 | # type: http
52 | # server: 101.71.140.5
53 | # port: 8128
54 | # username: uc10.7.163.144
55 | # password: 1f47d3ef53b035443451c7ee7873ff38
56 |
57 | proxy-groups:
58 | - name: "🇨🇳 墙内"
59 | type: select
60 | proxies:
61 | - "DIRECT"
62 | - "🆓🇨🇳 墙内免流"
63 | ssid-policy:
64 | cellular: "🆓🇨🇳 墙内免流"
65 | default: "DIRECT"
66 | - name: "🆓🇨🇳 墙内免流"
67 | type: select
68 | proxies:
69 | - "🆓🇨🇳✈️ 免流墙内机场"
70 | - "🆓🌑✈️ 免流墙外机场"
71 | - DIRECT
72 | - name: "🌑 墙外"
73 | type: select
74 | proxies:
75 | - "🚀🌑 墙外非免流"
76 | - "🆓🌑 墙外免流"
77 | ssid-policy:
78 | cellular: "🆓🌑 墙外免流"
79 | default: "🚀🌑 墙外非免流"
80 | - name: "🚀🌑 墙外非免流"
81 | type: select
82 | proxies:
83 | - "🆓🌑✈️ 免流墙外机场"
84 | - "🆓🇨🇳✈️ 免流墙内机场"
85 | - name: "🆓🌑 墙外免流"
86 | type: select
87 | proxies:
88 | - "🆓🌑✈️ 免流墙外机场"
89 | - "🆓🇨🇳✈️ 免流墙内机场"
90 | - name: "🇨🇳 墙内受限"
91 | type: select
92 | proxies:
93 | - "🇨🇳 墙内"
94 | - "🆓🇨🇳 墙内受限免流"
95 | ssid-policy:
96 | cellular: "🆓🇨🇳 墙内受限免流"
97 | default: "🇨🇳 墙内"
98 | - name: "🆓🇨🇳 墙内受限免流"
99 | type: select
100 | proxies:
101 | - "🆓 百度免流"
102 | # - "🆓 UC 免流"
103 | - "🆓🇨🇳 墙内免流"
104 | - name: "🛑 拦截"
105 | type: select
106 | proxies:
107 | - "REJECT"
108 | - "🌑 墙外"
109 | - "🇨🇳 墙内"
110 | - name: "🇨🇳 墙内 UDP"
111 | type: select
112 | proxies:
113 | - "🇨🇳 墙内"
114 | - "🆓🇨🇳 墙内免流 UDP"
115 | ssid-policy:
116 | cellular: "🆓🇨🇳 墙内免流 UDP"
117 | default: "🇨🇳 墙内"
118 | - name: "🆓🇨🇳 墙内免流 UDP"
119 | type: select
120 | proxies:
121 | - "🆓🇨🇳 墙内免流"
122 | - "UDP 🆓🇨🇳✈️ 免流墙内机场-手动选择"
123 | - "UDP 🆓🌑✈️ 免流墙外机场-手动选择"
124 | # - "自建免流 UDP 代理 - HTTP"
125 | # - "自建免流 UDP 代理 - WS"
126 | - name: "🌑 墙外 UDP"
127 | type: select
128 | proxies:
129 | - "🚀🌑 墙外非免流 UDP"
130 | - "🆓🌑 墙外 UDP"
131 | ssid-policy:
132 | cellular: "🆓🌑 墙外 UDP"
133 | default: "🚀🌑 墙外非免流 UDP"
134 | - name: "🚀🌑 墙外非免流 UDP"
135 | type: select
136 | proxies:
137 | - "🆓🌑 墙外免流"
138 | - "UDP 🆓🌑✈️ 免流墙外机场-手动选择"
139 | - "UDP 🆓🇨🇳✈️ 免流墙内机场-手动选择"
140 | # - "自建免流 UDP 代理 - HTTP"
141 | # - "自建免流 UDP 代理 - WS"
142 | - name: "🆓🌑 墙外 UDP"
143 | type: select
144 | proxies:
145 | - "🆓🌑 墙外免流"
146 | - "UDP 🆓🌑✈️ 免流墙外机场-手动选择"
147 | - "UDP 🆓🇨🇳✈️ 免流墙内机场-手动选择"
148 | # - "自建免流 UDP 代理 - HTTP"
149 | # - "自建免流 UDP 代理 - WS"
150 | - name: "🆓🇨🇳✈️ 免流墙内机场"
151 | type: select
152 | proxies:
153 | - "🆓🇨🇳✈️ 免流墙内机场-故障转移"
154 | - "🆓🇨🇳✈️ 免流墙内机场-自动测速"
155 | - "🆓🇨🇳✈️ 免流墙内机场-负载均衡"
156 | - "🆓🇨🇳✈️ 免流墙内机场-手动选择"
157 | - name: "UDP 🆓🇨🇳✈️ 免流墙内机场-手动选择"
158 | type: select
159 | use:
160 | - cnAirport
161 | - name: "🆓🇨🇳✈️ 免流墙内机场-手动选择"
162 | type: select
163 | use:
164 | - cnAirport
165 |
166 | - name: "🆓🇨🇳✈️ 免流墙内机场-负载均衡"
167 | type: load-balance
168 | strategy: consistent-hashing
169 | url: http://cp.cloudflare.com/generate_204
170 | tolerance: 50
171 | lazy: true
172 | interval: 60
173 | use:
174 | - cnAirport
175 | - name: "🆓🇨🇳✈️ 免流墙内机场-故障转移"
176 | type: fallback
177 | url: http://cp.cloudflare.com/generate_204
178 | tolerance: 50
179 | lazy: true
180 | interval: 60
181 | use:
182 | - cnAirport
183 |
184 | - name: "🆓🇨🇳✈️ 免流墙内机场-自动测速"
185 | type: url-test
186 | url: http://cp.cloudflare.com/generate_204
187 | tolerance: 50
188 | lazy: true
189 | interval: 60
190 | use:
191 | - cnAirport
192 |
193 | - name: "🆓🌑✈️ 免流墙外机场"
194 | type: select
195 | proxies:
196 | - "🆓🌑✈️ 免流墙外机场-故障转移"
197 | - "🆓🌑✈️ 免流墙外机场-自动测速"
198 | - "🆓🌑✈️ 免流墙外机场-负载均衡"
199 | - "🆓🌑✈️ 免流墙外机场-手动选择"
200 | - name: "UDP 🆓🌑✈️ 免流墙外机场-手动选择"
201 | type: select
202 | use:
203 | - airport
204 | - name: "🆓🌑✈️ 免流墙外机场-手动选择"
205 | type: select
206 | use:
207 | - airport
208 |
209 | - name: "🆓🌑✈️ 免流墙外机场-故障转移"
210 | type: fallback
211 | url: http://cp.cloudflare.com/generate_204
212 | tolerance: 50
213 | lazy: true
214 | interval: 60
215 | use:
216 | - airport
217 | - name: "🆓🌑✈️ 免流墙外机场-负载均衡"
218 | type: load-balance
219 | strategy: consistent-hashing
220 | url: http://cp.cloudflare.com/generate_204
221 | tolerance: 50
222 | lazy: true
223 | interval: 60
224 | use:
225 | - airport
226 |
227 | - name: "🆓🌑✈️ 免流墙外机场-自动测速"
228 | type: url-test
229 | url: http://cp.cloudflare.com/generate_204
230 | tolerance: 50
231 | lazy: true
232 | interval: 60
233 | use:
234 | - airport
235 |
236 | - name: "🍎 苹果推送"
237 | type: select
238 | proxies:
239 | - "🇨🇳 墙内"
240 | - "🇨🇳 墙内受限"
241 | - "🌑 墙外"
242 | - DIRECT
243 |
244 | - name: "DNS-CN"
245 | type: select
246 | proxies:
247 | - "🇨🇳 墙内"
248 | - "🇨🇳 墙内受限"
249 | - "🌑 墙外"
250 | - DIRECT
251 |
252 | - name: "DNS-GLOBAL"
253 | type: select
254 | proxies:
255 | - "🌑 墙外"
256 | - "🇨🇳 墙内"
257 | - "🇨🇳 墙内受限"
258 | - DIRECT
259 | proxy-providers:
260 | airport:
261 | type: http
262 | # 国外机场节点订阅
263 | url: "https://api.tsutsu.one/sub?target=clash&url=https%3A%2F%2Fopenit.daycat.space%2Flong&insert=true&config=https%3A%2F%2Fraw.githubusercontent.com%2FMeilieage%2Fwebcdn%2Fmain%2Frule%2FArea_Media_NoAuto.ini&append_type=true&strict=true&sort=true&emoji=true&list=true&udp=true&tfo=true&expand=true&scv=true&fdn=true&surge.doh=true&clash.doh=true&new_name=true"
264 | interval: 3600
265 | path: "./proxy_providers/airport.yaml"
266 | health-check:
267 | enable: true
268 | interval: 60
269 | url: http://cp.cloudflare.com/generate_204
270 | cnAirport:
271 | type: http
272 | # 国内机场节点订阅
273 | url: "https://api.tsutsu.one/sub?target=clash&url=https%3A%2F%2Fopenit.daycat.space%2Flong&insert=true&config=https%3A%2F%2Fraw.githubusercontent.com%2FMeilieage%2Fwebcdn%2Fmain%2Frule%2FArea_Media_NoAuto.ini&append_type=true&strict=true&sort=true&emoji=true&list=true&udp=true&tfo=true&expand=true&scv=true&fdn=true&surge.doh=true&clash.doh=true&new_name=true"
274 | interval: 3600
275 | path: "./proxy_providers/cnAirport.yaml"
276 | health-check:
277 | enable: true
278 | interval: 60
279 | url: http://cp.cloudflare.com/generate_204
280 | rule-providers:
281 | Unbreak:
282 | type: http
283 | behavior: classical
284 | url: "https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Direct/Direct.yaml"
285 | path: ./ruleset/Unbreak.yaml
286 | interval: 3600
287 |
288 | # Advertising:
289 | # type: http
290 | # behavior: classical
291 | # url: "https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Advertising/Advertising.yaml"
292 | # path: ./ruleset/Advertising.yaml
293 | # interval: 3600
294 | # AdvertisingDomain:
295 | # type: http
296 | # behavior: domain
297 | # url: "https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Advertising/Advertising_Domain.yaml"
298 | # path: ./ruleset/AdvertisingDomain.yaml
299 | # interval: 3600
300 |
301 | Microsoft:
302 | type: http
303 | behavior: classical
304 | url: "https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Microsoft/Microsoft.yaml"
305 | path: ./ruleset/Microsoft.yaml
306 | interval: 3600
307 | AppleProxy:
308 | type: http
309 | behavior: classical
310 | url: "https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/AppleProxy/AppleProxy.yaml"
311 | path: ./ruleset/AppleProxy.yaml
312 | interval: 3600
313 |
314 | Apple:
315 | type: http
316 | behavior: classical
317 | url: "https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Apple/Apple.yaml"
318 | path: ./ruleset/Apple.yaml
319 | interval: 3600
320 | TestFlight:
321 | type: http
322 | behavior: classical
323 | url: "https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/TestFlight/TestFlight.yaml"
324 | path: ./ruleset/TestFlight.yaml
325 | interval: 3600
326 | Tencent:
327 | type: http
328 | behavior: classical
329 | url: "https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Tencent/Tencent.yaml"
330 | path: ./ruleset/Tencent.yaml
331 | interval: 3600
332 | WeChat:
333 | type: http
334 | behavior: classical
335 | url: "https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/WeChat/WeChat.yaml"
336 | path: ./ruleset/WeChat.yaml
337 | interval: 3600
338 |
339 | China:
340 | type: http
341 | behavior: classical
342 | url: "https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/China/China.yaml"
343 | path: ./ruleset/China.yaml
344 | interval: 3600
345 | ChinaMaxDomain:
346 | type: http
347 | behavior: domain
348 | url: "https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/ChinaMax/ChinaMax_Domain.yaml"
349 | path: ./ruleset/ChinaMaxDomain.yaml
350 | interval: 3600
351 |
352 | Global:
353 | type: http
354 | behavior: classical
355 | url: "https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Global/Global.yaml"
356 | path: ./ruleset/Global.yaml
357 | interval: 3600
358 |
359 | GlobalDomain:
360 | type: http
361 | behavior: domain
362 | url: "https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Global/Global_Domain.yaml"
363 | path: ./ruleset/GlobalDomain.yaml
364 | interval: 3600
365 |
366 | Lan:
367 | type: http
368 | behavior: classical
369 | url: "https://ghproxy.com/https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Lan/Lan.yaml"
370 | path: ./ruleset/Lan.yaml
371 | interval: 3600
372 | rules:
373 | # > 防止回环
374 | - IP-CIDR,127.0.0.1/32,REJECT,no-resolve
375 | # - PROCESS-NAME,clash,REJECT
376 |
377 | # > 拦截 quic
378 | - AND,((NETWORK,UDP),(DST-PORT,443/4483/9305)),🛑 拦截
379 |
380 | # > google 部分服务直连
381 | - AND,((DST-PORT,5228-5230),(NETWORK,TCP),(DOMAIN-KEYWORD,google)),🇨🇳 墙内
382 |
383 | # > ghproxy.com 直连
384 | - AND,((NETWORK,TCP),(DOMAIN-SUFFIX,ghproxy.com),(DST-PORT,80/443)),🇨🇳 墙内受限
385 | - AND,((NETWORK,UDP),(DOMAIN-SUFFIX,ghproxy.com)),🇨🇳 墙内 UDP
386 | - DOMAIN-SUFFIX,ghproxy.com,🇨🇳 墙内
387 |
388 | # > 苹果推送 热点机使用 应该在策略组里改成 DIRECT
389 | - DOMAIN-SUFFIX,push.apple.com,🍎 苹果推送
390 |
391 | # > 一些 dns 的规则
392 | - AND,((NETWORK,TCP),(IP-CIDR,1.12.12.12/32,no-resolve),(DST-PORT,80/443)),🇨🇳 墙内受限
393 | - AND,((NETWORK,UDP),(IP-CIDR,1.12.12.12/32,no-resolve)),🇨🇳 墙内 UDP
394 | - IP-CIDR,1.12.12.12/32,🇨🇳 墙内,no-resolve
395 |
396 | - AND,((NETWORK,TCP),(IP-CIDR,120.53.53.53/32,no-resolve),(DST-PORT,80/443)),🇨🇳 墙内受限
397 | - AND,((NETWORK,UDP),(IP-CIDR,120.53.53.53/32,no-resolve)),🇨🇳 墙内 UDP
398 | - IP-CIDR,120.53.53.53/32,🇨🇳 墙内,no-resolve
399 |
400 | - AND,((NETWORK,TCP),(IP-CIDR,223.5.5.5/32,no-resolve),(DST-PORT,80/443)),🇨🇳 墙内受限
401 | - AND,((NETWORK,UDP),(IP-CIDR,223.5.5.5/32,no-resolve)),🇨🇳 墙内 UDP
402 | - IP-CIDR,223.5.5.5/32,🇨🇳 墙内,no-resolve
403 |
404 | - AND,((NETWORK,TCP),(IP-CIDR,119.29.29.29/32,no-resolve),(DST-PORT,80/443)),🇨🇳 墙内受限
405 | - AND,((NETWORK,UDP),(IP-CIDR,119.29.29.29/32,no-resolve)),🇨🇳 墙内 UDP
406 | - IP-CIDR,119.29.29.29/32,🇨🇳 墙内,no-resolve
407 |
408 | # > 优先直连(防误拦截) 以此为例 优先判断是否走受限代理, 其次判断UDP
409 | - AND,((NETWORK,TCP),(RULE-SET,Unbreak),(DST-PORT,80/443)),🇨🇳 墙内受限
410 | - AND,((NETWORK,UDP),(RULE-SET,Unbreak)),🇨🇳 墙内 UDP
411 | - RULE-SET,Unbreak,🇨🇳 墙内
412 |
413 | # # > 去广告
414 | # - "RULE-SET,Advertising,🛑 拦截"
415 | # # > 下面这个去广告可能误杀较多 看情况自己修改
416 | # - "RULE-SET,AdvertisingDomain,🛑 拦截"
417 |
418 | # > 腾讯 直连
419 | - AND,((NETWORK,TCP),(RULE-SET,Tencent),(DST-PORT,80/443)),🇨🇳 墙内受限
420 | - AND,((NETWORK,UDP),(RULE-SET,Tencent)),🇨🇳 墙内 UDP
421 | - RULE-SET,Tencent,🇨🇳 墙内
422 |
423 | # > 微信 直连
424 | - AND,((NETWORK,TCP),(RULE-SET,WeChat),(DST-PORT,80/443)),🇨🇳 墙内受限
425 | - AND,((NETWORK,UDP),(RULE-SET,WeChat)),🇨🇳 墙内 UDP
426 | - RULE-SET,WeChat,🇨🇳 墙内
427 |
428 | # > 微软 代理(我直连下载慢 代理快 看情况自己修改)
429 | - AND,((NETWORK,UDP),(RULE-SET,Microsoft)),🌑 墙外 UDP
430 | - RULE-SET,Microsoft,🌑 墙外
431 |
432 | # > 苹果服务里需要代理的部分
433 | - AND,((NETWORK,UDP),(RULE-SET,AppleProxy)),🌑 墙外 UDP
434 | - RULE-SET,AppleProxy,🌑 墙外
435 | - AND,((NETWORK,UDP),(RULE-SET,TestFlight)),🌑 墙外 UDP
436 | - RULE-SET,TestFlight,🌑 墙外
437 |
438 | # > 全球服务 代理
439 | - AND,((NETWORK,UDP),(RULE-SET,GlobalDomain)),🌑 墙外 UDP
440 | - RULE-SET,GlobalDomain,🌑 墙外
441 |
442 | - AND,((NETWORK,UDP),(RULE-SET,Global)),🌑 墙外 UDP
443 | - RULE-SET,Global,🌑 墙外
444 |
445 | # > 苹果服务里需要直连的部分(根据情况 可以选择把这一段放在 全球服务 的上面)
446 | - AND,((NETWORK,TCP),(RULE-SET,Apple),(DST-PORT,80/443)),🇨🇳 墙内受限
447 | - AND,((NETWORK,UDP),(RULE-SET,Apple)),🇨🇳 墙内 UDP
448 | - RULE-SET,Apple,🇨🇳 墙内
449 |
450 | # > 国内
451 | - AND,((NETWORK,TCP),(RULE-SET,ChinaMaxDomain),(DST-PORT,80/443)),🇨🇳 墙内受限
452 | - AND,((NETWORK,UDP),(RULE-SET,ChinaMaxDomain)),🇨🇳 墙内 UDP
453 | - RULE-SET,ChinaMaxDomain,🇨🇳 墙内
454 | - AND,((NETWORK,TCP),(RULE-SET,China),(DST-PORT,80/443)),🇨🇳 墙内受限
455 | - AND,((NETWORK,UDP),(RULE-SET,China)),🇨🇳 墙内 UDP
456 | - RULE-SET,China,🇨🇳 墙内
457 | - AND,((NETWORK,TCP),(GEOIP,CN,no-resolve),(DST-PORT,80/443)),🇨🇳 墙内受限
458 | - AND,((NETWORK,UDP),(GEOIP,CN,no-resolve)),🇨🇳 墙内 UDP
459 | - GEOIP,CN,🇨🇳 墙内,no-resolve
460 |
461 | # > 局域网等
462 | - RULE-SET,Lan,DIRECT
463 |
464 | # > 国内 IP
465 | - AND,((NETWORK,TCP),(GEOIP,CN),(DST-PORT,80/443)),🇨🇳 墙内受限
466 | - AND,((NETWORK,UDP),(GEOIP,CN)),🇨🇳 墙内 UDP
467 | - GEOIP,CN,🇨🇳 墙内
468 |
469 | # > 兜底代理
470 | - NETWORK,UDP,🌑 墙外 UDP
471 | - MATCH,🌑 墙外
472 |
--------------------------------------------------------------------------------
/clash/备用/完全免流/template:
--------------------------------------------------------------------------------
1 | port: 7890
2 | socks-port: 7891
3 | mixed-port: 7892
4 | allow-lan: true
5 | bind-address: "*"
6 | geodata-mode: true
7 | unified-delay: true
8 | inbound-tfo: true
9 | tcp-concurrent: true
10 | enable-process: true
11 | mode: rule
12 | log-level: info
13 | ipv6: true
14 | profile:
15 | store-selected: true #节点状态记忆(若不同配置有同代理名称,设置值共享)
16 | store-fake-ip: true
17 |
18 | external-ui: clash-dashboard/dist
19 | external-controller: 0.0.0.0:9090
20 | secret: YourPassword
21 |
22 | tun:
23 | enable: true
24 | device: Meta
25 | stack: system
26 | dns-hijack:
27 | - "any:53"
28 | auto-route: true
29 | auto-detect-interface: true
30 | # 技术原因,enable必须在tun:的下一行
31 |
32 | sniffer:
33 | enable: true
34 | sniffing:
35 | - tls
36 | - http
37 | # force-domain: #需要强制嗅探的域名,默认只对IP嗅探
38 | # - '+' #去掉注释后等于全局嗅探
39 | skip-domain:
40 | - "+.apple.com"
41 | - "Mijia Cloud"
42 | - "+.jd.com"
43 | port-whitelist:
44 | - 80
45 | - 8080
46 | - 8880
47 | - 2052
48 | - 2082
49 | - 2086
50 | - 2095
51 |
52 | - 443
53 | - 2053
54 | - 2083
55 | - 2087
56 | - 2096
57 | - 8443
58 |
59 | - 853
60 |
61 | - 8000-9999
62 | - 5228-5230
63 |
64 | hosts:
65 | "dns.google": 8.8.8.8
66 | dns:
67 | enable: true
68 | ipv6: true
69 | listen: 0.0.0.0:1053
70 | use-hosts: true
71 | enhanced-mode: fake-ip
72 | default-nameserver:
73 | - 119.29.29.29
74 | - 223.5.5.5
75 | nameserver:
76 | - "119.29.29.29#DNS-CN"
77 | - "223.5.5.5#DNS-CN"
78 | proxy-server-nameserver:
79 | - 119.29.29.29
80 | - 223.5.5.5
81 | fallback:
82 | - "1.1.1.1#DNS-GLOBAL"
83 | - "8.8.8.8#DNS-GLOBAL"
84 | fake-ip-range: 198.18.0.1/16
85 | fake-ip-filter:
86 | [
87 | "+.cn",
88 | "+.10010.com",
89 | "+.chinaunicom.com",
90 | "+.baidu.com",
91 | "+.alipay.com",
92 | "+.alipayobjects.com",
93 | "+.dl.google.com",
94 | "+.jijifun.com",
95 | "connect.rom.miui.com",
96 | "captive.apple.com",
97 | "wifi.vivo.com.cn",
98 | "localhost.ptlogin2.qq.com",
99 | "+.msftnsci.com",
100 | "+.msftconnecttest.com",
101 | "+.gstatic.com",
102 | "+.stun.*.*",
103 | "+.stun.*.*.*",
104 | "+.stun.*.*.*.*",
105 | "+.time.*",
106 | "+.time.*.*",
107 | "+.time.*.*.*",
108 | "time1.*.com",
109 | "time2.*.com",
110 | "time3.*.com",
111 | "time4.*.com",
112 | "time5.*.com",
113 | "time6.*.com",
114 | "time7.*.com",
115 | "ntp1.*.com",
116 | "ntp2.*.com",
117 | "ntp3.*.com",
118 | "ntp4.*.com",
119 | "ntp5.*.com",
120 | "ntp6.*.com",
121 | "ntp7.*.com",
122 | "+.ntp.*",
123 | "+.ntp.*.*",
124 | "+.ntp.*.*.*",
125 | "+.lan",
126 | "+.localdomain",
127 | "+.example",
128 | "+.invalid",
129 | "+.localhost",
130 | "+.test",
131 | "+.local",
132 | "+.home.arpa",
133 | "time1.cloud.tencent.com",
134 | "+.music.163.com",
135 | "+.126.net",
136 | "musicapi.taihe.com",
137 | "music.taihe.com",
138 | "songsearch.kugou.com",
139 | "trackercdn.kugou.com",
140 | "+.kuwo.cn",
141 | "api-jooxtt.sanook.com",
142 | "api.joox.com",
143 | "joox.com",
144 | "+.y.qq.com",
145 | "streamoc.music.tc.qq.com",
146 | "mobileoc.music.tc.qq.com",
147 | "isure.stream.qqmusic.qq.com",
148 | "dl.stream.qqmusic.qq.com",
149 | "aqqmusic.tc.qq.com",
150 | "amobile.music.tc.qq.com",
151 | "+.xiami.com",
152 | "+.music.migu.cn",
153 | "+.msftncsi.com",
154 | "localhost.sec.qq.com",
155 | "+.srv.nintendo.net",
156 | "+.stun.playstation.net",
157 | "xbox.*.microsoft.com",
158 | "+.xboxlive.com",
159 | "+.battlenet.com.cn",
160 | "+.wotgame.cn",
161 | "+.wggames.cn",
162 | "+.wowsgame.cn",
163 | "+.wargaming.net",
164 | "proxy.golang.org",
165 | "heartbeat.belkin.com",
166 | "+.linksys.com",
167 | "+.linksyssmartwifi.com",
168 | "+.router.asus.com",
169 | "mesu.apple.com",
170 | "swscan.apple.com",
171 | "swquery.apple.com",
172 | "swdownload.apple.com",
173 | "swcdn.apple.com",
174 | "swdist.apple.com",
175 | "lens.l.google.com",
176 | "stun.l.google.com",
177 | "+.nflxvideo.net",
178 | "+.square-enix.com",
179 | "+.finalfantasyxiv.com",
180 | "+.ffxiv.com",
181 | "+.mcdn.bilivideo.cn",
182 | "WORKGROUP",
183 | ]
184 | fallback-filter:
185 | geoip: true
186 | geoip-code: CN
187 | geosite:
188 | # - '!CN'
189 | # - geolocation-!cn
190 | - gfw
191 | - greatfire
192 | domain:
193 | - +.google.com
194 | - +.facebook.com
195 | - +.twitter.com
196 | - +.youtube.com
197 | - +.xn--ngstr-lra8j.com
198 | - +.google.cn
199 | - +.googleapis.cn
200 | - +.googlevideo.com
201 | - +.gvt1.com
202 | - +.github.com
203 | - +.githubusercontent.com
204 | ipcidr:
205 | - 0.0.0.0/8
206 | - 10.0.0.0/8
207 | - 100.64.0.0/10
208 | - 127.0.0.0/8
209 | - 169.254.0.0/16
210 | - 172.16.0.0/12
211 | - 192.0.0.0/24
212 | - 192.0.2.0/24
213 | - 192.88.99.0/24
214 | - 192.168.0.0/16
215 | - 198.18.0.0/15
216 | - 198.51.100.0/24
217 | - 203.0.113.0/24
218 | - 224.0.0.0/4
219 | - 240.0.0.0/4
220 | - 255.255.255.255/32
--------------------------------------------------------------------------------
/clash/备用/完全免流/说明.txt:
--------------------------------------------------------------------------------
1 | 完全免流为云免,配合tun模式可以实现几乎0跳点
2 | 请自行把模块内原文件替换为本文件夹内配置文件
3 | 完全免流可以最大限度减少通用流量消耗,但是需要服务器,请自备免流机场
4 | 可以搜索下 免流骚 养猪场
5 | 本模块作者不使用免流机场,不会对完全免流配置进行后续维护
6 | 如有任何问题,请来电报群组
7 | https://t.me/blowH2O
8 | 进行提问,能不能解决全看脸
9 |
10 |
--------------------------------------------------------------------------------
/clash/备用/控制器.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CloudF1are/Clash-meta-for-magisk/35594f3a3718371bc81eb9b2aab7b5c08390082e/clash/备用/控制器.apk
--------------------------------------------------------------------------------
/clash/备用/本地免流/config.yaml:
--------------------------------------------------------------------------------
1 |
2 | proxies:
3 | #此处用来放本地免流配置,本地免流只能免80/443端口的TCP,其他连接(包括所有udp)不行
4 | - name: "百度免流"
5 | type: http
6 | server: 157.0.148.53
7 | port: 443
8 | headers:
9 | X-T5-Auth: "1962898709"
10 | User-Agent:
11 | "okhttp/3.11.0 Dalvik/2.1.0 (Linux; U; Android 11; Redmi K30 5G Build/RKQ1.200826.002)
12 | baiduboxapp/11.0.5.12 (Baidu; P1 11)"
13 |
14 | proxy-providers:
15 |
16 | 可乐云:
17 | type: http
18 | url: "https://www.naiun.co/api/v1/client/subscribe?token=bb71ad25fd1d7341560483c7b78a61a7"
19 | path: ./proxy_providers/可乐云.yaml
20 | interval: 21600
21 | health-check:
22 | enable: true
23 | url: http://www.gstatic.com/generate_204
24 | interval: 1800
25 | 魔戒:
26 | type: http
27 | url: "订阅链接地址"
28 | path: ./proxy_providers/魔戒.yaml
29 | interval: 21600
30 | health-check:
31 | enable: true
32 | url: http://www.gstatic.com/generate_204
33 | interval: 1800
34 | 备用:
35 | type: http
36 | url: "在底下选一个吧,如果有好的欢迎提交"
37 | path: ./proxy_providers/备用.yaml
38 | interval: 10800
39 | health-check:
40 | enable: true
41 | url: http://www.gstatic.com/generate_204
42 | interval: 1800
43 | #欢迎提交更多白嫖订阅
44 | #https://pastebin.com/raw/GxR5pELe
45 | #https://openit.daycat.space/clash
46 | #https://nullnode.top/clash主站 下属 https://nullnode.top/clashnode
47 | #可以白嫖的机场 https://acec.cloud/
48 | # 魔戒 可乐云 为机场名,可以更换,要换必须全换,建议使用编辑器的查找功能避免遗漏
49 | proxy-groups:
50 | - name: 机场
51 | type: select
52 | proxies:
53 | - 可乐云
54 | - 魔戒
55 | - 备用
56 | - 美国节点
57 | - 负载均衡
58 |
59 | - name: 可乐云
60 | type: select
61 | use:
62 | - 可乐云
63 |
64 | - name: 魔戒
65 | type: select
66 | use:
67 | - 魔戒
68 |
69 | - name: 备用
70 | type: select
71 | use:
72 | - 备用
73 |
74 |
75 | - name: 美国节点
76 | type: select
77 | use:
78 | - 可乐云
79 | - 魔戒
80 | - 备用
81 | filter: '美国|USA|美國'
82 |
83 | - name: 负载均衡
84 | type: load-balance
85 | use:
86 | - 可乐云
87 | url: 'http://www.gstatic.com/generate_204'
88 | interval: 1800
89 | filter: '美国|USA|美國.*1.0'
90 | strategy: consistent-hashing
91 | #meta的特性,如果你经常使用某个地区节点可以使用过滤器便于选择 美国节点 可以改为其他名称
92 | #但是要改就得全改 ,建议使用文本编辑器的替换功能避免遗漏;过滤器内容用 | 分割,支持通配符
93 | #可乐云性增加了负载均衡节点
94 | - name: 墙内网址
95 | type: select
96 | proxies:
97 | - DIRECT
98 | - 机场
99 |
100 | - name: 墙内可免
101 | type: select
102 | proxies:
103 | - 墙内网址
104 | - 本地免流
105 |
106 | - name: 本地免流
107 | type: select
108 | proxies:
109 | - 百度免流
110 |
111 |
112 | - name: 其他
113 | type: select
114 | proxies:
115 | - DIRECT
116 | - 机场
117 | - 墙内网址
118 |
119 | rule-providers:
120 | AppProxy:
121 | type: file
122 | behavior: classical
123 | path: ./rule_providers/AppProxy.yaml
124 | AppDirect:
125 | type: file
126 | behavior: classical
127 | path: ./rule_providers/AppDirect.yaml
128 | userDirect:
129 | type: file
130 | behavior: classical
131 | path: ./rule_providers/userDirect.yaml
132 | #用户自定义直连,文件在data/clash/rule-provider/userdirect,需要的自己写入,格式参照备用里面的clash官方文档
133 | rules:
134 | - RULE-SET,AppProxy,机场
135 | - RULE-SET,AppDirect,墙内网址
136 | - RULE-SET,userDirect,DIRECT
137 | - GEOSITE,category-ads-all,REJECT
138 | - GEOIP,private,DIRECT
139 | #-------免流相关规则
140 | #此处应有把微信qq支付宝等事逼不走免流的规则,让我看看geo教程
141 | - AND,((NETWORK,TCP),(GEOSITE,geolocation-cn),(DST-PORT,80/443)),墙内可免
142 | - AND,((NETWORK,UDP),(GEOSITE,geolocation-cn)),墙内网址
143 | - GEOSITE,geolocation-cn,墙内网址
144 |
145 | - AND,((NETWORK,TCP),(GEOIP,CN,no-resolve),(DST-PORT,80/443)),墙内可免
146 | - AND,((NETWORK,UDP),(GEOIP,CN,no-resolve)),墙内网址
147 | - GEOIP,CN,墙内网址
148 | #-----------------墙外流量
149 | - GEOSITE,geolocation-!cn,机场
150 | - GEOIP,!CN,机场
151 | - MATCH,其他
152 |
--------------------------------------------------------------------------------
/clash/备用/本地免流/template:
--------------------------------------------------------------------------------
1 | tproxy-port: 7893
2 | mixd-prot: 7890
3 | allow-lan: true
4 | geodata-mode: true
5 | unified-delay: false
6 | mode: rule
7 | log-level: info
8 | ipv6: false
9 | udp: true
10 | tcp-concurrent: false
11 | enable-process: true
12 |
13 | sniffer:
14 | enable: false
15 | sniffing:
16 | - tls
17 | - http
18 | skip-domain:
19 | - 'Mijia Cloud'
20 | - 'dlg.io.mi.com'
21 | - '+.apple.com'
22 | - '*.baidu.com'
23 | force-domain:
24 | - '+'
25 | - 'google.com'
26 | port-whitelist:
27 | - 80
28 | - 443
29 | - 8000-9000
30 |
31 |
32 | profile:
33 | store-fake-ip: true
34 | store-selected: true
35 | external-controller: 0.0.0.0:9090
36 | external-ui: clash-dashboard/dist
37 |
38 | tun:
39 | enable: false
40 | device: Meta
41 | stack: system # gvisor
42 | dns-hijack:
43 | - any:53
44 | auto-route: true
45 | auto-detect-interface: true
46 | # 技术原因,enable必须在tun:的下一行
47 |
48 | dns:
49 | enable: true
50 | listen: 0.0.0.0:1053
51 | ipv6: false
52 | enhanced-mode: redir-host # fake-ip
53 | use-hosts: true
54 | fake-ip-range: 198.18.0.1/16
55 | fake-ip-filter:
56 | - localhost.ptlogin2.qq.com
57 | - '*.lan'
58 | - '*.linksys.com'
59 | - '*.ntp.*'
60 | default-nameserver:
61 | - 119.29.29.29
62 | - 223.5.5.5
63 | proxy-server-namesever:
64 | - https://120.53.53.53/dns-query
65 | - https://223.5.5.5/dns-query
66 | nameserver:
67 | #- 119.29.29.29
68 | #- 223.5.5.5
69 | - https://doh.pub/dns-query
70 | - https://dns.alidns.com/dns-query
71 | #大部分机场的默认dns,仅供参考
72 | fallback:
73 | #- 1.1.1.1#机场
74 | #- 8.8.4.4#机场
75 | - https://doh.dns.sb/dns-query
76 | - https://dns.cloudflare.com/dns-query
77 | - https://dns.twnic.tw/dns-query
78 | fallback-filter:
79 | geosite: ["!CN"]
80 | ipcidr:
81 | - 240.0.0.0/4
82 | - 0.0.0.0/32
83 | domain:
84 | - +.google.com
85 | - +.facebook.com
86 | - +.twitter.com
87 | - +.youtube.com
88 | - +.google.cn
89 | - +.googleapis.cn
90 | - +.googlevideo.com
91 | - +.github.com
92 | - +.githubusercontent.com
--------------------------------------------------------------------------------
/clash/备用/本地免流/免流说明.txt:
--------------------------------------------------------------------------------
1 | 使用方法 将默认配置替换为 本地免流 文件夹内配置
2 | 本模块内置免流采用本地免,优点是无需付费,缺点是仅支持tcp 80/443端口
3 | 其他连接和udp均不支持,走出墙代理的流量不能免流
4 | 也就是说本模块免流范围有限,”跳点“很高,仅适合通用流量多的人使用,使用时请自行关注剩余流量,避免超额
5 | 对于流量监控,可以使用网页版 https://jiling.ink/wkll.php 获取cookie
6 | 再使用flwolite 进行流量监控 下载地址 https://github.com/nongchengqi/FlowLite
7 | 模块中也附带了一份,备用 文件夹里找到安装即可
8 | 如果需要完全免流,请手动移动”完全免流“内相关文件替换掉文件夹内原本文件,并且自行购买合适免流机场填写订阅链接
--------------------------------------------------------------------------------
/clash/备用/极简版/config.yaml:
--------------------------------------------------------------------------------
1 | proxies:
2 | proxy-providers:
3 |
4 | 机场:
5 | type: http
6 | url: "订阅链接地址,填写在双引号以内"
7 | path: ./proxy_providers/机场.yaml
8 | interval: 21600
9 |
10 | proxy-groups:
11 | - name: 节点选择
12 | type: select
13 | use:
14 | - 机场
15 |
16 | rule:
17 | - IP-CIDR,127.0.0.1/32,REJECT,no-resolve
18 | - GEOSITE,geolocation-cn,DIRECT
19 | - GEOSITE,geolocation-!cn,节点选择
20 | - GEOIP,CN,DIRECT
21 | - GEOIP,!CN,节点选择
22 | - MATCH,节点选择
23 |
--------------------------------------------------------------------------------
/clash/备用/极简版/template:
--------------------------------------------------------------------------------
1 | tproxy-port: 7893
2 | allow-lan: true
3 | geodata-mode: true
4 | mode: rule
5 | log-level: silent
6 | ipv6: false
7 |
8 | profile:
9 | store-fake-ip: true
10 | store-selected: true
11 | external-controller: 0.0.0.0:9090
12 | external-ui: clash-dashboard/dist
13 |
14 | dns:
15 | enable: true
16 | listen: 0.0.0.0:1053
17 | ipv6: false
18 | enhanced-mode: redir-host
19 | nameserver:
20 | - 119.29.29.29
21 | - 223.5.5.5
22 | - 1.1.1.1#节点选择
23 |
--------------------------------------------------------------------------------
/clash/备用/极简版/极简版说明.txt:
--------------------------------------------------------------------------------
1 | 为了统一版本便于维护,原极简版不再维护,和正常版合并
2 | 共用一个安装包,默认为正常版,替换相应文件后即可当作极简版
3 |
4 | 本极简版适合轻度使用,专注于一件事:墙外走代理,墙内走直连
5 | 使用方法,用极简版文件夹里面的两个文件替换data/clash文件夹中原同名文件
6 | 打开config.yaml指定位置填入自己订阅链接,重启手机即可使用
7 |
8 | 使用magisk管理器启停
9 | 订阅连链接填写到data/clash/config.yaml指定位置
10 | 浏览器打开 127.0.0.1:9090/ui 访问面板
--------------------------------------------------------------------------------
/clash/备用/流量监视软件Flow lite.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CloudF1are/Clash-meta-for-magisk/35594f3a3718371bc81eb9b2aab7b5c08390082e/clash/备用/流量监视软件Flow lite.apk
--------------------------------------------------------------------------------
/clash/备用/自动开关免流(未完成)/Message.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CloudF1are/Clash-meta-for-magisk/35594f3a3718371bc81eb9b2aab7b5c08390082e/clash/备用/自动开关免流(未完成)/Message.apk
--------------------------------------------------------------------------------
/clash/备用/自动开关免流(未完成)/Toast.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CloudF1are/Clash-meta-for-magisk/35594f3a3718371bc81eb9b2aab7b5c08390082e/clash/备用/自动开关免流(未完成)/Toast.apk
--------------------------------------------------------------------------------
/clash/备用/自动开关免流(未完成)/proxy_cellular.sh:
--------------------------------------------------------------------------------
1 | svc data enable
2 |
3 | am start -a android.intent.action.MAIN -e toasttext "切换蜂窝规则" -n bellavita.toast/.MainActivity
4 |
5 |
6 | curl 'http://127.0.0.1:9090/proxies/%F0%9F%87%A8%F0%9F%87%B3%20%E5%A2%99%E5%86%85' \
7 | -X 'PUT' \
8 | -H 'Authorization: Bearer YourPassword' \
9 | --data-raw '{"name":"🆓🇨🇳 墙内免流"}' \
10 | --compressed
11 | curl 'http://127.0.0.1:9090/proxies/%F0%9F%8C%91%20%E5%A2%99%E5%A4%96' \
12 | -X 'PUT' \
13 | -H 'Authorization: Bearer YourPassword' \
14 | --data-raw '{"name":"🆓🌑 墙外免流"}' \
15 | --compressed
16 | curl 'http://127.0.0.1:9090/proxies/%F0%9F%87%A8%F0%9F%87%B3%20%E5%A2%99%E5%86%85%E5%8F%97%E9%99%90' \
17 | -X 'PUT' \
18 | -H 'Authorization: Bearer YourPassword' \
19 | --data-raw '{"name":"🆓🇨🇳 墙内受限免流"}' \
20 | --compressed
21 | curl 'http://127.0.0.1:9090/proxies/%F0%9F%87%A8%F0%9F%87%B3%20%E5%A2%99%E5%86%85%20UDP' \
22 | -X 'PUT' \
23 | -H 'Authorization: Bearer YourPassword' \
24 | --data-raw '{"name":"🆓🇨🇳 墙内免流 UDP"}' \
25 | --compressed
26 | curl 'http://127.0.0.1:9090/proxies/%F0%9F%8C%91%20%E5%A2%99%E5%A4%96%20UDP' \
27 | -X 'PUT' \
28 | -H 'Authorization: Bearer YourPassword' \
29 | --data-raw '{"name":"🆓🌑 墙外 UDP"}' \
30 | --compressed
31 |
32 | curl 'http://127.0.0.1:9090/connections' \
33 | -X 'DELETE' \
34 | -H 'Authorization: Bearer YourPassword'
35 |
36 | # sleep 1
37 |
38 | # svc data disable
39 |
40 | # sleep 1
41 |
42 | # svc data enable
--------------------------------------------------------------------------------
/clash/备用/自动开关免流(未完成)/proxy_update.sh:
--------------------------------------------------------------------------------
1 | res=`dumpsys netstats | grep -E 'iface=wlan.*networkId'`
2 |
3 | echo $res
4 |
5 | if [ -z "${res}" ]; then
6 | echo '未连接wifi'
7 |
8 | sh /data/sh/proxy_cellular.sh
9 | else
10 | echo '连接wifi'
11 |
12 | sh /data/sh/proxy_wifi.sh
13 | fi
14 |
15 |
16 |
--------------------------------------------------------------------------------
/clash/备用/自动开关免流(未完成)/proxy_wifi.sh:
--------------------------------------------------------------------------------
1 | svc data disable
2 |
3 |
4 | am start -a android.intent.action.MAIN -e toasttext "切换wifi规则" -n bellavita.toast/.MainActivity
5 |
6 |
7 |
8 | curl 'http://127.0.0.1:9090/proxies/%F0%9F%87%A8%F0%9F%87%B3%20%E5%A2%99%E5%86%85' \
9 | -X 'PUT' \
10 | -H 'Authorization: Bearer YourPassword' \
11 | --data-raw '{"name":"DIRECT"}' \
12 | --compressed
13 | curl 'http://127.0.0.1:9090/proxies/%F0%9F%8C%91%20%E5%A2%99%E5%A4%96' \
14 | -X 'PUT' \
15 | -H 'Authorization: Bearer YourPassword' \
16 | --data-raw '{"name":"🚀🌑 墙外非免流"}' \
17 | --compressed
18 | curl 'http://127.0.0.1:9090/proxies/%F0%9F%87%A8%F0%9F%87%B3%20%E5%A2%99%E5%86%85%E5%8F%97%E9%99%90' \
19 | -X 'PUT' \
20 | -H 'Authorization: Bearer YourPassword' \
21 | --data-raw '{"name":"🇨🇳 墙内"}' \
22 | --compressed
23 | curl 'http://127.0.0.1:9090/proxies/%F0%9F%87%A8%F0%9F%87%B3%20%E5%A2%99%E5%86%85%20UDP' \
24 | -X 'PUT' \
25 | -H 'Authorization: Bearer YourPassword' \
26 | --data-raw '{"name":"🇨🇳 墙内"}' \
27 | --compressed
28 | curl 'http://127.0.0.1:9090/proxies/%F0%9F%8C%91%20%E5%A2%99%E5%A4%96%20UDP' \
29 | -X 'PUT' \
30 | -H 'Authorization: Bearer YourPassword' \
31 | --data-raw '{"name":"🚀🌑 墙外非免流 UDP"}' \
32 | --compressed
33 |
34 | curl 'http://127.0.0.1:9090/connections' \
35 | -X 'DELETE' \
36 | -H 'Authorization: Bearer YourPassword'
37 |
--------------------------------------------------------------------------------
/clash/备用/自动开关免流(未完成)/网卡检测器:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CloudF1are/Clash-meta-for-magisk/35594f3a3718371bc81eb9b2aab7b5c08390082e/clash/备用/自动开关免流(未完成)/网卡检测器
--------------------------------------------------------------------------------
/clash/备用/自动开关免流(未完成)/说明.txt:
--------------------------------------------------------------------------------
1 | 本来想要自己设置一下切换到WiFi关闭免流功能
2 | 但是内核不支持,现在有两种方法,一种是配合外部xposed edge等工具,检测到切换网络时
3 | 执行切换代理组脚本,但是本彩笔不会写,另一种方法时用网卡检测器(本文件夹中 网卡检测器)
4 | 使用方法,把网卡检测器重命名为1 权限777,mt在能看到网卡检测器的情况下 点击右上角的菜单,打开终端
5 | 然后输入 ./1 回车,手机切换到流量 就能知道自己的手机,流量是什么网卡了,然后代理组写好
6 | (代理组相关教程请看备用-可参考模板 内的各种教程中关于带网卡代理组相关配置)
7 | 每个型号手机网卡名不太一样,别到处问了
8 | 由于本模块作者是给热点机使用免流,暂时不需要自动切换免流开关
9 | 本功能不接受反馈,请自行研究使用方法,研究不出来就自己手动切换吧
10 | 注意:现有的脚本适用于完全免流配置,本地免流配置下需要先修改再使用
--------------------------------------------------------------------------------
/clash/备用/说明和注意事项.txt:
--------------------------------------------------------------------------------
1 | 包名分流自动转为 uid规则,在 clash.config 填入包名
2 | 打开data/clash/clash.confug
3 | 就可以看到可以添加包名的地方,记得用一个一行写在双引号里面
4 | scripts文件夹下打开终端输入 ./upSub.sh -s 即可手动更新套餐信息,默认为1小时自动更新一次
5 |
6 | 通配符说明 适用于过滤器
7 | [转发自频道 Kattesnive (kattesnive)]
8 | (A).*(B) 节点名既有 A 也有 B
9 | (A)|(B) 节点名有 A 或者 B
10 | ^(?!.*A) 节点名不含有 A
11 | ^(?!.*A).*(B) 节点名不含有 A 但含有 B
12 | ^(?!.*(A|B)) 节点名既不含有 A 也不含有 B
13 |
14 | clash自动测试命令 请在终端输入后查看报错信息进行故障排除
15 | clash -t -f /data/clash/run/config.yaml
16 |
17 | 由于rule-provider效率较低,目前已经转为使用geo规则,使用的geo文件地址如下
18 | https://github.com/Loyalsoldier/v2ray-rules-dat
19 |
20 | 善用geo文件,所有可用的标签列表:
21 | https://github.com/v2fly/domain-list-community/tree/master/data
22 |
23 | 检测是否连接成功网址
24 | https://ip.skk.moe/
25 |
26 | 防止回环的另外一种办法
27 | rules:
28 | - IP-CIDR,127.0.0.1/32,REJECT,no-resolve
29 | - PROCESS-NAME,clash,REJECT # 解决回环小妙招 打开会导致无法手动更新订阅,只能等待自动更新,cfm现已内置完善的防回环措施,非调试不建议使用
30 |
31 |
32 | ------------------------------------------以下为部分可自行替换配置,更多配置请看 可参考模板 文件夹内配置-----------------------------------------------
33 | 负载均衡实列
34 | proxy-groups:
35 | - name: 代理
36 | type: select
37 | proxies:
38 | - 机场1
39 | - 机场2
40 | - 机场3
41 | - 备用1
42 | - 备用2
43 | - 备用3
44 | - 自动选择1
45 | - 自动选择2
46 | - 自动选择3
47 | - 负载均衡(HK)
48 | - name: 负载均衡(HK)
49 | filter: "港|香港|HK|HongKong"
50 | type: load-balance
51 | use:
52 | - 机场1
53 | - 机场2
54 | - 机场3
55 | url: http://www.gstatic.com/generate_204
56 | interval: 600
57 |
58 |
59 | #其他的dns,不知道哪个更好一点
60 | nameserver:
61 | - https://h.iqiq.io:777/dns-query
62 | - https://dns.alidns.com/dns-query
63 | - https://doh.pub/dns-query
64 |
65 | - https://doh.360.cn/dns-query#CN-)TCP
66 | - dns.alidns.com#CN-)UDP
67 | - https://dns.alidns.com/dns-query
68 | - https://doh.pub/dns-query
69 | fallback:
70 | - https://h.iqiq.io:777/dns-query
71 | - https://doh.opendns.com/dns-query
72 | - https://dns.adguard.com/dns-query
73 | - https://dns.google/dns-query
74 |
75 | - https://doh.opendns.com/dns-query#MATCH-)TCP
76 | - dns.google#MATCH-)UDP
77 | - https://dns.adguard.com/dns-query
78 | - https://dns.google/dns-query#DNS
79 | - https://cloudflare-dns.com/dns-query#DNS
80 |
81 |
82 | 可选规则
83 | GoogleFCM:
84 | type: http
85 | behavior: classical
86 | url: https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/GoogleFCM/GoogleFCM.yaml
87 | path: ./rule_providers/GoogleFCM.yaml
88 | interval: 21600
89 |
90 | AD:
91 | type: http
92 | behavior: domain
93 | url: https://raw.githubusercontent.com/privacy-protection-tools/anti-AD/master/anti-ad-clash.yaml
94 | path: ./rule_providers/Ad.yaml
95 | interval: 21600
96 | Google:
97 | type: http
98 | behavior: classical
99 | url: https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Google/Google.yaml
100 | path: ./rule_providers/Google.yaml
101 | interval: 21600
102 | WeChat:
103 | type: http
104 | behavior: classical
105 | url: https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/WeChat/WeChat.yaml
106 | path: ./rule_providers/WeChat.yaml
107 | interval: 21600
108 | BiliBili:
109 | type: http
110 | behavior: classical
111 | url: https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/BiliBili/BiliBili.yaml
112 | path: ./rule_providers/BiliBili.yaml
113 | interval: 21600
114 | Tencent:
115 | type: http
116 | behavior: classical
117 | url: https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Tencent/Tencent.yaml
118 | path: ./rule_providers/Tencent.yaml
119 | interval: 21600
120 |
121 | Local:
122 | type: file
123 | behavior: classical
124 | path: ./rule_providers/Locale.yaml
125 |
126 |
127 |
128 |
129 | 规则可用的关键字(机翻)
130 |
131 | DOMAIN:DOMAIN,www.google.com,policy只路由www.google.com到policy.
132 | DOMAIN-SUFFIX:将任何以,或,DOMAIN-SUFFIX,youtube.com,policy结尾的 FQDN 路由到. 这类似于通配符。youtube.comwww.youtube.comfoo.bar.youtube.compolicy+
133 | DOMAIN-KEYWORD:DOMAIN-KEYWORD,google,policy将任何包含google,www.google.com或googleapis.com, 的 FQDN 路由到policy.
134 | GEOIP:GEOIP,CN,policy将任何到中国 IP 地址的请求路由到policy.
135 | IP-CIDR:IP-CIDR,127.0.0.0/8,DIRECT将任何数据包路由127.0.0.0/8到DIRECT策略。
136 | IP-CIDR6:IP-CIDR6,2620:0:2d0:200::7/32,policy将任何数据包路由2620:0:2d0:200::7/32到policy.
137 | SRC-IP-CIDR:将SRC-IP-CIDR,192.168.1.201/32,DIRECT任何数据包路由到 策略。192.168.1.201/32DIRECT
138 | SRC-PORT:将任何数据包从端口 80SRC-PORT,80,policy路由到.policy
139 | DST-PORT:将DST-PORT,80,policy任何数据包路由到端口 80 到policy.
140 | PROCESS-NAME:PROCESS-NAME,nc,DIRECT将进程路由nc到DIRECT. (支持macOS、Linux、FreeBSD和Windows)
141 | MATCH:MATCH,policy将其余数据包路由到policy. 这条规则是必需的。
142 | 还有两个额外的特殊政策:
143 |
144 | DIRECT:直接连接到目标,不涉及任何代理
145 | REJECT:数据包的黑洞。Clash 不会处理此策略的任何 I/O。
146 | 策略可以是DIRECT、REJECT、代理组或代理服务器。
147 |
148 | 没有解决
149 | no-resolve是 、 或 规则的GEOIP附加IP-CIDR选项IP-CIDR6。附加,no-resolve到这些规则以启用。默认情况下,Clash 在遇到 IP 规则时会将域名转换为 IP 地址。当遇到具有 FQDN 目标的数据包时,Clash 会跳过启用此选项的 IP 规则。
150 |
--------------------------------------------------------------------------------
/customize.sh:
--------------------------------------------------------------------------------
1 | SKIPUNZIP=1
2 |
3 | status=""
4 | architecture=""
5 | system_gid="1000"
6 | system_uid="1000"
7 | clash_data_dir="/data/clash"
8 | modules_dir="/data/adb/modules"
9 | ca_path="/system/etc/security/cacerts"
10 | CPFM_mode_dir="${modules_dir}/clash_premium"
11 | mod_config="${clash_data_dir}/clash.config"
12 | geoip_file_path="${clash_data_dir}/Country.mmdb"
13 | apkPath="${clash_data_dir}/dashboard.apk"
14 |
15 | if [ -d "${CPFM_mode_dir}" ] ; then
16 | touch ${CPFM_mode_dir}/remove && ui_print "- CPFM模块在重启后将会被删除."
17 | fi
18 |
19 | case "${ARCH}" in
20 | arm)
21 | architecture="armv7"
22 | ui_print "不支持的架构"
23 | exit 1
24 | ;;
25 | arm64)
26 | architecture="armv8"
27 | ;;
28 | x86)
29 | architecture="386"
30 | ui_print "不支持的架构"
31 | exit 1
32 | ;;
33 | x64)
34 | architecture="amd64"
35 | ui_print "不支持的架构"
36 | exit 1
37 | ;;
38 | esac
39 |
40 | mkdir -p ${MODPATH}/system/bin
41 | mkdir -p ${clash_data_dir}
42 | mkdir -p ${MODPATH}${ca_path}
43 |
44 | unzip -o "${ZIPFILE}" -x 'META-INF/*' -d $MODPATH >&2
45 |
46 | mv -f ${clash_data_dir} ${clash_data_dir}.old
47 | mkdir ${clash_data_dir}
48 | tar -xjf ${MODPATH}/binary/${ARCH}.tar.bz2 -C ${MODPATH}/system/bin/
49 | mv ${MODPATH}/cacert.pem ${MODPATH}${ca_path}
50 | mv -n ${MODPATH}/clash-dashboard ${clash_data_dir}/
51 | rm -rf ${MODPATH}/clash-dashboard
52 | mv -f ${MODPATH}/clash/* ${clash_data_dir}/
53 | rm -rf ${MODPATH}/clash
54 | rm -rf ${MODPATH}/binary
55 |
56 | if [ ! -f "${clash_data_dir}/packages.list" ] ; then
57 | touch ${clash_data_dir}/packages.list
58 | fi
59 |
60 | sleep 1
61 |
62 |
63 | ui_print "- 开始设置环境权限."
64 | set_perm_recursive ${MODPATH} 0 0 0755 0644
65 | set_perm ${MODPATH}/system/bin/setcap 0 0 0755
66 | set_perm ${MODPATH}/system/bin/getcap 0 0 0755
67 | set_perm ${MODPATH}/system/bin/getpcaps 0 0 0755
68 | set_perm ${MODPATH}${ca_path}/cacert.pem 0 0 0644
69 | set_perm ${MODPATH}/system/bin/curl 0 0 0755
70 | set_perm_recursive ${clash_data_dir} ${system_uid} ${system_gid} 0755 0644
71 | set_perm_recursive ${clash_data_dir}/scripts ${system_uid} ${system_gid} 0755 0755
72 | set_perm ${MODPATH}/system/bin/clash ${system_uid} ${system_gid} 6755
73 | set_perm ${clash_data_dir}/clash.config ${system_uid} ${system_gid} 0755
74 | set_perm ${clash_data_dir}/packages.list ${system_uid} ${system_gid} 0644
75 | #安装控制器
76 | if [ "$(pm list packages | grep com.dashboard.kotlin)" ] || [ "$(pm list packages | grep -s com.dashboard.kotlin)" ];then
77 | ui_print "- 无需安装DashBoard."
78 | else
79 | ui_print "- 开始安装DashBoard."
80 | pm install -r --user 0 data/clash/备用/控制器.apk
81 | ui_print "- ↑显示Success即为安装完成."
82 | ui_print "- 如果失败请手动安装 安装包文件在:/data/clash/备用/控制器.apk"
83 | fi
84 | ui_print "- 模块安装已完成"
85 | ui_print "- 请进入data/clash/config.yaml 指定位置填写订阅链接"
86 | ui_print "- 建议打开 备用 文件夹仔细查看详细说明和配置模板"
87 | ui_print "- 多看看教程,免得出问题一脸懵逼到处问"
--------------------------------------------------------------------------------
/module.prop:
--------------------------------------------------------------------------------
1 | id=Clash_For_Magisk
2 | name=Clash.Meta For Magisk
3 | version=大王6.1版8.30魔改 支持免流 稳定版
4 | versionCode=20220423
5 | author=GfwFucker 大王
6 | description=Clash.Meta 透明代理模块 内核版本:1.13.1
7 |
--------------------------------------------------------------------------------
/service.sh:
--------------------------------------------------------------------------------
1 | until [ $(getprop init.svc.bootanim) = "stopped" ] ; do
2 | sleep 5
3 | done
4 |
5 | service_path=`realpath $0`
6 | module_dir=`dirname ${service_path}`
7 | data_dir="/data/clash"
8 | scripts_dir="${data_dir}/scripts"
9 | Clash_data_dir="/data/clash"
10 | Clash_run_path="${Clash_data_dir}/run"
11 | Clash_pid_file="${Clash_run_path}/clash.pid"
12 | busybox_path="/data/adb/magisk/busybox"
13 |
14 | if [ -f ${Clash_pid_file} ] ; then
15 | rm -rf ${Clash_pid_file}
16 | fi
17 |
18 | rm -rf ${Clash_run_path}/run.logs
19 | nohup ${busybox_path} crond -c ${Clash_run_path} > /dev/null 2>&1 &
20 |
21 | ${scripts_dir}/clash.service -s && ${scripts_dir}/clash.iptables -s
22 |
23 | inotifyd ${scripts_dir}/clash.inotify ${module_dir} >> /dev/null &
--------------------------------------------------------------------------------
/uninstall.sh:
--------------------------------------------------------------------------------
1 | Clash_data_dir="/data/clash"
2 | Clash_old="/data/clash.old"
3 | rm_data() {
4 | rm -rf ${Clash_data_dir}
5 | rm -rf ${Clash_old}
6 | }
7 |
8 | rm_data
--------------------------------------------------------------------------------