Browse Source

源代码中所有的 1181 替换为 31181

pull/333/head
王良 3 months ago
parent
commit
1173ee9096
  1. 2
      README.md
  2. 6
      doc/other.md
  3. 2
      packages/core/src/shell/test.js
  4. 3
      packages/mitmproxy/src/lib/interceptor/impl/req/requestReplace.js
  5. 2
      packages/mitmproxy/src/lib/proxy/common/config.js
  6. 8
      test/test.js

2
README.md

@ -239,7 +239,7 @@ const intercepts = {
#### 1)Mac系统使用时,首页的系统代理开关无法打开
出现这个问题可能是没有开启系统代理命令的执行权限
```
networksetup -setwebproxy 'WiFi' 127.0.0.1 1181
networksetup -setwebproxy 'WiFi' 127.0.0.1 31181
#看是否有如下错误提示
** Error: Command requires admin privileges.
```

6
doc/other.md

@ -6,11 +6,11 @@
需要先通过keytool安装证书
`keytool -import -alias dev-sidecar -keystore "jdk路径\security\cacerts" -file 用户目录\.dev-sidecar\dev-sidecar.ca.crt`默认密码为`changeit`
启动时还需要设置参数
`-Dhttp.proxyHost=localhost -Dhttp.proxyPort=1181 -Dhttps.proxyHost=localhost -Dhttps.proxyPort=1181`
`-Dhttp.proxyHost=localhost -Dhttp.proxyPort=31181 -Dhttps.proxyHost=localhost -Dhttps.proxyPort=31181`
Gradle还需在`用户目录/.gradle/gradle.properties`创建配置文件
```properties
systemProp.http.proxyHost=localhost
systemProp.http.proxyPort=1181
systemProp.http.proxyPort=31181
systemProp.https.proxyHost=localhost
systemProp.https.proxyPort=1181
systemProp.https.proxyPort=31181
```

2
packages/core/src/shell/test.js

@ -38,7 +38,7 @@ const request = require('request')
const fs = require('fs')
request({
url: 'https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js',
proxy: 'http://127.0.0.1:1181',
proxy: 'http://127.0.0.1:31181',
ca: fs.readFileSync('C:/Users/Administrator/.dev-sidecar/dev-sidecar.ca.crt')
// eslint-disable-next-line handle-callback-err
}, (err, res, body) => {

3
packages/mitmproxy/src/lib/interceptor/impl/req/requestReplace.js

@ -44,6 +44,9 @@ module.exports = {
}
res.setHeader('DS-RequestReplace-Interceptor', actions)
const url = `${rOptions.method}${rOptions.protocol}//${rOptions.hostname}:${rOptions.port}${req.url}`
log.info('requestReplace intercept:', url)
},
is (interceptOpt) {
return !!interceptOpt.requestReplace

2
packages/mitmproxy/src/lib/proxy/common/config.js

@ -7,7 +7,7 @@ config.caKeyFileName = 'dev-sidecar.ca.key.pem'
config.defaultHost = '127.0.0.1'
config.defaultPort = 1181
config.defaultPort = 31181
config.caName = 'DevSidecar - This certificate is generated locally'

8
test/test.js

@ -28,13 +28,13 @@
// const https = require('https')
// const fs = require('fs')
// process.env.NODE_EXTRA_CA_CERTS = 'C:\\Users\\Administrator\\.dev-sidecar\\dev-sidecar.ca.crt'
// process.env.GLOBAL_AGENT_HTTP_PROXY = "http://127.0.0.1:1181"
// process.env.GLOBAL_AGENT_HTTPS_PROXY = "http://127.0.0.1:1181"
// process.env.GLOBAL_AGENT_HTTP_PROXY = "http://127.0.0.1:31181"
// process.env.GLOBAL_AGENT_HTTPS_PROXY = "http://127.0.0.1:31181"
// fs.readFileSync(process.env.NODE_EXTRA_CA_CERTS)
//
// const options = {
// agent : new https.Agent({
// proxy: "http://127.0.0.1:1181"
// proxy: "http://127.0.0.1:31181"
// })
// }
// console.log('options', options)
@ -55,7 +55,7 @@ function testRequest(){
// process.env.NODE_EXTRA_CA_CERTS='C:\\Users\\Administrator\\.dev-sidecar\\dev-sidecar.ca.crt'
console.log(process.env.NODE_EXTRA_CA_CERTS)
const request = require("request").defaults({
proxy: "http://127.0.0.1:1181"
proxy: "http://127.0.0.1:31181"
})
request("https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js",(error, response, body)=>{
if(error){

Loading…
Cancel
Save