fix attempt1. (failed)issue: -lazy在fallback下闪退问题

This commit is contained in:
hahahrfool
2022-03-17 22:43:25 +08:00
parent 3fdeded6cf
commit b533b34e5f
2 changed files with 38 additions and 18 deletions

View File

@@ -130,7 +130,7 @@ func (c *ComSniff) GetFailReason() int {
}
// 总之,如果读写都用同样的判断代码的话,客户端和服务端应该就能同步进行 相同的TLS判断
func (cd *ComSniff) utilsDetect(p []byte, isRead bool) {
func (cd *ComSniff) commonDetect(p []byte, isRead bool) {
/*
我们把tls的细节放在这个注释里便于参考
@@ -506,7 +506,7 @@ func (cd *ComSniff) utilsDetect(p []byte, isRead bool) {
}
func utilsFilterStep(err error, cd *ComSniff, p []byte, isRead bool) {
func commonFilterStep(err error, cd *ComSniff, p []byte, isRead bool) {
if !OnlyTest && (cd.DefinitelyNotTLS || cd.IsTls) { //确定了是TLS 或者肯定不是 tls了的话就直接return掉
return
}
@@ -524,7 +524,7 @@ func utilsFilterStep(err error, cd *ComSniff, p []byte, isRead bool) {
}
if len(p) > 3 {
cd.utilsDetect(p, isRead)
cd.commonDetect(p, isRead)
}
}
@@ -542,7 +542,7 @@ type DetectReader struct {
func (dr *DetectReader) Read(p []byte) (n int, err error) {
n, err = dr.Reader.Read(p)
utilsFilterStep(err, &dr.ComSniff, p[:n], true)
commonFilterStep(err, &dr.ComSniff, p[:n], true)
if PDD {
if dr.DefinitelyNotTLS {
@@ -616,7 +616,7 @@ func (dw *DetectWriter) Write(p []byte) (n int, err error) {
return
}
utilsFilterStep(nil, &dw.ComSniff, p, false)
commonFilterStep(nil, &dw.ComSniff, p, false)
// 经过判断之后,确认是 tls了则我们缓存这个记录 然后通过tls发送特殊指令
if dw.IsTls {