Skip to content

Commit b19bd35

Browse files
committed
refactor(utility): 将IP地址属性重命名为主机地址属性
将InnerIp和OuterIp属性重命名为InnerHost和OuterHost,使其更准确地反映实际用途 更新相关引用代码以保持一致性
1 parent 6a85921 commit b19bd35

File tree

6 files changed

+51
-51
lines changed

6 files changed

+51
-51
lines changed

GameFrameX.DiscoveryCenterManager/Server/NamingServiceManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public void AddSelf(AppSetting setting)
252252
return;
253253
}
254254

255-
SelfServiceInfo = new ServiceInfo(setting.ServerType, null, string.Empty, setting.ServerName, setting.ServerId, setting.ServerInstanceId, setting.InnerIp, setting.InnerPort, setting.OuterIp, setting.OuterPort);
255+
SelfServiceInfo = new ServiceInfo(setting.ServerType, null, string.Empty, setting.ServerName, setting.ServerId, setting.ServerInstanceId, setting.InnerHost, setting.InnerPort, setting.OuterHost, setting.OuterPort);
256256
_serverMap[SelfServiceInfo.ServerId] = [SelfServiceInfo,];
257257
}
258258

GameFrameX.Hotfix/StartUp/AppStartUpHotfixGameByDiscoveryCenter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ protected override void GameAppClientOnConnected()
4545
ServerName = Setting.ServerName,
4646
ServerType = Setting.ServerType,
4747
ServerInstanceId = Setting.ServerInstanceId,
48-
InnerHost = Setting.InnerIp,
48+
InnerHost = Setting.InnerHost,
4949
InnerPort = Setting.InnerPort,
50-
OuterHost = Setting.OuterIp,
50+
OuterHost = Setting.OuterHost,
5151
OuterPort = Setting.OuterPort,
5252
};
5353
Send(reqRegisterServer);

