feat: v0.2.0-rc, optimize code

This commit is contained in:
2024-03-30 20:27:14 +08:00
parent aec945e44e
commit 4fd94f6b85

View File

@@ -1,5 +1,11 @@
# 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:
```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
$ 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.
## Example
Proxy example:
Edit `/etc/hosts` add:
```text
127.0.0.1 www.baidu.com
```
Send HTTP request via cURL:
```shell
$ curl https://www.baidu.com/not-found -v
* Trying 127.0.0.1...
@@ -108,6 +120,7 @@ $ curl https://www.baidu.com/not-found -v
```
Log from proxy-inspector:
```text
[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
@@ -140,6 +153,7 @@ Log from proxy-inspector:
```
proxy-inspector did the follow steps:
1. issue certificate for `www.baidu.com`
2. receive request `GET /not-found`, print request to log
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
6. receive response body, print response body to log
Important
## Important
* Intermediate certificate tested:
* ECDSA(P384) with SHA384