fix #15: is tls record magic

addon-dailer
lqqyt2423 3 years ago
parent 1cb5a375c0
commit 19c8a79809

@ -73,7 +73,7 @@ type Middle struct {
Server *http.Server Server *http.Server
} }
func NewMiddle(proxy *Proxy,caPath string) (Interceptor, error) { func NewMiddle(proxy *Proxy, caPath string) (Interceptor, error) {
ca, err := cert.NewCA(caPath) ca, err := cert.NewCA(caPath)
if err != nil { if err != nil {
return nil, err return nil, err
@ -141,7 +141,8 @@ func (m *Middle) intercept(serverConn *connBuf) {
return return
} }
if buf[0] == 0x16 && buf[1] == 0x03 && (buf[2] >= 0x0 || buf[2] <= 0x03) { // https://github.com/mitmproxy/mitmproxy/blob/main/mitmproxy/net/tls.py is_tls_record_magic
if buf[0] == 0x16 && buf[1] == 0x03 && (buf[2] >= 0x0 && buf[2] <= 0x03) {
// tls // tls
m.Listener.(*listener).connChan <- serverConn m.Listener.(*listener).connChan <- serverConn
} else { } else {

Loading…
Cancel
Save