├── App Icon ├── Icon-60@2x.png ├── Icon-60@3x.png ├── Icon-76@2x.png ├── Icon-83.5@2x.png ├── Icon-Small-40@2x.png ├── Icon-Small-60.png ├── Icon-Small-60@2x.png ├── Icon-Small-60@3x.png ├── iTunesArtwork.png └── iTunesArtwork@2x.png ├── Nodes └── ExampleNodes.list ├── Plugin ├── Plugin_Arg.plugin ├── Plugin_Example.plugin ├── Plugin_Example2.plugin ├── Plugin_Example3.plugin └── Plugin_Example4.plugin ├── README.md ├── RemoteScript └── RemoteScript_Example.plist ├── Rewrite └── AutoRewrite_Example.list ├── Rule ├── ExampleRule.list └── ExampleRule2.list ├── Script ├── cron.js ├── generic_example.js ├── http.js ├── netChanged.js ├── plugin_arg.js ├── plugin_example.js ├── resourceParserExample.js ├── script_API.md └── script_README.md └── example.conf /App Icon/Icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Loon0x00/LoonExampleConfig/fd3547f36cbe2463efb0af71665190290b32485b/App Icon/Icon-60@2x.png -------------------------------------------------------------------------------- /App Icon/Icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Loon0x00/LoonExampleConfig/fd3547f36cbe2463efb0af71665190290b32485b/App Icon/Icon-60@3x.png -------------------------------------------------------------------------------- /App Icon/Icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Loon0x00/LoonExampleConfig/fd3547f36cbe2463efb0af71665190290b32485b/App Icon/Icon-76@2x.png -------------------------------------------------------------------------------- /App Icon/Icon-83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Loon0x00/LoonExampleConfig/fd3547f36cbe2463efb0af71665190290b32485b/App Icon/Icon-83.5@2x.png -------------------------------------------------------------------------------- /App Icon/Icon-Small-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Loon0x00/LoonExampleConfig/fd3547f36cbe2463efb0af71665190290b32485b/App Icon/Icon-Small-40@2x.png -------------------------------------------------------------------------------- /App Icon/Icon-Small-60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Loon0x00/LoonExampleConfig/fd3547f36cbe2463efb0af71665190290b32485b/App Icon/Icon-Small-60.png -------------------------------------------------------------------------------- /App Icon/Icon-Small-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Loon0x00/LoonExampleConfig/fd3547f36cbe2463efb0af71665190290b32485b/App Icon/Icon-Small-60@2x.png -------------------------------------------------------------------------------- /App Icon/Icon-Small-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Loon0x00/LoonExampleConfig/fd3547f36cbe2463efb0af71665190290b32485b/App Icon/Icon-Small-60@3x.png -------------------------------------------------------------------------------- /App Icon/iTunesArtwork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Loon0x00/LoonExampleConfig/fd3547f36cbe2463efb0af71665190290b32485b/App Icon/iTunesArtwork.png -------------------------------------------------------------------------------- /App Icon/iTunesArtwork@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Loon0x00/LoonExampleConfig/fd3547f36cbe2463efb0af71665190290b32485b/App Icon/iTunesArtwork@2x.png -------------------------------------------------------------------------------- /Nodes/ExampleNodes.list: -------------------------------------------------------------------------------- 1 | #Loon自定义节点格式 2 | #关于订阅流量解析:目前会读取response header中的Subscription-Userinfo信息,具体格式如下:Subscription-Userinfo:upload=1111;download=111;total=123456;expire=1614527045 3 | 4 | #ss 5 | # 节点名称 = 协议,服务器地址,端口,加密方式,密码,fast-open=是否开启fast open(需要节点支持),udp=是否在UDP中使用(需要节点支持) 6 | ss1 = Shadowsocks,example.com,443,aes-128-gcm,"password",fast-open=false,udp=true 7 | ss2 = Shadowsocks,example2.com,443,chacha20,"password",fast-open=true,udp=true 8 | 9 | #ss+simple obfs 10 | # 节点名称 = 协议,服务器地址,端口,加密方式,密码,混淆方式=http|tls,obfs-host=混淆host,obfs-uri=混淆路径,fast-open=是否开启fast open(需要节点支持),udp=是否在UDP中使用(需要节点支持) 11 | ssObfs1 = Shadowsocks,example.com,80,aes-128-gcm,"password",obfs-name=http,obfs-host=www.micsoft.com,obfs-uri=/,fast-open=true,udp=true 12 | ssObfs2 = Shadowsocks,example.com,443,aes-128-gcm,"password",obfs-name=tls,obfs-host=www.micsoft.com,obfs-uri=/,fast-open=true,udp=true 13 | 14 | #ssr 15 | # 节点名称 = 协议,服务器地址,端口,加密方式,密码,protocol = 协议,protocol-param = 协议参数,obfs=混淆,obfs-param=混淆参数,fast-open=是否开启fast open(需要节点支持),udp=是否在UDP中使用(需要节点支持) 16 | ssr1 = ShadowsocksR,example.com,443,aes-256-cfb,"password",protocol=origin,obfs=http_simple,obfs-param=download.windows.com,fast-open=false,udp=true 17 | ssr2 = ShadowsocksR,example.com,10076,aes-128-cfb,"password",protocol=auth_chain_a,protocol-param=9555:loon,obfs=http_post,obfs-param=download.windows.com,fast-open=false,udp=true 18 | ssr3 = ShadowsocksR,example.com,10076,chacha20,"password",protocol=auth_aes128_md5,protocol-param=9555:loon,obfs=tls1.2_ticket_auth,obfs-param=download.windows.com,fast-open=false,udp=true 19 | ssr4 = ShadowsocksR,example.com,10076,chacha20-ietf,"password",protocol=auth_aes128_sha1,protocol-param=9555:loon,obfs=plain,fast-open=false,udp=true 20 | 21 | #http 22 | # 节点名称 = 协议,服务器地址,端口,加密方式,密码 23 | http1 = http,example.com,80 24 | http2 = http,example.com,80,username,"password" 25 | 26 | #https 27 | # 节点名称 = 协议,服务器地址,端口,加密方式,密码,skip-cert-verify=是否跳过证书校验(默认否),tls-name=SNI 28 | https1 = https,example.com,443 29 | https2 = https,example.com,443,username,"password" 30 | https3 = https,example.com,443,username,"password",skip-cert-verify=true,tls-name=example.com 31 | 32 | #vmess+tcp 33 | # 节点名称 = 协议,服务器地址,端口,加密方式,UUID,transport(传输方式)=tcp,alterId=alterId(默认0,表示开启aead) 34 | vmess1 = vmess,example.com,10086,aes-128-gcm,"52396e06-041a-4cc2-be5c-8525eb457809",transport=tcp,alterId=0,over-tls=false 35 | 36 | #vmess+tcp+tls 37 | # 节点名称 = 协议,服务器地址,端口,加密方式,UUID,transport(传输方式)=tcp,alterId=alterId(默认0,表示开启aead),over-tls=是否启用TLS,tls-name=SNI,skip-cert-verify=是否跳过证书校验(默认否) 38 | vmess2 = vmess,example.com,10086,aes-128-gcm,"52396e06-041a-4cc2-be5c-8525eb457809",transport=tcp,alterId=0,path=/,host=v3-dy-y.ixigua.com,over-tls=true,tls-name=example.com,skip-cert-verify=true 39 | 40 | #vmess+ws 41 | # 节点名称 = 协议,服务器地址,端口,加密方式,UUID,transport(传输方式)=ws,alterId=alterId(默认0,表示开启aead),path=websocket握手header中的path,host=websocket握手header中的host 42 | vmess3 = vmess,example.com,10086,aes-128-gcm,"52396e06-041a-4cc2-be5c-8525eb457809",transport=ws,alterId=0,path=/,host=v3-dy-y.ixigua.com,over-tls=false 43 | 44 | #vmess+wss 45 | # 节点名称 = 协议,服务器地址,端口,加密方式,UUID,transport(传输方式)=ws,alterId=alterId(默认0,表示开启aead),path=websocket握手header中的path,host=websocket握手header中的host,over-tls=是否启用TLS,tls-name=SNI,skip-cert-verify=是否跳过证书校验(默认否) 46 | vmess4 = vmess,example.com,10086,aes-128-gcm,"52396e06-041a-4cc2-be5c-8525eb457809",transport=ws,alterId=0,path=/,host=v3-dy-y.ixigua.com,over-tls=true,tls-name=example.com,skip-cert-verify=true 47 | 48 | #vmess+http 49 | # 节点名称 = 协议,服务器地址,端口,加密方式,UUID,transport(传输方式)=http,alterId=alterId(默认0,表示开启aead),path=httpheader中的path,host=httpheader的host 50 | vmess5 = vmess,example.com,10086,aes-128-gcm,"52396e06-041a-4cc2-be5c-8525eb457809",transport=http,alterId=0,path=/,host=v3-dy-y.ixigua.com,over-tls=false 51 | 52 | #vmess+http+tls 53 | # 节点名称 = 协议,服务器地址,端口,加密方式,UUID,transport(传输方式)=http,alterId=alterId(默认0,表示开启aead),path=httpheader中的path,host=httpheader的host,over-tls=是否启用TLS,tls-name=SNI,skip-cert-verify=是否跳过证书校验(默认否) 54 | vmess6 = vmess,example.com,10086,aes-128-gcm,"52396e06-041a-4cc2-be5c-8525eb457809",transport=http,alterId=0,path=/,host=v3-dy-y.ixigua.com,over-tls=true,tls-name=example.com,skip-cert-verify=true 55 | 56 | #VLESS+tcp 57 | # 节点名称 = 协议,服务器地址,端口,UUID,transport(传输方式)=tcp 58 | VLESS1 = VLESS,example.com,10086,"52396e06-041a-4cc2-be5c-8525eb457809",transport=tcp,over-tls=false 59 | 60 | #VLESS+tcp+tls 61 | # 节点名称 = 协议,服务器地址,端口,UUID,transport(传输方式)=tcp,over-tls=是否启用TLS,tls-name=SNI,skip-cert-verify=是否跳过证书校验(默认否) 62 | VLESS2 = VLESS,example.com,10086,"52396e06-041a-4cc2-be5c-8525eb457809",transport=tcp,path=/,host=v3-dy-y.ixigua.com,over-tls=true,tls-name=example.com,skip-cert-verify=true 63 | 64 | #VLESS+ws 65 | # 节点名称 = 协议,服务器地址,端口,UUID,transport(传输方式)=ws,path=websocket握手header中的path,host=websocket握手header中的host 66 | VLESS3 = VLESS,example.com,10086,"52396e06-041a-4cc2-be5c-8525eb457809",transport=ws,path=/,host=v3-dy-y.ixigua.com,over-tls=false 67 | 68 | #VLESS+wss 69 | # 节点名称 = 协议,服务器地址,端口,UUID,transport(传输方式)=ws,path=websocket握手header中的path,host=websocket握手header中的host,over-tls=是否启用TLS,tls-name=SNI,skip-cert-verify=是否跳过证书校验(默认否) 70 | VLESS4 = VLESS,example.com,10086,"52396e06-041a-4cc2-be5c-8525eb457809",transport=ws,path=/,host=v3-dy-y.ixigua.com,over-tls=true,tls-name=example.com,skip-cert-verify=true 71 | 72 | #VLESS+http 73 | # 节点名称 = 协议,服务器地址,端口,UUID,transport(传输方式)=http,path=httpheader中的path,host=httpheader的host 74 | VLESS5 = VLESS,example.com,10086,"52396e06-041a-4cc2-be5c-8525eb457809",transport=http,path=/,host=v3-dy-y.ixigua.com,over-tls=false 75 | 76 | #VLESS+http+tls 77 | # 节点名称 = 协议,服务器地址,端口,UUID,transport(传输方式)=http,path=httpheader中的path,host=httpheader的host,over-tls=是否启用TLS,tls-name=SNI,skip-cert-verify=是否跳过证书校验(默认否) 78 | VLESS6 = VLESS,example.com,10086,"52396e06-041a-4cc2-be5c-8525eb457809",transport=http,path=/,host=v3-dy-y.ixigua.com,over-tls=true,tls-name=example.com,skip-cert-verify=true 79 | 80 | #trojan 81 | # 节点名称 = 协议,服务器地址,端口,alpn=tls扩展,skip-cert-verify=是否跳过证书校验(默认否),tls-name=SNI,udp=是否在UDP中使用(需要节点支持) 82 | trojan1 = trojan,example.com,443,"password",alpn=http1.1,skip-cert-verify=false,tls-name=example.com,udp=true 83 | 84 | #trojan+ws 85 | # 节点名称 = 协议,服务器地址,端口,alpn=tls扩展,transport(传输方式)=ws,path=websocket握手header中的path,host=websocket握手header中的host,skip-cert-verify=是否跳过证书校验(默认否),tls-name=SNI,udp=是否在UDP中使用(需要节点支持) 86 | trojan2 = trojan,example.com,443,"password",transport=ws,path=/,host=micsoft.com,alpn=http1.1,skip-cert-verify=true,tls-name=example.com,udp=true 87 | 88 | #trojan+http 89 | # 节点名称 = 协议,服务器地址,端口,alpn=tls扩展,transport(传输方式)=http,path=httpheader中的path,host=httpheader的host,skip-cert-verify=是否跳过证书校验(默认否),tls-name=SNI,udp=是否在UDP中使用(需要节点支持) 90 | trojan2 = trojan,example.com,443,"password",transport=ws,path=/,host=micsoft.com,alpn=http1.1,skip-cert-verify=true,tls-name=example.com,udp=true 91 | 92 | #Wireguard 93 | wireguardNode = wireguard,interface-ip=192.168.2.2,interface-ipV6=2402:4e00:1200:ed00:0:9089:6dac:96b6,private-key="qF22B3ezOhWGJA4SHwQSsgMa9d6mPGHyFdZMaDTae2E=",mtu=1280,dns=192.168.2.1,dnsV6=2402:4e00:1200:ed00:0:9089:6dac:96b6,keeyalive=45,peers=[{public-key="JFuTIJEcFnt8R04UnAE5o2WfIPJUsumSxsD2ayXzoWY=",preshared-key="yVNv5K05AwVnWaR4OB8BlMX3jJlkS74aKlYC3PD95IE=",reserved=[1,2,3],allowed-ips="0.0.0.0/0",endpoint=192.168.3.17:51820}] 94 | 95 | #Hysteria2 96 | # 节点名称 = 协议,服务器地址,端口,密码,skip-cert-verify=是否跳过证书校验(默认否),tls-name=SNI,udp=是否在UDP中使用(需要节点支持),fast-open=是否开启fast open,salamander-password=salamander obfs的密码 97 | hysteria2Node = Hysteria2,example.com,9898,"password",skip-cert-verify=true,tls-name=example.com,udp=true,fast-open=true,salamander-password=password 98 | 99 | 100 | #js custom 101 | # 节点名称 = 协议,服务器地址,端口,script-path=脚本路径(本地脚本直接为文件名,远端脚本为url) 102 | jsHTTP = custom,192.168.1.139,6152,script-path=http.js -------------------------------------------------------------------------------- /Plugin/Plugin_Arg.plugin: -------------------------------------------------------------------------------- 1 | #!name = 带参数的插件Demo 2 | #!desc = 这是一个可设定参数的插件,适用于Loon 3.2.1(build 733 +) 3 | #!author = Loon0x00[https://github.com/Loon0x00/LoonExampleConfig] 4 | #!homePage = https://nsloon.com 5 | #!data = 2024-08-09 6 | #!icon = https://raw.githubusercontent.com/Loon0x00/Loon0x00.github.io/main/static/img/loon.png 7 | #!system = ios,tvos,macos 8 | #!system_version = 300 9 | #!loon_version = 3.2.1(734) 10 | #!tag = 官方,Demo 11 | 12 | [Argument] 13 | appName = input,"Loon",tag=app的名字,desc=填写app的用户名,用于提交app的相关信息 14 | appCategory = select,"Tool","Video&Photo","Game",tag=app的分类 15 | isSupportChinese = switch,true,tag=是否支持中文,desc=选择app是否支持中文 16 | cron = input,"*/5 * * * *",tag=定时任务时间,desc=定时任务的cron表达式 17 | cookieScriptEnable = switch,true,tag=是否启用获取cookie的脚本 18 | 19 | [Script] 20 | http-request ^https://nsloon\.app script-path = https://raw.githubusercontent.com/Loon0x00/LoonExampleConfig/master/Script/plugin_arg.js,argument=[{appName},{appCategory},{isSupportChinese}],enable = {cookieScriptEnable},tag=plugin_arg_demo_request 21 | 22 | cron {cron} script-path=https://raw.githubusercontent.com/Loon0x00/LoonExampleConfig/master/Script/cron.js,tag = cronExample,argument=[{appName}],enable=true 23 | 24 | [MITM] 25 | hostname = nsloon.app -------------------------------------------------------------------------------- /Plugin/Plugin_Example.plugin: -------------------------------------------------------------------------------- 1 | #!name= Loon example plugin1 2 | #!desc= Netflix评分 3 | #!author= Loon0x00 4 | #!homepage= https://github.com/Loon0x00 5 | #!date = 2023-08-14 16:47:00 6 | #!icon= https://raw.githubusercontent.com/Koolson/Qure/master/IconSet/Color/Netflix.png 7 | 8 | [Url Rewrite] 9 | ^https?://(www.)?g.cn https://www.google.com 302 10 | ^https?://(www.)?google.cn https://www.google.com 302 11 | ^https?://union.click.jd.com/jda? http://union.click.jd.com/jda?adblock= header 12 | 13 | [Script] 14 | http-request ^https?://ios\.prod\.ftl\.netflix\.com/iosui/user/.+path=%5B%22videos%22%2C%\d+%22%2C%22summary%22%5D script-path=https://raw.githubusercontent.com/yichahucha/surge/master/nf_rating.js 15 | http-response ^https?://ios\.prod\.ftl\.netflix\.com/iosui/user/.+path=%5B%22videos%22%2C%\d+%22%2C%22summary%22%5D requires-body=1,script-path=https://raw.githubusercontent.com/yichahucha/surge/master/nf_rating.js 16 | 17 | [MITM] 18 | hostname = ios.prod.ftl.netflix.com -------------------------------------------------------------------------------- /Plugin/Plugin_Example2.plugin: -------------------------------------------------------------------------------- 1 | #!name= Loon example plugin2 2 | #!desc= Rule:策略可设置为DIRECT,REJECT,PROXY,其中PROXY为用户在app中手动映射的策略,rule后不跟随策略默认使用PROXY 3 | #!author = Loon0x00 4 | #!homepage = https://github.com/Loon0x00 5 | 6 | [Rule] 7 | USER-AGENT,Argo* 8 | DOMAIN-SUFFIX,fast.com 9 | DOMAIN-SUFFIX,netflix.com 10 | DOMAIN-SUFFIX,netflix.net 11 | DOMAIN-SUFFIX,nflxext.com 12 | DOMAIN-SUFFIX,nflximg.com 13 | DOMAIN-SUFFIX,nflximg.net 14 | DOMAIN-SUFFIX,nflxso.net 15 | DOMAIN-SUFFIX,nflxvideo.net 16 | DOMAIN-SUFFIX,netflixdnstest0.com 17 | DOMAIN-SUFFIX,netflixdnstest1.com 18 | DOMAIN-SUFFIX,netflixdnstest2.com 19 | DOMAIN-SUFFIX,netflixdnstest3.com 20 | DOMAIN-SUFFIX,netflixdnstest4.com 21 | DOMAIN-SUFFIX,netflixdnstest5.com 22 | DOMAIN-SUFFIX,netflixdnstest6.com 23 | DOMAIN-SUFFIX,netflixdnstest7.com 24 | DOMAIN-SUFFIX,netflixdnstest8.com 25 | DOMAIN-SUFFIX,netflixdnstest9.com 26 | IP-CIDR,23.246.0.0/18,PROXY 27 | IP-CIDR,37.77.184.0/21,PROXY 28 | IP-CIDR,45.57.0.0/17,PROXY 29 | IP-CIDR,64.120.128.0/17,PROXY 30 | IP-CIDR,66.197.128.0/17,PROXY 31 | IP-CIDR,108.175.32.0/20,PROXY 32 | IP-CIDR,192.173.64.0/18,PROXY 33 | IP-CIDR,198.38.96.0/19,PROXY 34 | IP-CIDR,198.45.48.0/20,PROXY 35 | 36 | [Url Rewrite] 37 | ^https?://(www.)?g.cn https://www.google.com 302 38 | ^https?://(www.)?google.cn https://www.google.com 302 39 | 40 | [Script] 41 | http-request ^https?://ios\.prod\.ftl\.netflix\.com/iosui/user/.+path=%5B%22videos%22%2C%\d+%22%2C%22summary%22%5D script-path=https://raw.githubusercontent.com/yichahucha/surge/master/nf_rating.js 42 | http-response ^https?://ios\.prod\.ftl\.netflix\.com/iosui/user/.+path=%5B%22videos%22%2C%\d+%22%2C%22summary%22%5D requires-body=1,script-path=https://raw.githubusercontent.com/yichahucha/surge/master/nf_rating.js 43 | 44 | [MITM] 45 | hostname = ios.prod.ftl.netflix.com -------------------------------------------------------------------------------- /Plugin/Plugin_Example3.plugin: -------------------------------------------------------------------------------- 1 | #!name = plugin example3 2 | [Script] 3 | generic script-path=https://raw.githubusercontent.com/Loon0x00/LoonExampleConfig/master/Script/generic_example.js,tag=GeoLocation,timeout=10,img-url=location.fill.viewfinder.system -------------------------------------------------------------------------------- /Plugin/Plugin_Example4.plugin: -------------------------------------------------------------------------------- 1 | #!name= Loon example plugin4 2 | #!desc= 这是一个带有配置项的插件,input代表输入,select代表选择(select的第一项为名称,后面为可选值),用户所填或者选择的值都可以在脚本中用$persistentStore.read进行读取,如$persistentStore.read(appName) 3 | #!author = Loon0x00 4 | #!input = appName 5 | #!input = author 6 | #!select = appType,tool,social,health,sport 7 | #!select = price,0.99,1.99,4.99 8 | 9 | [Script] 10 | cron "0/24 * * * *" script-path=https://raw.githubusercontent.com/Loon0x00/LoonExampleConfig/master/Script/plugin_example.js,tag = pluginExample, enable=true -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Loon Config Example 2 | 3 | - [配置文件样例](https://github.com/Loon0x00/LoonExampleConfig/blob/master/example.conf) 4 | 5 | - [节点格式](https://github.com/Loon0x00/LoonExampleConfig/blob/master/Nodes/ExampleNodes.list) 6 | 7 | - [规则格式](https://github.com/Loon0x00/LoonExampleConfig/blob/master/Rule/ExampleRule.list) 8 | 9 | - [复写格式](https://github.com/Loon0x00/LoonExampleConfig/blob/master/Rewrite/AutoRewrite_Example.list) 10 | 11 | - [脚本格式](https://github.com/Loon0x00/LoonExampleConfig/blob/master/Script/script_README.md) 12 | 13 | - [脚本API](https://github.com/Loon0x00/LoonExampleConfig/blob/master/Script/script_API.md) 14 | 15 | - [订阅脚本格式](https://github.com/Loon0x00/LoonExampleConfig/blob/master/RemoteScript/RemoteScript_Example.plist) 16 | 17 | - [插件格式](https://github.com/Loon0x00/LoonExampleConfig/blob/master/Plugin/Plugin_Example.plugin) -------------------------------------------------------------------------------- /RemoteScript/RemoteScript_Example.plist: -------------------------------------------------------------------------------- 1 | #remote scripts 2 | hostname = api.weibo.cn, mapi.weibo.com, *.uve.weibo.com,ios.prod.ftl.netflix.com,api.m.jd.com 3 | 4 | http-response ^https?://m?api\.weibo\.c(n|om)/2/(statuses/(unread|extend|positives/get|(friends|video)(/|_)timeline)|stories/(video_stream|home_list)|(groups|fangle)/timeline|profile/statuses|comments/build_comments|photo/recommend_list|service/picfeed|searchall|cardlist|page|\!/photos/pic_recommend_status) requires-body=1,script-path=https://raw.githubusercontent.com/yichahucha/surge/master/wb_ad.js 5 | http-response ^https?://(sdk|wb)app\.uve\.weibo\.com(/interface/sdk/sdkad.php|/wbapplua/wbpullad.lua) requires-body=1,script-path=https://raw.githubusercontent.com/yichahucha/surge/master/wb_launch.js 6 | 7 | http-request ^https?://ios\.prod\.ftl\.netflix\.com/iosui/user/.+path=%5B%22videos%22%2C%\d+%22%2C%22summary%22%5D script-path=https://raw.githubusercontent.com/yichahucha/surge/master/nf_rating.js 8 | http-response ^https?://ios\.prod\.ftl\.netflix\.com/iosui/user/.+path=%5B%22videos%22%2C%\d+%22%2C%22summary%22%5D requires-body=1,script-path=https://raw.githubusercontent.com/yichahucha/surge/master/nf_rating.js 9 | 10 | http-response ^https?://api\.m\.jd\.com/client\.action\?functionId=(wareBusiness|serverConfig) requires-body=1,script-path=https://raw.githubusercontent.com/yichahucha/surge/master/jd_price.js 11 | 12 | cron "0 9,18 * * 1-5" script-path=https://raw.githubusercontent.com/yichahucha/surge/master/check_in.js -------------------------------------------------------------------------------- /Rewrite/AutoRewrite_Example.list: -------------------------------------------------------------------------------- 1 | 2 | (.*video_id=\w{32})(.*watermark=)(.*) 302 $1 3 | (?<=(carrier|sys)_region=)CN 307 JP 4 | (?<=version_code=)\d{1,}.\d{1}\.\d{1} 307 8.0.0 5 | 6 | ^http://www\.google\.cn header http://www.google.com 7 | ^http://example.com 302 ^https://example.com 8 | ^http://example.com 307 ^https://example.com 9 | ^http://example.com reject 10 | ^http://example.com reject-200 11 | ^http://example.com reject-img 12 | ^http://example.com reject-dict 13 | ^http://example.com reject-array 14 | 15 | ^http://example.com header-add Connection keep-alive 16 | ^http://example.com header-del Cookie 17 | ^http://example.com header-replace User-Agent Unknown -------------------------------------------------------------------------------- /Rule/ExampleRule.list: -------------------------------------------------------------------------------- 1 | DOMAIN-SUFFIX,apple.cn 2 | DOMAIN-SUFFIX,apple.com 3 | DOMAIN-SUFFIX,apple.news 4 | DOMAIN-SUFFIX,icloud.com 5 | DOMAIN-SUFFIX,icloud-content.com 6 | DOMAIN-SUFFIX,itunes.com 7 | DOMAIN-SUFFIX,me.com 8 | DOMAIN-SUFFIX,mzstatic.com 9 | 10 | USER-AGENT,hide* 11 | USER-AGENT,MicroMessenger* 12 | USER-AGENT,PayPal* 13 | USER-AGENT,TeamViewer* 14 | USER-AGENT,TIM* 15 | USER-AGENT,ting_en 16 | USER-AGENT,WebTorrent* 17 | USER-AGENT,WeChat* 18 | 19 | DOMAIN-KEYWORD,bbcfmt 20 | DOMAIN-KEYWORD,co.uk 21 | DOMAIN-KEYWORD,uk-live 22 | 23 | DOMAIN-SUFFIX,t.me 24 | DOMAIN-SUFFIX,tdesktop.com 25 | DOMAIN-SUFFIX,telegra.ph 26 | DOMAIN-SUFFIX,telegram.me 27 | DOMAIN-SUFFIX,telegram.org 28 | IP-CIDR,91.108.4.0/22,no-resolve 29 | IP-CIDR,91.108.56.0/22,no-resolve 30 | IP-CIDR,91.108.56.0/23,no-resolve 31 | IP-CIDR,109.239.140.0/24,no-resolve 32 | IP-CIDR,149.154.160.0/22,no-resolve 33 | IP-CIDR,149.154.164.0/22,no-resolve 34 | IP-CIDR,149.154.168.0/22,no-resolve 35 | IP-CIDR,149.154.172.0/22,no-resolve 36 | IP-CIDR6,2001:67c:4e8::/48,no-resolve 37 | IP-CIDR6,2001:b28:f23d::/48,no-resolve 38 | IP-CIDR6,2001:b28:f23f::/48,no-resolve 39 | 40 | IP-ASN,44907,no-resolve // Telegram Messenger Inc 41 | IP-ASN,62041,no-resolve // Telegram Messenger Inc 42 | IP-ASN,62014,no-resolve // Telegram Messenger Inc 43 | IP-ASN,59930,no-resolve // Telegram Messenger Inc 44 | IP-ASN,211157,no-resolve // Telegram Messenger Inc -------------------------------------------------------------------------------- /Rule/ExampleRule2.list: -------------------------------------------------------------------------------- 1 | DOMAIN-SUFFIX, broadcasthe.net 2 | DOMAIN-SUFFIX, chdbits.co 3 | DOMAIN-SUFFIX, classix-unlimited.co.uk 4 | DOMAIN-SUFFIX, comicat.org 5 | DOMAIN-SUFFIX, empornium.me 6 | DOMAIN-SUFFIX, gazellegames.net 7 | DOMAIN-SUFFIX, hdbits.org 8 | DOMAIN-SUFFIX, hdchina.org 9 | DOMAIN-SUFFIX, hddolby.com 10 | DOMAIN-SUFFIX, hdhome.org 11 | DOMAIN-SUFFIX, hdsky-me 12 | DOMAIN-SUFFIX, icetorrent.org 13 | DOMAIN-SUFFIX, jpopsuki. eu 14 | DOMAIN-SUFFIX, keepfrds.com 15 | DOMAIN-SUFFIX, madsrevolution.net 16 | DOMAIN-SUFFIX, morethan. tv 17 | DOMAIN-SUFFIX, m-team. cc 18 | DOMAIN-SUFFIX, myanonamouse.net 19 | DOMAIN-SUFFIX, nanyangpt.com 20 | DOMAIN-SUFFIX, ncore.cc 21 | DOMAIN-SUFFIX, open. cd 22 | DOMAIN-SUFFIX, ourbits. club 23 | DOMAIN-SUFFIX, passthepopcorn.me 24 | DOMAIN-SUFFIX, privatehd. to 25 | DOMAIN-SUFFIX, pterclub.com 26 | DOMAIN-SUFFIX, redacted. ch 27 | DOMAIN-SUFFIX, springsunday.net 28 | DOMAIN-SUFFIX, tjupt.org 29 | 30 | GEOIP, CN -------------------------------------------------------------------------------- /Script/cron.js: -------------------------------------------------------------------------------- 1 | /* 2 | cron 语法 3 | * * * * * : 分 时 日 月 周 4 | * * * * * * :秒 分 时 日 月 周"; 5 | 6 | 脚本配置 7 | [script] 8 | cron "0 8 * * *" script-path=https://raw.githubusercontent.com/Loon0x00/LoonExampleConfig/master/Script/cron.js,tag = cronExample,enable=true 9 | */ 10 | 11 | 12 | console.log('Start cron JS Demo'); 13 | 14 | let appName = $argument.appName; //这个参数是从插件配置中获取到的,见插件:https://raw.githubusercontent.com/Loon0x00/LoonExampleConfig/master/Plugin/Plugin_Arg.plugin 15 | console.log(appName); 16 | 17 | $notification.post("Cron测试脚本","这是一个测试cron的脚本","仅供测试使用,不要安装"); 18 | $done(); -------------------------------------------------------------------------------- /Script/generic_example.js: -------------------------------------------------------------------------------- 1 | /** 2 | * generic script example 3 | * Reference: https://raw.githubusercontent.com/KOP-XIAO/QuantumultX/master/Scripts/geo_location.js 4 | * 5 | * [script] 6 | * generic script-path=https://raw.githubusercontent.com/Loon0x00/LoonExampleConfig/master/Script/generic_example.js,tag=GeoLocation,timeout=10,img-url=location.fill.viewfinder.system 7 | */ 8 | 9 | // $environment.params with input params 10 | console.log($environment.params); 11 | var url = "https://api.ip.sb/geoip"; 12 | 13 | /** 14 | * build 411 版本后 添加$environment.params.nodeInfo对象,表示简单的节点信息 15 | * 注意:由于安全限制,nodeInfo对象中仅有一下信息 16 | { 17 | address = "example.com"; 18 | name = "节点名称"; 19 | port = 12443; 20 | tls = 1; 21 | type = Vmess; 22 | } 23 | */ 24 | var inputParams = $environment.params; 25 | var nodeName = inputParams.node; 26 | 27 | /** 28 | * node: Specify network activity on this node 29 | */ 30 | var requestParams = { 31 | "url":url, 32 | "node":nodeName 33 | } 34 | 35 | var message = "" 36 | const paras = ["ip","isp","country_code","city"]; 37 | const paran = ["IP","ISP","地区","城市"]; 38 | 39 | $httpClient.get(requestParams, (error, response, data) => { 40 | if (error) { 41 | message = "🛑 查询超时" 42 | message = `
` + message + `
` 43 | $done({"title": "🔎 IP.SB 查询结果", "htmlMessage": message}); 44 | } else { 45 | console.log(data); 46 | message = data ? json2info(data, paras) : ""; 47 | $done({"title": " 🔎 IP.SB 查询结果", "htmlMessage": message}); 48 | } 49 | }) 50 | 51 | function json2info(cnt, paras) { 52 | var res = "------------------------------"; 53 | cnt = JSON.parse(cnt); 54 | console.log(cnt); 55 | for (i = 0;i < paras.length; i ++) { 56 | cnt[paras[i]] = paras[i] == "country_code" ? cnt[paras[i]] + " ⟦" + flags.get(cnt[paras[i]].toUpperCase()) + "⟧" : cnt[paras[i]]; 57 | res = cnt[paras[i]] ? res + "" + "" + paran[i] + " : " + ""+ "" + cnt[paras[i]] + "" : res; 58 | } 59 | res = res + "------------------------------" + "" + "" + "节点 ➟ " + $environment.params.node + ""; 60 | res = `` + res + `
`; 61 | return res; 62 | } 63 | 64 | var flags = new Map([[ "AC" , "🇦🇨" ] ,["AE","🇦🇪"], [ "AF" , "🇦🇫" ] , [ "AI" , "🇦🇮" ] , [ "AL" , "🇦🇱" ] , [ "AM" , "🇦🇲" ] , [ "AQ" , "🇦🇶" ] , [ "AR" , "🇦🇷" ] , [ "AS" , "🇦🇸" ] , [ "AT" , "🇦🇹" ] , [ "AU" , "🇦🇺" ] , [ "AW" , "🇦🇼" ] , [ "AX" , "🇦🇽" ] , [ "AZ" , "🇦🇿" ] , ["BA", "🇧🇦"], [ "BB" , "🇧🇧" ] , [ "BD" , "🇧🇩" ] , [ "BE" , "🇧🇪" ] , [ "BF" , "🇧🇫" ] , [ "BG" , "🇧🇬" ] , [ "BH" , "🇧🇭" ] , [ "BI" , "🇧🇮" ] , [ "BJ" , "🇧🇯" ] , [ "BM" , "🇧🇲" ] , [ "BN" , "🇧🇳" ] , [ "BO" , "🇧🇴" ] , [ "BR" , "🇧🇷" ] , [ "BS" , "🇧🇸" ] , [ "BT" , "🇧🇹" ] , [ "BV" , "🇧🇻" ] , [ "BW" , "🇧🇼" ] , [ "BY" , "🇧🇾" ] , [ "BZ" , "🇧🇿" ] , [ "CA" , "🇨🇦" ] , [ "CF" , "🇨🇫" ] , [ "CH" , "🇨🇭" ] , [ "CK" , "🇨🇰" ] , [ "CL" , "🇨🇱" ] , [ "CM" , "🇨🇲" ] , [ "CN" , "🇨🇳" ] , [ "CO" , "🇨🇴" ] , [ "CP" , "🇨🇵" ] , [ "CR" , "🇨🇷" ] , [ "CU" , "🇨🇺" ] , [ "CV" , "🇨🇻" ] , [ "CW" , "🇨🇼" ] , [ "CX" , "🇨🇽" ] , [ "CY" , "🇨🇾" ] , [ "CZ" , "🇨🇿" ] , [ "DE" , "🇩🇪" ] , [ "DG" , "🇩🇬" ] , [ "DJ" , "🇩🇯" ] , [ "DK" , "🇩🇰" ] , [ "DM" , "🇩🇲" ] , [ "DO" , "🇩🇴" ] , [ "DZ" , "🇩🇿" ] , [ "EA" , "🇪🇦" ] , [ "EC" , "🇪🇨" ] , [ "EE" , "🇪🇪" ] , [ "EG" , "🇪🇬" ] , [ "EH" , "🇪🇭" ] , [ "ER" , "🇪🇷" ] , [ "ES" , "🇪🇸" ] , [ "ET" , "🇪🇹" ] , [ "EU" , "🇪🇺" ] , [ "FI" , "🇫🇮" ] , [ "FJ" , "🇫🇯" ] , [ "FK" , "🇫🇰" ] , [ "FM" , "🇫🇲" ] , [ "FO" , "🇫🇴" ] , [ "FR" , "🇫🇷" ] , [ "GA" , "🇬🇦" ] , [ "GB" , "🇬🇧" ] , [ "HK" , "🇭🇰" ] ,["HU","🇭🇺"], [ "ID" , "🇮🇩" ] , [ "IE" , "🇮🇪" ] , [ "IL" , "🇮🇱" ] , [ "IM" , "🇮🇲" ] , [ "IN" , "🇮🇳" ] , [ "IS" , "🇮🇸" ] , [ "IT" , "🇮🇹" ] , [ "JP" , "🇯🇵" ] , [ "KR" , "🇰🇷" ] , [ "LU" , "🇱🇺" ] , [ "MO" , "🇲🇴" ] , [ "MX" , "🇲🇽" ] , [ "MY" , "🇲🇾" ] , [ "NL" , "🇳🇱" ] , [ "PH" , "🇵🇭" ] , [ "RO" , "🇷🇴" ] , [ "RS" , "🇷🇸" ] , [ "RU" , "🇷🇺" ] , [ "RW" , "🇷🇼" ] , [ "SA" , "🇸🇦" ] , [ "SB" , "🇸🇧" ] , [ "SC" , "🇸🇨" ] , [ "SD" , "🇸🇩" ] , [ "SE" , "🇸🇪" ] , [ "SG" , "🇸🇬" ] , [ "TH" , "🇹🇭" ] , [ "TN" , "🇹🇳" ] , [ "TO" , "🇹🇴" ] , [ "TR" , "🇹🇷" ] , [ "TV" , "🇹🇻" ] , [ "TW" , "🇨🇳" ] , [ "UK" , "🇬🇧" ] , [ "UM" , "🇺🇲" ] , [ "US" , "🇺🇸" ] , [ "UY" , "🇺🇾" ] , [ "UZ" , "🇺🇿" ] , [ "VA" , "🇻🇦" ] , [ "VE" , "🇻🇪" ] , [ "VG" , "🇻🇬" ] , [ "VI" , "🇻🇮" ] , [ "VN" , "🇻🇳" ] , [ "ZA" , "🇿🇦"]]) -------------------------------------------------------------------------------- /Script/http.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 本脚本实现HTTP代理协议,可用于Loon的自定义协议(custom类型) 3 | * 使用方式: 4 | * [Proxy] 5 | * customHttp = custom, remoteAddress, port, script-path=https://raw.githubusercontent.com/Loon0x00/LoonExampleConfig/master/Script/http.js 6 | * 7 | * 脚本: 8 | * 全局参数 $session 表示当前的一个tcp会话,一个session对象样例 9 | * $session = { 10 | "uuid":"xxxx",//会话id 11 | "type":0, 12 | "conHost":"google.com", 13 | "conPort":443, 14 | "proxy":{ 15 | "name":"customHttp", 16 | "host":"192.168.1.139", 17 | "port":"7222", 18 | "userName":"username", 19 | "password":"password", 20 | "encryption":"aes-128", 21 | "allowInsecure":false, 22 | "ceritificateHost":"", 23 | "isTLS":false 24 | } 25 | } 26 | * 实现5个session的生命周期方法 27 | * function tunnelDidConnected(); //会话tcp连接成功回调 28 | * function tunnelTLSFinished(); //会话进行tls握手成功 29 | * function tunnelDidRead(data); //从代理服务器读取到数据回调 30 | * function tunnelDidWrite(); //数据发送到代理服务器成功 31 | * function tunnelDidClose(); //会话已关闭 32 | * 33 | * $tunnel对象,主要用来操作session的一些方法 34 | * $tunnel.write($session, data); //想代理服务器发送数据,data可以为ArrayBuffer也可以为string 35 | * $tunnel.read($session); //从代理服务器读取数据 36 | * $tunnel.readTo($session, trialData); //从代理服务器读取数据,一直读到数据末尾是trialData为止 37 | * $tunnel.established($session); //会话握手成功,开始进行数据转发,一般在协议握手成功后调用 38 | * 39 | */ 40 | 41 | let HTTP_STATUS_INVALID = -1 42 | let HTTP_STATUS_CONNECTED = 0 43 | let HTTP_STATUS_WAITRESPONSE = 1 44 | let HTTP_STATUS_FORWARDING = 2 45 | var httpStatus = HTTP_STATUS_INVALID 46 | 47 | function tunnelDidConnected() { 48 | console.log($session) 49 | if ($session.proxy.isTLS) { 50 | //https 51 | } else { 52 | //http 53 | _writeHttpHeader() 54 | httpStatus = HTTP_STATUS_CONNECTED 55 | } 56 | return true 57 | } 58 | 59 | function tunnelTLSFinished() { 60 | _writeHttpHeader() 61 | httpStatus = HTTP_STATUS_CONNECTED 62 | return true 63 | } 64 | 65 | function tunnelDidRead(data) { 66 | if (httpStatus == HTTP_STATUS_WAITRESPONSE) { 67 | //check http response code == 200 68 | //Assume success here 69 | console.log("http handshake success") 70 | httpStatus = HTTP_STATUS_FORWARDING 71 | $tunnel.established($session)//可以进行数据转发 72 | return null//不将读取到的数据转发到客户端 73 | } else if (httpStatus == HTTP_STATUS_FORWARDING) { 74 | return data 75 | } 76 | } 77 | 78 | function tunnelDidWrite() { 79 | if (httpStatus == HTTP_STATUS_CONNECTED) { 80 | console.log("write http head success") 81 | httpStatus = HTTP_STATUS_WAITRESPONSE 82 | $tunnel.readTo($session, "\x0D\x0A\x0D\x0A")//读取远端数据直到出现\r\n\r\n 83 | return false //中断wirte callback 84 | } 85 | return true 86 | } 87 | 88 | function tunnelDidClose() { 89 | return true 90 | } 91 | 92 | //Tools 93 | function _writeHttpHeader() { 94 | let conHost = $session.conHost 95 | let conPort = $session.conPort 96 | 97 | var header = `CONNECT ${conHost}:${conPort} HTTP/1.1\r\nHost:${conHost}\r\nConnection: keep-alive\r\nUser-Agent:Loon2.1.18\r\nProxy-Connection: keep-alive\r\n\r\n` 98 | $tunnel.write($session, header) 99 | } 100 | -------------------------------------------------------------------------------- /Script/netChanged.js: -------------------------------------------------------------------------------- 1 | /* 2 | network-changed script-path=https://raw.githubusercontent.com/Loon0x00/LoonExampleConfig/master/Script/netChanged.js 3 | */ 4 | 5 | //获取Loon的相关配置,返回为json格式 6 | var confStr = $config.getConfig() 7 | console.log(confStr) 8 | 9 | var conf = JSON.parse(confStr) 10 | if (conf.ssid == "your ssid name") { 11 | /* 12 | 设置全局运行模式 13 | 0:Global Direct 14 | 1:By Rule 15 | 2:Global Proxy 16 | */ 17 | $config.setRunningModel(0) 18 | //设置select策略组所对应的策略,子策略不存在时将保持原先的策略不变 19 | $config.setSelectPolicy("⛔ 广告拦截","DIRECT") 20 | $notification.post("Network changed","Change Running Model to Global Direct","⛔ 广告拦截 to DIRECT") 21 | } else { 22 | $config.setRunningModel(1) 23 | $config.setSelectPolicy("⛔ 广告拦截","REJECT") 24 | $notification.post("Network changed","Change Running Model to Filter by rule","⛔ 广告拦截 to REJECT") 25 | } 26 | 27 | //一次性同时设置多个策略组的策略 28 | $config.setSelectPolicy(["国外网站","广告拦截","谷歌服务"],["HK Node 1","REJECT","节点选择"]) 29 | 30 | //获取相关策略的子策略,json格式 31 | var subPolicys = $config.getSubPolicys("节点选项") 32 | console.log(subPolicys); -------------------------------------------------------------------------------- /Script/plugin_arg.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 这是一个读取插件中用户配置参数的脚本,通过 $argument.xxx 获取配置的相关参数 3 | */ 4 | 5 | console.log($argument); 6 | 7 | let appName = $argument.appName; 8 | let category = $argument.appCategory; 9 | let isC = $argument.isSupportChinese; 10 | 11 | console.log("appName:" + appName); 12 | console.log("category:" + category); 13 | console.log("isSupportChinese:" + isC); 14 | 15 | $done({}); -------------------------------------------------------------------------------- /Script/plugin_example.js: -------------------------------------------------------------------------------- 1 | let appName = $persistentStore.read("appName") 2 | let author = $persistentStore.read("author") 3 | let appType = $persistentStore.read("appType") 4 | let price = $persistentStore.read("price") 5 | console.log(appName + " " + author + " " + appType + " " + price) 6 | $done() -------------------------------------------------------------------------------- /Script/resourceParserExample.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 资源类型 3 | * 0:config 4 | * 1:nodes 5 | * 2:rules 6 | * 3:rewrites 7 | * 4:scripts 8 | * 5:plugin 9 | */ 10 | let resourceType = $resourceType; 11 | //资源内容 12 | let resource = $resource; 13 | //资源url 14 | let url = $resourceUrl; 15 | 16 | console.log(resourceType); 17 | console.log(url); 18 | 19 | if (resourceType == 0) { 20 | //$done(解析后的资源字符串) 21 | $done("# generate by ResourceParserExample.js\n" + resource); 22 | } -------------------------------------------------------------------------------- /Script/script_API.md: -------------------------------------------------------------------------------- 1 | # Loon Script API 2 | 3 | ## 工具 4 | - **console.log(msg))** 5 | 6 | 打印日志,参数msg:String 7 | 8 | - **setInterval(function, milliseconds)** 9 | - **setTimeout(function, milliseconds)** 10 | 11 | 延迟执行,两个方法是的使用方式和参数和浏览器中一致 12 | 13 | 14 | ## 基本信息 15 | - **$loon** 16 | 17 | `$loon`: device Name, system version, app version, build version 18 | 19 | - **$script** 20 | 21 | `$script.name`: 被执行的脚本名称 22 | 23 | `$script.startTime`: 执行脚本的时间 24 | 25 | - **$config** 26 | 27 | `$config.getConfig()`: 获取当前配置信息,返回json字符串 28 | ``` 29 | { 30 | "running_model": 1,//运行模式,0:全局直连 1:分流模式 2:全局代理 31 | "all_buildin_nodes": [ 32 | "DIRECT", 33 | "REJECT" 34 | ], 35 | "global_proxy": "节点选择", 36 | "all_policy_groups": [ 37 | "宝贝支付", 38 | "奈飞影视", 39 | "运营劫持", 40 | "负载均衡", 41 | "全球直连", 42 | "国内媒体", 43 | "HK", 44 | "广告拦截", 45 | "漏网之鱼", 46 | "WiFi", 47 | "节点选择", 48 | "JP", 49 | "苹果服务", 50 | "测速", 51 | "健康模式", 52 | "BliBliArea", 53 | "TW", 54 | "谷歌服务", 55 | "油管视频", 56 | "国外网站", 57 | "网易解锁" 58 | ], 59 | "ssid": "loon-wifi-5g", 60 | "final": "节点选择", 61 | "policy_select": { 62 | "苹果服务": "全球直连", 63 | "广告拦截": "REJECT", 64 | "BliBliArea": "HK", 65 | "油管视频": "节点选择", 66 | "宝贝支付": "🇺🇲 v1|美国|A|6台负载", 67 | "奈飞影视": "DIRECT", 68 | "测速": "DIRECT", 69 | "谷歌服务": "健康模式", 70 | "国内媒体": "全球直连", 71 | "运营劫持": "REJECT", 72 | "节点选择": "JP", 73 | "漏网之鱼": "节点选择", 74 | "JP": "🇯🇵 v1|日本|A|7台负载", 75 | "网易解锁": "DIRECT", 76 | "全球直连": "DIRECT", 77 | "TW": "🇭🇰 v1|香港|D|7台负载|原生", 78 | "国外网站": "节点选择" 79 | } 80 | } 81 | ``` 82 | `$config.getConfig(policyName,selectName)`: 设置policyName策略组所选策略为selectName,参数都为String,失败返回false,成功返回true 83 | 84 | `$config.getSubPolicies(policyName, function(subPolicies){})`:获取policyName策略组的所有子策略,获取成功后回调,subPolicies为字符串子数组 85 | 86 | `$config.getSelectedPolicy(policyName)`: 返回policyName策略组所选的子策略组名称 87 | 88 | `$config.setRunningModel(model)`: 设置Loon当前运行模式,model类型为int,0:全局直连 1:分流模式 2:全局代理 89 | 90 | ## 本地存储 91 | - **$persistentStore** 92 | 93 | `$persistentStore.read(value,[key])`: 将value以key为键存储在本地,value和key类型都为字符串,key不传时为当前脚本名字的hash值,存储成功后返回true,失败返回false 94 | 95 | `$persistentStore.read([key])`: 读取保存在本地中key映射的值,key不传时为当前脚本名字的hash值,返回相应的value,key和value都为字符串 96 | 97 | `$persistentStore.remove()`: 清除所有使用脚本API保存在本地的数据 98 | 99 | - **$notification** 100 | 101 | `$notification.post(title,subtitle,content,[attach])`: 发起一个ios的本地通知,前三个参数分别为标题、副标题、通知内容,都为String类型,attach为可选内容,最为通知的附件,如通知带的一个图片\视频url或者点击通知时的触发的openurl 102 | ``` 103 | //当attach为一个字符串时,表示点击通知的跳转链接 104 | $notification.post("title","subtitle","content","loon://switch") 105 | 106 | //如果既要支持附件和点击跳转,传入js对象 107 | var attach = { 108 | "openUrl":"loon://switch", 109 | "mediaUrl":"https://example.com/img" 110 | } 111 | $notification.post("title","subtitle","content",attach) 112 | ``` 113 | 114 | ## 网络请求 115 | 116 | - **$httpClient** 117 | 118 | `$httpClient.get(params, function(errormsg,response,data){})`: 发起一个http get请求,params是请求参数,callback是请求结束的回调 119 | 120 | ``` 121 | //params为请求参数:如下 122 | { 123 | url:"https://example.com/", 124 | timeout: 2000, //请求超时,单位ms 125 | headers:{ 126 | Content-Type:"application/json" 127 | }, 128 | body:"{}",//仅仅在post请求中有效 129 | node:"HK - v1.0",//指定该请求使用哪一个节点或者策略组 130 | } 131 | 132 | //回调参数 133 | errormsg: 失败原因,String类型,请求成功为null 134 | response: js对象 135 | { 136 | status:200, 137 | headers:{ 138 | content-length:200 139 | } 140 | } 141 | data: String类型,响应body 142 | 143 | ``` 144 | 145 | `$httpClient.post(params, function(errormsg,response,data){})`: 发起post请求,参数、callback参数同get 146 | 147 | `$httpClient.head(params, function(errormsg,response,data){})`: 发起head请求,参数、callback参数同get 148 | 149 | `$httpClient.delete(params, function(errormsg,response,data){})`: 发起delete请求,参数、callback参数同get 150 | 151 | `$httpClient.put(params, function(errormsg,response,data){})`: 发起put请求,参数、callback参数同get 152 | 153 | `$httpClient.options(params, function(errormsg,response,data){})`: 发起options请求,参数、callback参数同get 154 | 155 | `$httpClient.patch(params, function(errormsg,response,data){})`: 发起patch请求,参数、callback参数同get 156 | 157 | ## 其他 158 | 159 | - **$done()** 160 | 161 | 在一般的脚本中,调用$done()表示结束脚本的执行,loon内部会进行脚本资源的释放,所以为了loon的js资源请在脚本结束时调用$done()释放资源;在http-request、http-response类型的脚本中,$done()的调用请参考相关脚本类型的说明:[Loon脚本类型](https://github.com/Loon0x00/LoonExampleConfig/blob/master/Script/script_README.md) 162 | 163 | - **$envirnoment** 164 | 165 | 仅用于generic类型的脚本中,当generic类型的脚本运用于某个节点时,`$envirnoment`对象有如下几个属性 166 | 167 | `$environment.params.node`: 表示节点名称(build 410版本后推荐用nodeInfo) 168 | 169 | `$environment.params.nodeInfo`: 节点简洁信息(为了安全起见,不会返回所有节点信息) -------------------------------------------------------------------------------- /Script/script_README.md: -------------------------------------------------------------------------------- 1 | # Loon脚本类型 2 | Loon支持的脚本类型: 3 | 4 | ## http-request 5 | ### 语法 6 | ``` 7 | http-request ^https?:\/\/(www.)?(example)\.com script-path=localscript.js,tag = requestScript,enable=true,requires-body = true 8 | ``` 9 | 此类型脚本会在一个http请求发起时调用,在此类脚本中可以使用如下变量 10 | 11 | - 所有loon script API 12 | - $request: 一个http请求信息 13 | - $request.url: String类型,请求URL 14 | - $request.method: String类型,请求方法 15 | - $request.headers: js对象,请求头 16 | - $request.body: String或者Uint8Array类型,当requires-body = true时才有值,请求的body 17 | - $response: undefined 18 | - $done()方法参数说明: 19 | - $done(): 不传任何参数,表示放弃该请求,请求连接会直接断开 20 | - $done({}): 空js对象,请求继续,任何请求参数不会有任何变化 21 | - $done({url:"https://new.example.com/"}): 替换原来的url 22 | - $done({headers:{}}): 替换原来的request headers 23 | - $done({response:{ 24 | status:200, 25 | headers:{},//response headers 26 | body:"" //response body String type 27 | }}): 直接向该请求返回一个假的响应 28 | 29 | ## http-response 30 | ### 语法 31 | ``` 32 | http-response ^https?:\/\/(www.)?(example)\.com script-path=https://example.com/loon.js,timeout=10,requires-body = true,tag = responseScript,enable=true 33 | ``` 34 | 此类脚本会在http请求得到响应后调用,requires-body参数表示是否截取响应体, 35 | - 所有loon script API 36 | - $request: http请求信息 37 | - $request.url: String类型,请求URL 38 | - $request.method: String类型,请求方法 39 | - $request.headers: js对象,请求头 40 | - $request.body: String或者Uint8Array类型,如果请求带有body,此参数才有值 41 | - $response: http响应信息 42 | - $response.status: 响应状态 43 | - $response.headers: 响应头 44 | - $response.body: String或者Uint8Array类型,如果响应带有body,并且requires-body = true时此参数才有值 45 | - $done()方法参数说明: 46 | - $done(): 不传任何参数,表示放弃该请求,请求连接会直接断开 47 | - $done({}): 空js对象,请求继续,任何请求参数不会有任何变化 48 | - $done({response:{ 49 | status:200, 50 | headers:{},//response headers 51 | body:"" //response body String type 52 | }}): 直接向该请求返回一个假的响应 53 | 54 | ## cron 55 | ### 语法 56 | ``` 57 | cron "0 8 * * *" script-path=cron.js,tag = responseScript,enable=true 58 | ``` 59 | - 根据设定的cron表达式触发脚本 60 | - "* * * * *" : 分 时 日 月 周 61 | - "* * * * * *" :秒 分 时 日 月 周 62 | 63 | ## network-changed 64 | ### 语法 65 | ``` 66 | network-changed script-path=https://raw.githubusercontent.com/Loon0x00/LoonExampleConfig/master/Script/netChanged.js, tag=changeModel,enable=true 67 | ``` 68 | 当网络环境发生变化时会调用改脚本,如果有多个这种类型的脚本,只会调用配置文件中的第一个 69 | 70 | ## generic 71 | ### 语法 72 | ``` 73 | generic script-path=https://raw.githubusercontent.com/Loon0x00/LoonExampleConfig/master/Script/generic_example.js,tag=GeoLocation,timeout=10,img-url=location.fill.viewfinder.system 74 | ``` 75 | 以节点、策略组、规则等配置为参数的脚本,需要在app内部页面手动进行触发,不会主动触发。 -------------------------------------------------------------------------------- /example.conf: -------------------------------------------------------------------------------- 1 | #default configure 2 | #Update Date: 2021.02.19 22:34:05 +0000 3 | #author: Loon 4 | 5 | [General] 6 | skip-proxy = 192.168.0.0/16,10.0.0.0/8,172.16.0.0/12,localhost,*.local,e.crashlynatics.com 7 | bypass-tun = 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.88.99.0/24,192.168.0.0/16,198.18.0.0/15,198.51.100.0/24,203.0.113.0/24,224.0.0.0/4,255.255.255.255/32 8 | # DNS server 9 | dns-server = system,119.29.29.29,223.5.5.5 10 | # Doh server, only for Wireformat 11 | doh-server = https://example.com/dns-query 12 | allow-udp-proxy = false 13 | allow-wifi-access = true 14 | wifi-access-http-port = 7222 15 | wifi-access-socket5-port = 7221 16 | proxy-test-url = http://www.qualcomm.cn/generate_204 17 | test-timeout = 3 18 | resource-parser = http://www.example.com/parser.js 19 | ssid-trigger = SSID-DIRECT 20 | real-ip = *.apple.com, *apple.com 21 | 22 | [Proxy] 23 | # 内置 DIRECT、REJECT 策略 24 | # 内置 PROXY 指向本地节点或者订阅节点中的任何一个(有本地节点默认指向第一个本地节点,当没有本地节点但有订阅节点时,指向第一个订阅的第一个节点,本地节点和订阅节点都不存在时指向DIRECT) 25 | #ss 26 | ss1 = Shadowsocks,example.com,443,aes-128-gcm,"password",fast-open=false,udp=true 27 | ss2 = Shadowsocks,example2.com,443,chacha20,"password",fast-open=true,udp=true 28 | #ss+simple obfs 29 | ssObfs1 = Shadowsocks,example.com,80,aes-128-gcm,"password",obfs-name=http,obfs-host=www.micsoft.com,fast-open=true,udp=true 30 | ssObfs2 = Shadowsocks,example.com,443,aes-128-gcm,"password",obfs-name=tls,obfs-host=www.micsoft.com,fast-open=true,udp=true 31 | #ssr 32 | # 节点名称 = 协议,服务器地址,端口,加密方式,密码,protocol = 协议,protocol-param = 协议参数,obfs=混淆,obfs-param=混淆参数 33 | ssr1 = ShadowsocksR,example.com,443,aes-256-cfb,"password",protocol=orig,obfs=http_simple,obfs-param=download.windows.com,fast-open=false,udp=true 34 | ssr2 = ShadowsocksR,example.com,10076,aes-128-cfb,"password",protocol=auth_chain_a,protocol-param=9555:loon,obfs=http_post,obfs-param=download.windows.com,fast-open=false,udp=true 35 | ssr3 = ShadowsocksR,example.com,10076,chacha20,"password",protocol=auth_aes128_md5,protocol-param=9555:loon,obfs=tls1.2_ticket_auth,obfs-param=download.windows.com,fast-open=false,udp=true 36 | ssr4 = ShadowsocksR,example.com,10076,chacha20-ietf,"password",protocol=auth_aes128_sha1,protocol-param=9555:loon,obfs=plain,fast-open=false,udp=true 37 | #http 38 | http1 = http,example.com,80 39 | http2 = http,example.com,80,username,"password" 40 | #https 41 | https1 = https,example.com,443 42 | https2 = https,example.com,443,username,"password" 43 | https3 = https,example.com,443,username,"password",skip-cert-verify=true,tls-name=example.com 44 | #vmess+tcp 45 | # 节点名称 = 协议,服务器地址,端口,加密方式,UUID,传输方式:(tcp/ws),path=websocket握手header中的path, host=websocket握手header中的path, over-tls=是否tls, tls-name=tls名字, skip-cert-verify=是否跳过证书校验(默认否) 46 | vmess1 = vmess,example.com,10086,aes-128-gcm,"52396e06-041a-4cc2-be5c-8525eb457809",transport=tcp,path=/,host=v3-dy-y.ixigua.com,over-tls=false 47 | #vmess+tcp+tls 48 | vmess2 = vmess,example.com,10086,aes-128-gcm,"52396e06-041a-4cc2-be5c-8525eb457809",transport=tcp,path=/,host=v3-dy-y.ixigua.com,over-tls=true,tls-name=example.com,skip-cert-verify=true 49 | #vmess+ws 50 | vmess3 = vmess,example.com,10086,aes-128-gcm,"52396e06-041a-4cc2-be5c-8525eb457809",transport=ws,path=/,host=v3-dy-y.ixigua.com,over-tls=false 51 | #vmess+wss 52 | vmess4 = vmess,example.com,10086,aes-128-gcm,"52396e06-041a-4cc2-be5c-8525eb457809",transport=ws,path=/,host=v3-dy-y.ixigua.com,over-tls=true,tls-name=example.com,skip-cert-verify=true 53 | #VLESS 54 | vless1 = VLESS,example.com,10087,"52396e06-041a-4cc2-be5c-8525eb457809",,transport=tcp,path=/,host=v3-dy-y.ixigua.com,over-tls=false 55 | vless2 = VLESS,example.com,10087,"52396e06-041a-4cc2-be5c-8525eb457809",transport=ws,path=/,host=v3-dy-y.ixigua.com,over-tls=true,tls-name=example.com,skip-cert-verify=true 56 | #trojan 57 | trojan1 = trojan,example.com,443,"password",skip-cert-verify=false,tls-name=example.com 58 | trojan2 = trojan,example.com,443,"password",skip-cert-verify=true,tls-name=example.com 59 | 60 | [Remote Proxy] 61 | # 订阅节点 62 | # 别名 = 订阅URL 63 | Subs = https://example/server-complete.txt 64 | Subs2 = https://example2/server-complete.txt 65 | 66 | [Remote Filter] 67 | # 筛选订阅节点,筛选后的结果可加入到策略组中,目前支持三种筛选方式 68 | # NodeSelect: 使用在UI上选择的节点。 69 | # NameKeyword: 根据提供的关键词对订阅中所有节点的名称进行筛选,使用筛选后的节点。 70 | # NameRegex: 根据提供的正则表达式对订阅中所有节点的名称进行筛选,使用筛选后的节点。 71 | Netflix = NodeSelect,Subs 72 | Hulu = NameKeyword,Subs,Subs2,FilterKey = Hulu 73 | HK = NameRegex,Subs,FilterKey = *HK 74 | 75 | [Proxy Group] 76 | # 节点选项 77 | PROXY = select,Auto,1,2,3,4,Subs 78 | # url-test模式,给提供的url发出http header请求,根据返回结果,选择测速最快的节点,默认间隔600s,测速超时时间5s,为了避免资源浪费,建议节点数不要过多,只支持单个节点和远端节点,其他会被忽略 79 | Auto = url-test,1,2,3,4,Subs,url = http://bing.com/,interval = 600 80 | # fallback模式,和url-test类似,不同的是会根据顺序返回第一个可用的节点,为了避免资源浪费,建议节点数不要过多,只支持单个节点和远端节点,其他会被忽略 81 | Auto1 = fallback,1,2,3,4,Subs,url = http://bing.com/,interval = 600 82 | # 别名 = ssid,默认 = 策略, 蜂窝 = 策略, ssid名称 = 策略 83 | SSID = ssid, default = PROXY, cellular = DIRECT, "DivineEngine" = PROXY 84 | #负载均衡,可选三种算法:random:随机选择策略组可用节点,round-robin:轮询策略组可用节点,pcc:在random基础上,针对相同host使用同一节点,此处url用来测试节点可用性,每隔interval进行一次测速,max-timeout参数用于筛选测试时间超过max-timeout的节点为不可用节点 85 | LoadBalance = load-balance,node1,node2,remoteNodes, url = http://bing.com, interval = 600,algorithm = pcc, max-timeout=3000 86 | # 广告模式 87 | Advertising = select,REJECT,DIRECT 88 | # 白名单模式 PROXY,黑名单模式 DIRECT 89 | Final = select,PROXY,DIRECT 90 | 91 | [Rule] 92 | # Local RULE 93 | # Type:DOMAIN-SUFFIX,DOMAIN,DOMAIN-KEYWORD,USER-AGENT,URL-REGEX,IP-CIDR 94 | # Strategy:DIRECT,Proxy,REJECT 95 | # Options:no-resolve(no-resolve(only for cidr)) 96 | DOMAIN,google.com,PROXY 97 | # GeoIP China 98 | GEOIP,CN,DIRECT 99 | FINAL,Final 100 | 101 | [Remote Rule] 102 | # Remote Rule 103 | # 订阅规则URL,策略 104 | # PROXY 105 | https://raw.githubusercontent.com/Loon0x00/LoonExampleConfig/master/Rule/ExampleRule.list,policy=PROXY,enabled=true 106 | 107 | [Rewrite] 108 | # Redirect Google Search Service 109 | ^https?:\/\/(www.)?(g|google)\.cn https://www.google.com 302 110 | 111 | [Remote Rewrite] 112 | # 订阅 URL Rewrite 113 | # 订阅url,别名(可选) 114 | https://raw.githubusercontent.com/Loon0x00/LoonExampleConfig/master/Rewrite/AutoRewrite_Example.list,tag=auto,enable=true 115 | 116 | [Host] 117 | #可以指定一下四种模式: 118 | # 1、指定域名使用对应的IP地址 119 | # 2、将域名指向另一个域名 120 | # 3、指定域名请求DNS时使用特定的DNS服务器,格式为:google.com = server:8.8.8.8 或者 *.baidu.com = server:https://example.com/dns-query 121 | # 4、指定具体的SSID环境下使用特定的DNS服务器 122 | *.testflight.apple.com = server:8.8.4.4 123 | ssid:LOON WIFI = server:system 124 | 125 | [Script] 126 | # http-request 处理请求的脚本 127 | # http-response 处理请求响应的脚本 128 | # cron 定时脚本 129 | # network-changed 网络发生变化触发脚本 130 | # generic 通用型脚本,可用在操作节点/策略组中,执行是会带入节点名称和策略组名称,脚本必须在开启NE时 131 | 132 | # http-request ^https?:\/\/(www.)?(example)\.com script-path=localscript.js,tag = requestScript,enable=true 133 | # http-response ^https?:\/\/(www.)?(example)\.com script-path=https://example.com/loon.js,timeout=10,requires-body = true,tag = responseScript,enable=true 134 | # cron "0 8 * * *" script-path=cron.js,tag = responseScript,enable=true 135 | 136 | network-changed script-path=https://raw.githubusercontent.com/Loon0x00/LoonExampleConfig/master/Script/netChanged.js, tag=changeModel,enable=true 137 | 138 | generic script-path=https://raw.githubusercontent.com/Loon0x00/LoonExampleConfig/master/Script/generic_example.js,tag=GeoLocation,timeout=10,img-url=location.fill.viewfinder.system 139 | 140 | [Remote Script] 141 | # https://example.com/loon.js, tag=scripts, enable=true 142 | 143 | [Plugin] 144 | # plugin-url tag=tag,proxy=插件中PROXY所指向的策略,enable=true 145 | # plugin策略可设置为DIRECT,REJECT,PROXY,其中PROXY为用户在app中手动映射的策略,rule后不跟随策略默认使用PROXY 146 | # example: https://raw.githubusercontent.com/Loon0x00/LoonExampleConfig/master/Rewrite/AutoRewrite_Example.list,tag=boxjs,enable=true 147 | 148 | [MITM] 149 | hostname = *.example.com,*.sample.com 150 | enable = true 151 | skip-server-cert-verify = true 152 | #ca-p12 = 153 | #ca-passphrase = 154 | --------------------------------------------------------------------------------