Преглед изворни кода

chore(release): 更新版本号并修复空集合初始化

- 更新服务端与客户端版本至 2026.07.27.1520
- 修复配置读取时 Addresses/Routes/DNS 为 nil 的问题
- 优化 C# 模型中 EffectiveAddresses/Routes 的空值判断
yangkaixiang пре 1 недеља
родитељ
комит
e107f4bbed

+ 1 - 1
server/internal/config/config.go

@@ -6,7 +6,7 @@ import (
 	"net"
 )
 
-const ServerVersion = "2026.05.15.1732"
+const ServerVersion = "2026.07.27.1520"
 
 type Config struct {
 	HTTPHost         string

+ 9 - 0
server/internal/network/configreader/configreader.go

@@ -57,6 +57,15 @@ func (s *Service) Read(interfaceName string) (model.InterfaceConfig, error) {
 			break
 		}
 	}
+	if config.Addresses == nil {
+		config.Addresses = []model.InterfaceAddressConfig{}
+	}
+	if config.Routes == nil {
+		config.Routes = []model.InterfaceRouteConfig{}
+	}
+	if config.DNS == nil {
+		config.DNS = []string{}
+	}
 	return config, nil
 }
 

+ 2 - 2
windows/NetTool.Client/Models/RemoteInterfaceConfig.cs

@@ -50,12 +50,12 @@ public sealed class RemoteInterfaceConfig
     public string DnsSummary => Dns is null || Dns.Count == 0 ? "无" : string.Join(Environment.NewLine, Dns);
 
     [JsonIgnore]
-    public IReadOnlyList<RemoteInterfaceAddressConfig> EffectiveAddresses => Addresses.Count > 0
+    public IReadOnlyList<RemoteInterfaceAddressConfig> EffectiveAddresses => Addresses is { Count: > 0 }
         ? Addresses
         : string.IsNullOrWhiteSpace(IP) ? [] : [new RemoteInterfaceAddressConfig { IP = IP, Prefix = Prefix }];
 
     [JsonIgnore]
-    public IReadOnlyList<RemoteInterfaceRouteConfig> EffectiveRoutes => Routes.Count > 0
+    public IReadOnlyList<RemoteInterfaceRouteConfig> EffectiveRoutes => Routes is { Count: > 0 }
         ? Routes
         : string.IsNullOrWhiteSpace(Gateway) ? [] : [new RemoteInterfaceRouteConfig { To = "default", Via = Gateway }];
 }

+ 1 - 1
windows/NetTool.Client/NetTool.Client.csproj

@@ -8,7 +8,7 @@
     <UseWPF>true</UseWPF>
     <AssemblyName>NetTool.Client</AssemblyName>
     <RootNamespace>NetTool.Client</RootNamespace>
-    <InformationalVersion>2026.05.15.1906</InformationalVersion>
+    <InformationalVersion>2026.07.27.1520</InformationalVersion>
   </PropertyGroup>
 
 </Project>