From c2143a80d8957041afc97440f8af2c49bb7b02d1 Mon Sep 17 00:00:00 2001 From: lqqyt2423 <974923609@qq.com> Date: Tue, 7 Jun 2022 23:02:59 +0800 Subject: [PATCH] add Client.Tls --- connection/connection.go | 2 ++ proxy/middle.go | 1 + 2 files changed, 3 insertions(+) diff --git a/connection/connection.go b/connection/connection.go index 25a843b..ac6eff3 100644 --- a/connection/connection.go +++ b/connection/connection.go @@ -9,11 +9,13 @@ import ( type Client struct { Id uuid.UUID Conn net.Conn + Tls bool } func NewClient(c net.Conn) *Client { return &Client{ Id: uuid.NewV4(), Conn: c, + Tls: false, } } diff --git a/proxy/middle.go b/proxy/middle.go index 700bbae..16bcca6 100644 --- a/proxy/middle.go +++ b/proxy/middle.go @@ -153,6 +153,7 @@ func (m *Middle) intercept(serverConn *connBuf) { // https://github.com/mitmproxy/mitmproxy/blob/main/mitmproxy/net/tls.py is_tls_record_magic if buf[0] == 0x16 && buf[1] == 0x03 && buf[2] <= 0x03 { // tls + serverConn.connContext.Client.Tls = true m.Listener.(*listener).connChan <- serverConn } else { // ws