fix: resolve critical bugs and refactor code structure

P0 Fixes:
- Fix potential panic in factory.go due to unsafe type assertion
- Fix VIP CIDR mask being lost during parsing (was hardcoded to /32)

P1 Fixes:
- Fix go.mod incorrect indirect dependency markers
- Fix receiveLoop blocking issue preventing graceful shutdown

Refactoring:
- Split state.go into state.go, timer.go, priority.go, history.go
- Split monitor.go into monitor.go and manager.go
- Add IncreasePriority() method for complete priority adjustment
- Fix go vet format string warning in test.go

🤖 Generated with [Qoder][https://qoder.com]
This commit is contained in:
loveuer
2026-03-04 00:14:47 -08:00
parent 894ddb53d3
commit 94c1c81ee0
12 changed files with 412 additions and 290 deletions

15
go.mod
View File

@@ -1,20 +1,23 @@
module github.com/loveuer/go-alived
go 1.25.0
go 1.24.0
require (
github.com/mdlayher/arp v0.0.0-20220512170110-6706a2966875
github.com/spf13/cobra v1.10.2
github.com/vishvananda/netlink v1.3.1
golang.org/x/net v0.47.0
gopkg.in/yaml.v3 v3.0.1
)
require (
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/josharian/native v1.0.0 // indirect
github.com/mdlayher/arp v0.0.0-20220512170110-6706a2966875 // indirect
github.com/mdlayher/ethernet v0.0.0-20220221185849-529eae5b6118 // indirect
github.com/mdlayher/packet v1.0.0 // indirect
github.com/mdlayher/socket v0.2.1 // indirect
github.com/spf13/cobra v1.10.2 // indirect
github.com/spf13/pflag v1.0.9 // indirect
github.com/vishvananda/netlink v1.3.1 // indirect
github.com/vishvananda/netns v0.0.5 // indirect
golang.org/x/net v0.47.0 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.38.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)