Enhance Network Interface Detection and Configuration Management

- Implemented robust network interface detection with `GetInterfaces()` function
- Added validation for network interface names using regex patterns
- Updated `Network` struct to improve YAML tag formatting
- Modified `Gather()` and `SaveConfig()` methods to streamline network configuration
- Removed redundant `SaveConfig()` calls in various methods
- Added comprehensive network interface name validation logic
This commit is contained in:
zeaslity
2025-02-28 11:19:29 +08:00
parent c10554c218
commit b28c6462f1
5 changed files with 106 additions and 7 deletions

View File

@@ -2,6 +2,7 @@ package cmd
import (
"agent-wdd/config"
"github.com/spf13/cobra"
)
@@ -26,6 +27,7 @@ func addInfoSubcommands(cmd *cobra.Command) {
Run: func(cmd *cobra.Command, args []string) {
network := config.ConfigCache.Agent.Network
network.Gather()
network.SaveConfig()
},
}