Skip to content

Instantly share code, notes, and snippets.

@mritd
Last active May 27, 2022 17:39
Show Gist options
  • Save mritd/555e0280aa8a404cc0a438ae9858294d to your computer and use it in GitHub Desktop.
Save mritd/555e0280aa8a404cc0a438ae9858294d to your computer and use it in GitHub Desktop.
Surge Modules
#!name= Redirect Apple Maps to 🇺🇸US
#!desc=只作用于Apple Maps,不修改定位服务和地区检测,可以通过搭配使用其他模块达成混合效果。
[URL Rewrite]
# Redirect Apple Maps to US
(^https?:\/\/gspe\d*-ssl\.ls\.apple\.)(com|cn)(\/.*)(country_code=[A-Z]{2})(.*) $1$2$3country_code=US$5 header
(^https?:\/\/gspe\d*-ssl\.ls\.apple\.)(com|cn)(\/.*)(environment=[a-z/-]{4,})(.*) $1$2$3environment=prod$5 header
[MITM]
hostname = %APPEND% gspe35-ssl.ls.apple.com
#!name= Unlock Apple News 🇺🇸US
#!desc=解锁🇺🇸US地区的News,注:使用过程中gateway.icloud.com会走与News相同的代理线路。
[Rule]
# > Apple News
RULE-SET,https://raw.githubusercontent.com/VirgilClyne/iRingo/main/RuleSet/Apple_News.list,BLEEM✨
[Script]
Apple News = type=http-request, pattern=^https?:\/\/news-(edge|events)\.apple\.com\/(v1\/configs|analyticseventsv2\/async).*, requires-body=1, script-path=https://raw.githubusercontent.com/VirgilClyne/iRingo/main/js/Apple_News.js
Apple News = type=http-request, pattern=^https?:\/\/news-(client-search)\.apple\.com\/(v1\/search\?).*, requires-body=0, script-path=https://raw.githubusercontent.com/VirgilClyne/iRingo/main/js/Apple_News.js
[MITM]
hostname = %APPEND% news-client.apple.com, news-client-search.apple.com, news-edge.apple.com, news-events.apple.com, newsletter-edge.apple.com
#!name= Enable iCloud Private Relay on gateway
#!desc=为终端设备启用iCloud专用代理,需要Surge for macOS启用网关模式。
#!system=mac
[Rule]
# > iCloud Private Relay
# https://developer.apple.com/cn/support/prepare-your-network-for-icloud-private-relay/
DOMAIN,mask-api.icloud.com,BLEEM✨
DOMAIN,mask-api.fe.apple-dns.net,BLEEM✨
# Optimize for Private Relay connections
AND,((PROTOCOL,UDP),(DEST-PORT,443),(USER-AGENT,Transparent%20network%20proxy%20for%20Apple%20system%20services*)),DIRECT, interface=en0, allow-other-interface=true
AND,((PROTOCOL,UDP),(DEST-PORT,443),(DOMAIN,mask.icloud.com)),DIRECT, interface=en0, allow-other-interface=true
AND,((PROTOCOL,UDP),(DEST-PORT,443),(DOMAIN,mask.apple-dns.net)),DIRECT, interface=en0, allow-other-interface=true
AND,((PROTOCOL,UDP),(DEST-PORT,443),(DOMAIN,mask-h2.icloud.com)),DIRECT, interface=en0, allow-other-interface=true
AND,((PROTOCOL,UDP),(DEST-PORT,443),(DOMAIN,mask-t.apple-dns.net)),DIRECT, interface=en0, allow-other-interface=true
AND,((PROTOCOL,UDP),(DEST-PORT,443),(IP-CIDR,17.0.0.0/8,no-resolve)),DIRECT, interface=en0, allow-other-interface=true
# Allow for network traffic audits
AND,((PROTOCOL,TCP),(DEST-PORT,443),(USER-AGENT,Transparent%20network%20proxy%20for%20Apple%20system%20services*)),BLEEM✨
AND,((PROTOCOL,TCP),(DEST-PORT,443),(DOMAIN,mask.icloud.com)),BLEEM✨
AND,((PROTOCOL,TCP),(DEST-PORT,443),(DOMAIN,mask.apple-dns.net)),BLEEM✨
AND,((PROTOCOL,TCP),(DEST-PORT,443),(DOMAIN,mask-h2.icloud.com)),BLEEM✨
AND,((PROTOCOL,TCP),(DEST-PORT,443),(DOMAIN,mask-t.apple-dns.net)),BLEEM✨
[Header Rewrite]
^https?:\/\/p[\d]{1,3}-acsegateway\.icloud\.com header-replace X-MMe-Country TW
[MITM]
hostname = %APPEND% mask-api.icloud.com, mask-api.fe.apple-dns.net, mask.icloud.com, mask.apple-dns.net, p*-acsegateway.icloud.com
#!name= iRingo for Location Services
#!desc=(V2) 1.修改定位服务(Location Services)配置文件 2.修改GCC(Geo Country Code)检测结果
#!openUrl=http://boxjs.com/#/app/iRingo.Location
#!author=VirgilClyne
#!homepage=https://github.com/VirgilClyne
#!manual=https://github.com/VirgilClyne/iRingo#定位服务
#!icon=https://images.macrumors.com/article-new/2019/07/ios_location_services-250x250.jpg
[Script]
# Rewrite Location Services Configuration Functions Internationalization
Location Services Configuration = type=http-request, pattern=^https?:\/\/configuration\.ls\.apple\.com\/config\/defaults(\?.*)?$, requires-body=0, script-path=https://raw.githubusercontent.com/VirgilClyne/iRingo/main/js/Location.request.js, argument=
Location Services Configuration = type=http-response, pattern=^https?:\/\/configuration\.ls\.apple\.com\/config\/defaults(\?.*)?$, requires-body=1, script-path=https://raw.githubusercontent.com/VirgilClyne/iRingo/main/js/Location.response.js, argument=
# Response Location Services Geo Country Code Check Result
Location Services GeoCountryCode = type=http-response, pattern=^https?:\/\/gspe1-ssl\.ls\.apple\.com\/pep\/gcc, requires-body=1, script-path=https://raw.githubusercontent.com/VirgilClyne/iRingo/main/js/Location.response.js, argument=
[MITM]
hostname = %APPEND% configuration.ls.apple.com, gspe1-ssl.ls.apple.com
#!name= Enable Siri Suggestions
#!desc=(V1.5) 在聚焦搜索(Spotlight)和查询(Look Up)中启用Siri建议(Siri Suggestions)功能。
[Rule]
# > Look Up (Only for Wikipedia@macOS, Surge Enhance Mode enabled required)
RULE-SET,https://raw.githubusercontent.com/VirgilClyne/iRingo/main/RuleSet/Wikipedia_for_Look_Up.list,BLEEM✨
[Script]
# Redirect Siri Suggestions Service
# Bag (iOS/macOS)
Redirect Siri Suggestions Service = type=http-request, pattern=^https?:\/\/api.*\.smoot\.apple\.(com|cn)\/bag\?(.*), requires-body=0, timeout=5, script-path=https://raw.githubusercontent.com/VirgilClyne/iRingo/main/js/archive/Siri_Suggestions.js
# Spotlight & Look Up Search (iOS/macOS)
Spotlight & Look Up Search = type=http-request, pattern=^https?:\/\/api.*\.smoot\.apple\.(com|cn)\/search\?(.*), requires-body=0, timeout=5, script-path=https://raw.githubusercontent.com/VirgilClyne/iRingo/main/js/archive/Siri_Suggestions.js
# Siri Infomation Card (macOS)
Siri Infomation Card = type=http-request, pattern=^https?:\/\/api.*\.smoot\.apple\.(com|cn)\/card\?(.*), requires-body=0, timeout=5, script-path=https://raw.githubusercontent.com/VirgilClyne/iRingo/main/js/archive/Siri_Suggestions.js
[MITM]
hostname = %APPEND% api*.smoot.apple.com, api*.smoot.apple.cn
#!name= iRingo for Apple Weather
#!desc=(V3) 1.解锁全部天气数据类型 2.替换空气质量数据:WAQI 3.添加下一小时降水:气象在线 4.替换空气质量地图数据:WAQI
#!openUrl=http://boxjs.com/#/app/iRingo.Weather
#!author=VirgilClyne
#!homepage=https://github.com/VirgilClyne
#!manual=https://github.com/VirgilClyne/iRingo#天气
#!icon=https://is4-ssl.mzstatic.com/image/thumb/Purple125/v4/c8/76/87/c8768792-b7ab-7de4-9c70-1888096b7ae9/AppIcon-0-0-1x_U007emarketing-0-0-0-10-0-0-sRGB-0-0-0-GLES2_U002c0-512MB-85-220-0-0.png/108x0w.webp
[Header Rewrite]
http-request ^https?:\/\/weather-data\.apple\.com\/(v1|v2)\/weather\/.* header-del If-None-Match
[Script]
Apple Weather Availability = type=http-response, pattern=^https?:\/\/weather-data\.apple\.com\/(v1|v2)\/availability\/.*, requires-body=1, script-path=https://raw.githubusercontent.com/VirgilClyne/iRingo/main/js/Weather.Availability.js, argument=
Apple Weather = type=http-response, pattern=^https?:\/\/weather-data\.apple\.com\/(v1|v2)\/weather\/.*, requires-body=1, timeout=20, script-path=https://raw.githubusercontent.com/VirgilClyne/iRingo/main/js/Weather.js, argument=
Apple Weather Map = type=http-request, pattern=^https?:\/\/weather-map\.apple\.com\/(v1|v2)\/mapOverlay\/.*(\?.*country=CN.*), requires-body=0, script-path=https://raw.githubusercontent.com/VirgilClyne/iRingo/main/js/Weather.Map.js, argument=
[MITM]
hostname = %APPEND% weather-data.apple.com, weather-map.apple.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment