add Client.Tls

addon-dailer
lqqyt2423 2 years ago
parent 3bbda5588b
commit c2143a80d8

@ -9,11 +9,13 @@ import (
type Client struct { type Client struct {
Id uuid.UUID Id uuid.UUID
Conn net.Conn Conn net.Conn
Tls bool
} }
func NewClient(c net.Conn) *Client { func NewClient(c net.Conn) *Client {
return &Client{ return &Client{
Id: uuid.NewV4(), Id: uuid.NewV4(),
Conn: c, Conn: c,
Tls: false,
} }
} }

@ -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 // 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 { if buf[0] == 0x16 && buf[1] == 0x03 && buf[2] <= 0x03 {
// tls // tls
serverConn.connContext.Client.Tls = true
m.Listener.(*listener).connChan <- serverConn m.Listener.(*listener).connChan <- serverConn
} else { } else {
// ws // ws

Loading…
Cancel
Save