GameFrameX.StartUp/AppStartUpByServer.cs

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
// ==========================================================================================
2-
// GameFrameX 组织及其衍生项目的版权、商标、专利及其他相关权利
3-
// GameFrameX organization and its derivative projects' copyrights, trademarks, patents, and related rights
4-
// 均受中华人民共和国及相关国际法律法规保护。
5-
// are protected by the laws of the People's Republic of China and relevant international regulations.
6-
//
7-
// 使用本项目须严格遵守相应法律法规及开源许可证之规定。
8-
// Usage of this project must strictly comply with applicable laws, regulations, and open-source licenses.
9-
//
10-
// 本项目采用 MIT 许可证与 Apache License 2.0 双许可证分发,
11-
// This project is dual-licensed under the MIT License and Apache License 2.0,
12-
// 完整许可证文本请参见源代码根目录下的 LICENSE 文件。
13-
// please refer to the LICENSE file in the root directory of the source code for the full license text.
14-
//
15-
// 禁止利用本项目实施任何危害国家安全、破坏社会秩序、
16-
// It is prohibited to use this project to engage in any activities that endanger national security, disrupt social order,
17-
// 侵犯他人合法权益等法律法规所禁止的行为!
18-
// or infringe upon the legitimate rights and interests of others, as prohibited by laws and regulations!
19-
// 因基于本项目二次开发所产生的一切法律纠纷与责任,
20-
// Any legal disputes and liabilities arising from secondary development based on this project
21-
// 本项目组织与贡献者概不承担。
22-
// shall be borne solely by the developer; the project organization and contributors assume no responsibility.
23-
//
24-
// GitHub 仓库:https://github.com/GameFrameX
25-
// GitHub Repository: https://github.com/GameFrameX
26-
// Gitee 仓库:https://gitee.com/GameFrameX
27-
// Gitee Repository: https://gitee.com/GameFrameX
28-
// 官方文档:https://gameframex.doc.alianblank.com/
29-
// Official Documentation: https://gameframex.doc.alianblank.com/
30-
// ==========================================================================================
31-
1+
// ==========================================================================================
2+
// GameFrameX 组织及其衍生项目的版权、商标、专利及其他相关权利
3+
// GameFrameX organization and its derivative projects' copyrights, trademarks, patents, and related rights
4+
// 均受中华人民共和国及相关国际法律法规保护。
5+
// are protected by the laws of the People's Republic of China and relevant international regulations.
6+
//
7+
// 使用本项目须严格遵守相应法律法规及开源许可证之规定。
8+
// Usage of this project must strictly comply with applicable laws, regulations, and open-source licenses.
9+
//
10+
// 本项目采用 MIT 许可证与 Apache License 2.0 双许可证分发,
11+
// This project is dual-licensed under the MIT License and Apache License 2.0,
12+
// 完整许可证文本请参见源代码根目录下的 LICENSE 文件。
13+
// please refer to the LICENSE file in the root directory of the source code for the full license text.
14+
//
15+
// 禁止利用本项目实施任何危害国家安全、破坏社会秩序、
16+
// It is prohibited to use this project to engage in any activities that endanger national security, disrupt social order,
17+
// 侵犯他人合法权益等法律法规所禁止的行为!
18+
// or infringe upon the legitimate rights and interests of others, as prohibited by laws and regulations!
19+
// 因基于本项目二次开发所产生的一切法律纠纷与责任,
20+
// Any legal disputes and liabilities arising from secondary development based on this project
21+
// 本项目组织与贡献者概不承担。
22+
// shall be borne solely by the developer; the project organization and contributors assume no responsibility.
23+
//
24+
// GitHub 仓库:https://github.com/GameFrameX
25+
// GitHub Repository: https://github.com/GameFrameX
26+
// Gitee 仓库:https://gitee.com/GameFrameX
27+
// Gitee Repository: https://gitee.com/GameFrameX
28+
// 官方文档:https://gameframex.doc.alianblank.com/
29+
// Official Documentation: https://gameframex.doc.alianblank.com/
30+
// ==========================================================================================
31+
3232
using System.Reflection;
3333
using GameFrameX.Foundation.Extensions;
3434
using GameFrameX.Foundation.Logger;
@@ -207,7 +207,7 @@ private async Task StartServer(List<BaseHttpHandler> baseHandler, Func<string, B
207207
// 检查TCP端口是否可用
208208
if (Setting.InnerPort > 0 && NetHelper.PortIsAvailable(Setting.InnerPort))
209209
{
210-
LogHelper.InfoConsole($"启动 [TCP] 服务器 - 类型: {ServerType}, 地址: {Setting.InnerIp}, 端口: {Setting.InnerPort}");
210+
LogHelper.InfoConsole($"启动 [TCP] 服务器 - 类型: {ServerType}, 地址: {Setting.InnerHost}, 端口: {Setting.InnerPort}");
211211
multipleServerHostBuilder.AddServer<IMessage, MessageObjectPipelineFilter>(builder =>
212212
{
213213
builder
@@ -236,11 +236,11 @@ private async Task StartServer(List<BaseHttpHandler> baseHandler, Func<string, B
236236
// }
237237
});
238238
});
239-
LogHelper.InfoConsole($"启动 [TCP] 服务器启动完成 - 类型: {ServerType}, 地址: {Setting.InnerIp}, 端口: {Setting.InnerPort}");
239+
LogHelper.InfoConsole($"启动 [TCP] 服务器启动完成 - 类型: {ServerType}, 地址: {Setting.InnerHost}, 端口: {Setting.InnerPort}");
240240
}
241241
else
242242
{
243-
LogHelper.WarningConsole($"启动 [TCP] 服务器启动失败 - 类型: {ServerType}, 地址: {Setting.InnerIp}, 端口: {Setting.InnerPort}, 原因: 端口无效或已被占用");
243+
LogHelper.WarningConsole($"启动 [TCP] 服务器启动失败 - 类型: {ServerType}, 地址: {Setting.InnerHost}, 端口: {Setting.InnerPort}, 原因: 端口无效或已被占用");
244244
}
245245

