mirror of
https://github.com/Gouryella/drip.git
synced 2026-03-02 00:03:07 +00:00
- Add Bearer Token authentication, supporting tunnel access control via the --auth-bearer parameter - Refactor large modules into smaller, more focused components to improve code maintainability - Update dependency versions, including golang.org/x/crypto, golang.org/x/net, etc. - Add SilenceUsage and SilenceErrors configuration for all CLI commands - Modify connector configuration structure to support the new authentication method - Update recent change log in README with new feature descriptions BREAKING CHANGE: Authentication via Bearer Token is now supported, requiring the new --auth-bearer parameter
37 lines
771 B
Go
37 lines
771 B
Go
//go:build windows
|
|
|
|
package tuning
|
|
|
|
import (
|
|
"syscall"
|
|
"unsafe"
|
|
)
|
|
|
|
var (
|
|
kernel32 = syscall.NewLazyDLL("kernel32.dll")
|
|
globalMemoryStatusEx = kernel32.NewProc("GlobalMemoryStatusEx")
|
|
)
|
|
|
|
type memoryStatusEx struct {
|
|
dwLength uint32
|
|
dwMemoryLoad uint32
|
|
ullTotalPhys uint64
|
|
ullAvailPhys uint64
|
|
ullTotalPageFile uint64
|
|
ullAvailPageFile uint64
|
|
ullTotalVirtual uint64
|
|
ullAvailVirtual uint64
|
|
ullAvailExtendedVirtual uint64
|
|
}
|
|
|
|
func getSystemTotalMemory() uint64 {
|
|
var mem memoryStatusEx
|
|
mem.dwLength = uint32(unsafe.Sizeof(mem))
|
|
|
|
ret, _, _ := globalMemoryStatusEx.Call(uintptr(unsafe.Pointer(&mem)))
|
|
if ret == 0 {
|
|
return 1024 * 1024 * 1024
|
|
}
|
|
return mem.ullTotalPhys
|
|
}
|