feat: v0.2.0-rc, optimize code
This commit is contained in:
19
README.md
19
README.md
@@ -1,5 +1,11 @@
|
|||||||
# proxy-inspector
|
# proxy-inspector
|
||||||
|
|
||||||
|
## Introduction
|
||||||
|
|
||||||
|
`proxy-inspector` is a HTTP/HTTPS proxy based on `pingora`, `proxy-inspector` can issue certificate just in time, `proxy-inspector` can dump HTTP/HTTPS request and response.
|
||||||
|
|
||||||
|
## Configure
|
||||||
|
|
||||||
`proxy_config.json` sample config:
|
`proxy_config.json` sample config:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
@@ -41,7 +47,9 @@ Only send DNS query for assigned domain patterns:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Generate self signed certificate:
|
## Make self-signed certificate
|
||||||
|
|
||||||
|
Generate self-signed certificate:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ cargo r --example generate_self_signed_ca
|
$ cargo r --example generate_self_signed_ca
|
||||||
@@ -49,14 +57,18 @@ $ cargo r --example generate_self_signed_ca
|
|||||||
|
|
||||||
When generate success, cert and key will write to files `cert.pem`, `cert.key`, fail if any file is existed.
|
When generate success, cert and key will write to files `cert.pem`, `cert.key`, fail if any file is existed.
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
Proxy example:
|
Proxy example:
|
||||||
|
|
||||||
Edit `/etc/hosts` add:
|
Edit `/etc/hosts` add:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
127.0.0.1 www.baidu.com
|
127.0.0.1 www.baidu.com
|
||||||
```
|
```
|
||||||
|
|
||||||
Send HTTP request via cURL:
|
Send HTTP request via cURL:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ curl https://www.baidu.com/not-found -v
|
$ curl https://www.baidu.com/not-found -v
|
||||||
* Trying 127.0.0.1...
|
* Trying 127.0.0.1...
|
||||||
@@ -108,6 +120,7 @@ $ curl https://www.baidu.com/not-found -v
|
|||||||
```
|
```
|
||||||
|
|
||||||
Log from proxy-inspector:
|
Log from proxy-inspector:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
[2024-03-30T12:21:28Z INFO proxy_inspector::service] SNI provided: www.baidu.com
|
[2024-03-30T12:21:28Z INFO proxy_inspector::service] SNI provided: www.baidu.com
|
||||||
[2024-03-30T12:21:28Z INFO proxy_inspector::cert] New certificate for: www.baidu.com -> 4f33ad6b50c67dd3356a04bf7885830c90cf0369
|
[2024-03-30T12:21:28Z INFO proxy_inspector::cert] New certificate for: www.baidu.com -> 4f33ad6b50c67dd3356a04bf7885830c90cf0369
|
||||||
@@ -140,6 +153,7 @@ Log from proxy-inspector:
|
|||||||
```
|
```
|
||||||
|
|
||||||
proxy-inspector did the follow steps:
|
proxy-inspector did the follow steps:
|
||||||
|
|
||||||
1. issue certificate for `www.baidu.com`
|
1. issue certificate for `www.baidu.com`
|
||||||
2. receive request `GET /not-found`, print request to log
|
2. receive request `GET /not-found`, print request to log
|
||||||
3. send DNS query `www.baidu.com -> 180.101.40.188`
|
3. send DNS query `www.baidu.com -> 180.101.40.188`
|
||||||
@@ -147,8 +161,7 @@ proxy-inspector did the follow steps:
|
|||||||
5. receive response header, print response header to log
|
5. receive response header, print response header to log
|
||||||
6. receive response body, print response body to log
|
6. receive response body, print response body to log
|
||||||
|
|
||||||
|
## Important
|
||||||
Important
|
|
||||||
|
|
||||||
* Intermediate certificate tested:
|
* Intermediate certificate tested:
|
||||||
* ECDSA(P384) with SHA384
|
* ECDSA(P384) with SHA384
|
||||||
|
|||||||
Reference in New Issue
Block a user