246246
// 检查WebSocket端口是否可用

GameFrameX.StartUp/Options/LauncherOptions.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -255,12 +255,12 @@ public sealed class LauncherOptions
255255
public int ActorRecycleTime { get; set; } = 15;
256256

257257
/// <summary>
258-
/// 内部IP
258+
/// 内部主机地址
259259
/// </summary>
260-
[Option(nameof(InnerIp), Description = "内部IP")]
260+
[Option(nameof(InnerHost), Description = "内部IP")]
261261
[DefaultValue("0.0.0.0")]
262262
// [GrafanaLokiLabelTag]
263-
public string InnerIp { get; set; }
263+
public string InnerHost { get; set; }
264264

265265
/// <summary>
266266
/// 内部端口
@@ -270,12 +270,12 @@ public sealed class LauncherOptions
270270
public ushort InnerPort { get; set; }
271271

272272
/// <summary>
273-
/// 外部IP
273+
/// 外部主机地址
274274
/// </summary>
275-
[Option(nameof(OuterIp), Description = "外部IP")]
275+
[Option(nameof(OuterHost), Description = "外部IP")]
276276
[DefaultValue("0.0.0.0")]
277277
// [GrafanaLokiLabelTag]
278-
public string OuterIp { get; set; }
278+
public string OuterHost { get; set; }
279279

280280
/// <summary>
281281
/// 外部端口

GameFrameX.Utility/Setting/AppSetting.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,9 @@ public string ToFormatString()
265265
public int ActorQueueTimeOut { get; set; } = 30_000;
266266

267267
/// <summary>
268-
/// 内部IP地址
268+
/// 内部主机地址
269269
/// </summary>
270-
public string InnerIp { get; set; }
270+
public string InnerHost { get; set; }
271271

272272
/// <summary>
273273
/// 内部端口
@@ -280,9 +280,9 @@ public string ToFormatString()
280280
public ushort WorkerId { get; set; }
281281

282282
/// <summary>
283-
/// 外部IP地址
283+
/// 外部主机地址
284284
/// </summary>
285-
public string OuterIp { get; set; }
285+
public string OuterHost { get; set; }
286286

287287
/// <summary>
288288
/// 外部端口

Tests/GameFrameX.Tests/Utility/AppSettingTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,9 +375,9 @@ public void NetworkAndPortProperties_CanBeSet_ShouldUpdateValues()
375375
var appSetting = new AppSetting();
376376

377377
// Act
378-
appSetting.InnerIp = "192.168.1.100";
378+
appSetting.InnerHost = "192.168.1.100";
379379
appSetting.InnerPort = 8080;
380-
appSetting.OuterIp = "203.0.113.1";
380+
appSetting.OuterHost = "203.0.113.1";
381381
appSetting.OuterPort = 9090;
382382
appSetting.HttpUrl = "http://localhost:8080";
383383
appSetting.HttpIsDevelopment = true;
@@ -389,9 +389,9 @@ public void NetworkAndPortProperties_CanBeSet_ShouldUpdateValues()
389389
appSetting.WssCertFilePath = "/path/to/cert.pem";
390390

391391
// Assert
392-
Assert.Equal("192.168.1.100", appSetting.InnerIp);
392+
Assert.Equal("192.168.1.100", appSetting.InnerHost);
393393
Assert.Equal((ushort)8080, appSetting.InnerPort);
394-
Assert.Equal("203.0.113.1", appSetting.OuterIp);
394+
Assert.Equal("203.0.113.1", appSetting.OuterHost);
395395
Assert.Equal((ushort)9090, appSetting.OuterPort);
396396
Assert.Equal("http://localhost:8080", appSetting.HttpUrl);
397397
Assert.True(appSetting.HttpIsDevelopment);

0 commit comments

Comments
 (0)