Skip to content

Commit 80f5bdf

Browse files
authored
Support client certs for transport & Refactor internal sharding cache (#2)
* Add client certs option * Refactor internal sharding cache
1 parent fe4483e commit 80f5bdf

7 files changed

Lines changed: 430 additions & 284 deletions

File tree

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ mitmpgo.WithDisableProxy()
157157
mitmpgo.WithRootCAs("path/to/root-ca1.crt", "path/to/root-ca2.crt")
158158

159159
// Configure certificate cache pool
160-
mitmpgo.WithCertCachePool(1000, 60000, 3600000)
160+
mitmpgo.WithCertCachePool(2048, 30, 15)
161161

162162
// Custom dialer with timeout
163163
mitmpgo.WithDialer(&net.Dialer{
@@ -191,6 +191,9 @@ mitmpgo.WithErrorHandler(func(ec mitmpgo.ErrorContext) {
191191
```go
192192
// Skip SSL verification when connecting to servers (not recommended for production)
193193
mitmpgo.WithSkipVerifySSLFromServer()
194+
195+
// mTLS client-authentication
196+
mitmpgo.WithClientCert("example.com", mitmpgo.ClientCert{CertPath: "certs/client.crt", KeyPath: "certs/client.key" })
194197
```
195198

196199
### Protocol Options

examples/dumper/main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ func main() {
7676
mitmpgo.WithHTTPInterceptor(httpInterceptor),
7777
mitmpgo.WithWebsocketInterceptor(websocketInterceptor),
7878
mitmpgo.WithErrorHandler(errHandler),
79-
// mitmpgo.WithRootCAs("certs/other-ca.crt"),
79+
// mitmpgo.WithClientCert("127.0.0.1", mitmpgo.ClientCert{
80+
// CertPath: "certs/client.crt",
81+
// KeyPath: "certs/client.key",
82+
// }),
83+
// mitmpgo.WithRootCAs("certs/ca.crt"),
8084
// mitmpgo.WithIncludeHosts("ifconfig.co", "*.example.com", "example.com", "*.bilibili.com"),
8185
// mitmpgo.WithIncludeHosts("api.bilibili.com"),
8286
// mitmpgo.WithExcludeHosts("www.baidu.com"),

0 commit comments

Comments
 (0)