Update App version to 0.0.4

Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
This commit is contained in:
luckfox-eng29
2025-11-11 20:38:22 +08:00
parent 4e82b8a11c
commit 5e17c52afc
41 changed files with 3537 additions and 598 deletions

View File

@@ -1,11 +1,13 @@
package network
import (
"fmt"
"time"
"fmt"
"time"
"kvm/internal/confparser"
"kvm/internal/udhcpc"
"kvm/internal/confparser"
"kvm/internal/udhcpc"
"github.com/guregu/null/v6"
)
type RpcIPv6Address struct {
@@ -99,17 +101,22 @@ func (s *NetworkInterfaceState) RpcGetNetworkSettings() RpcNetworkSettings {
}
func (s *NetworkInterfaceState) RpcSetNetworkSettings(settings RpcNetworkSettings) error {
currentSettings := s.config
currentSettings := s.config
err := confparser.SetDefaultsAndValidate(&settings.NetworkConfig)
if err != nil {
return err
}
err := confparser.SetDefaultsAndValidate(&settings.NetworkConfig)
if err != nil {
return err
}
if IsSame(currentSettings, settings.NetworkConfig) {
// no changes, do nothing
return nil
}
neutralA := *currentSettings
neutralB := settings.NetworkConfig
neutralA.PendingReboot = null.Bool{}
neutralB.PendingReboot = null.Bool{}
if IsSame(neutralA, neutralB) {
// no changes, do nothing
return nil
}
s.config = &settings.NetworkConfig
s.onConfigChange(s.config)
@@ -124,3 +131,10 @@ func (s *NetworkInterfaceState) RpcRenewDHCPLease() error {
return s.dhcpClient.Renew()
}
func (s *NetworkInterfaceState) RpcRequestDHCPAddress(ip string) error {
if s.dhcpClient == nil {
return fmt.Errorf("dhcp client not initialized")
}
return s.dhcpClient.RequestAddress(ip)
}