optimization 2

This commit is contained in:
2026-05-27 15:09:42 -03:00
parent 1479e6ac73
commit 6cd9626db9

View File

@@ -28,6 +28,7 @@ import (
_ "github.com/lib/pq"
"golang.org/x/crypto/ssh"
"golang.org/x/time/rate"
"runtime/debug"
)
const (
@@ -2614,6 +2615,12 @@ func maybeHTTPStartPrefix(b []byte) bool {
}
func main() {
if memTotal, _, err := readMemInfo(); err == nil && memTotal > 0 {
limit := int64(memTotal) * 80 / 100
debug.SetMemoryLimit(limit)
log.Printf("GOMEMLIMIT auto-set to 80%% of RAM: %d MB", limit/1024/1024)
}
configPath := flag.String("config", "config.json", "path to JSON config file")
quietFlag := flag.Bool("quiet", false, "override config and disable logs")
userCountFlag := flag.Bool("usercount", false, "show per-user connection counters (single line)")