Refactor monitoring package: remove platform-specific files and consolidate OS detection and process counting logic

- Deleted os_windows.go and process_windows.go, replacing them with platform-agnostic implementations in unit directory.
- Removed Linux-specific process counting logic from process_linux.go and integrated it into unit.
- Consolidated uptime and OS name retrieval into unit files for better organization.
- Updated update mechanism to use global variables for current version and repository.
- Introduced command-line flags for configuration, including disabling auto-update and web SSH.
- Implemented WebSocket connection handling and terminal interaction for both Unix and Windows systems.
- Added basic info upload functionality to server package, enhancing monitoring capabilities.
This commit is contained in:
Akizon77
2025-05-16 19:56:22 +08:00
parent b156e93409
commit e34367de69
26 changed files with 752 additions and 461 deletions

5
go.mod
View File

@@ -3,10 +3,13 @@ module github.com/komari-monitor/komari-agent
go 1.23.2
require (
github.com/UserExistsError/conpty v0.1.4
github.com/blang/semver v3.5.1+incompatible
github.com/creack/pty v1.1.24
github.com/gorilla/websocket v1.5.3
github.com/rhysd/go-github-selfupdate v1.2.3
github.com/shirou/gopsutil v3.21.11+incompatible
github.com/spf13/cobra v1.9.1
golang.org/x/sys v0.32.0
)
@@ -16,6 +19,8 @@ require (
github.com/google/go-github/v30 v30.1.0 // indirect
github.com/google/go-querystring v1.0.0 // indirect
github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/spf13/pflag v1.0.6 // indirect
github.com/stretchr/testify v1.10.0 // indirect
github.com/tcnksm/go-gitconfig v0.1.2 // indirect
github.com/tklauser/go-sysconf v0.3.15 // indirect