mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-15 17:40:27 +08:00
TLS连接增加握手超时检查
This commit is contained in:
@@ -2,10 +2,12 @@ package nodes
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
|
||||
"github.com/TeaOSLab/EdgeNode/internal/utils"
|
||||
"io"
|
||||
"net"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -153,3 +155,12 @@ func httpRequestNextId() string {
|
||||
// timestamp + requestId + nodeId
|
||||
return strconv.FormatInt(unixTime, 10) + strconv.Itoa(int(atomic.AddInt32(&httpRequestId, 1))) + teaconst.NodeIdString
|
||||
}
|
||||
|
||||
// 检查连接是否为TLS连接
|
||||
func httpIsTLSConn(conn net.Conn) bool {
|
||||
if conn == nil {
|
||||
return false
|
||||
}
|
||||
_, ok := conn.(*tls.Conn)
|
||||
return ok
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user