NAS: Add read and idle timeouts

This commit is contained in:
mkwcat 2024-05-07 22:36:27 -04:00
parent 5dfb1eeda7
commit c6927a3cb6
No known key found for this signature in database
GPG Key ID: 7A505679CE9E7AA9
2 changed files with 16 additions and 7 deletions

View File

@ -83,9 +83,11 @@ func startHTTPSProxy(config common.Config) {
panic(err)
}
moduleName := "NAS-TLS:" + conn.RemoteAddr().String()
go func() {
moduleName := "NAS-TLS:" + conn.RemoteAddr().String()
conn.SetReadDeadline(time.Now().Add(5 * time.Second))
handleRealTLS(moduleName, conn, nasAddr, privKeyPath, certsPath)
}()
}
@ -234,10 +236,15 @@ func startHTTPSProxy(config common.Config) {
panic(err)
}
// logging.Info("NAS-TLS", "Receiving HTTPS request from", aurora.BrightCyan(conn.RemoteAddr()))
moduleName := "NAS-TLS:" + conn.RemoteAddr().String()
go func() {
// logging.Info("NAS-TLS", "Receiving HTTPS request from", aurora.BrightCyan(conn.RemoteAddr()))
go handleTLS(moduleName, conn, nasAddr, privKeyPath, certsPath, serverCertsRecordWii, rsaKeyWii, serverCertsRecordDS, rsaKeyDS)
moduleName := "NAS-TLS:" + conn.RemoteAddr().String()
conn.SetReadDeadline(time.Now().Add(5 * time.Second))
handleTLS(moduleName, conn, nasAddr, privKeyPath, certsPath, serverCertsRecordWii, rsaKeyWii, serverCertsRecordDS, rsaKeyDS)
}()
}
}

View File

@ -41,8 +41,10 @@ func StartServer(reload bool) {
}
server = &nhttp.Server{
Addr: address,
Handler: http.HandlerFunc(handleRequest),
Addr: address,
Handler: http.HandlerFunc(handleRequest),
IdleTimeout: 20 * time.Second,
ReadTimeout: 10 * time.Second,
}
go func() {