Package Exports
- whistle
- whistle/bin/whistle.js
- whistle/index
- whistle/lib/config
- whistle/lib/rules/storage
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (whistle) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
whistle
建议尽量使用最新版本,如果出现HTTPS的问题(#44),升级Node到
v6及以上版本,更新whistle到最新版本,再安装下根证书即可
注意:在iOS上安装根证书时,需要先关闭https拦截,否则将显示安装失败
其它问题也可以加QQ群讨论: 462558941
whistle(读音[ˈwɪsəl],拼音[wēisǒu])基于Node实现的跨平台web调试代理工具,类似的工具有Windows平台上的Fiddler,主要用于查看、修改HTTP、HTTPS、Websocket的请求、响应,也可以作为HTTP代理服务器使用,不同于Fiddler通过断点修改请求响应的方式,whistle采用的是类似配置系统hosts的方式,一切操作都可以通过配置实现,支持域名、路径、正则表达式、通配符、通配路径等多种匹配方式,且可以通过Node模块扩展功能。
whistle的安装请参见: whistle帮助文档。
快速入门推荐看这篇文章: whistle工具全程入门。
基本功能

完整功能请参见: whistle帮助文档。
配置模式
传统hosts的配置模式:
# 单个host
ip hostname
# 组合host
ip hostname1 hostname2 ... hostnameN
# 例如
127.0.0.1 www.example.com
127.0.0.1 a.example.com b.example.com c.example.comwhistle的配置模式:
# 单个操作
pattern operator-uri
# 如果pattern和operator-uri不同时为域名或路径的一种组合,位置可以调换
operator-uri pattern
# 组合模式
pattern operator-uri1 operator-uri2 ... operator-uriN
# pattern1和operator-uri不同时为域名或路径的一种组合,可以如下配置
operator-uri pattern1 pattern2 ... patternN其中,pattern可以为:
- 域名:
www.test.com(所有该域名下的请求都会匹配operator-uri) - 路径:
http://www.test.com/xxx(http://www.test.com/xxx及其子路径的请求都会匹配operator-uri),或不加协议protocol://www.test.com/xxx,protocol可以为http、https、ws、wss(http://www.test.com/xxx及其子路径的请求都会匹配operator-uri) - 正则:
/^https?:\/\/([^\/]+)\/xxx/(http(s)://host:port/xxx及其子路径的请求都会匹配operator-uri,且在operator-uri中可以通过$1, $2, ..., $9获取url里面的子匹配) - 精确:在原来路径前面加精确匹配符
$,即:$url(可以带协议$http://www.test.com/xxx,也可以不带协议$www.test.com) - 通配符:
http://*.test.com、*.test.com、*.test/abc、$*.test.com - 通配路径:
~/abc、https://~/abc、$~/、$http://~/
operator-uri由上述基本功能抽象成的形如protocol://ruleValue的URI,whistle会根据匹配到的operator-uri的protocol及ruleValue修改请求或响应,具体实现过程请参见whistle帮助文档。
例如:
# 修改www.example.com的响应cors
www.example.com resCors://*
# 或
resCors://* www.example.com
# 同时修改多个自定域名或路径
resCors://* /example\.com/ a.test.com b.test.com
# 修改www.test.com的带端口host、referer和响应的cors
www.test.com 127.0.0.1:8080 referer://http://www.example.com resCors://*完整功能参见: whistle帮助文档。
Network

Rules

Values

完整功能请参见: whistle帮助文档。