Skip to content

Commit 182fe93

Browse files
authored
Hotfix about recent added features (#32)
* Output kcp status to `latest.player.stat.log` (category: `kcp`) * Fixed the issue that powershell scripts don't work * Fixed the issue that `windy` command execute too fast when using `GetPlayerTokenFinish` auto execute * Fixed the issue that `kick` command don't work with any UID * Return special prompt when user is trying to connect with invalid RSA key * Fixed the issue that Benchmark don't work * Sort json for Protobuf Util output * Change SkilIssueDetect's output to player.stat.log * Make scripts `cd` to the original directory after running
1 parent 75e3468 commit 182fe93

28 files changed

+185
-87
lines changed

.github/ISSUE_TEMPLATE/1_server_issue.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ Note: Asking in English can make your problem more widely known by the community
3333
- [ ] I have browsed various Issue templates and confirmed that the current template is suitable for my problem
3434
- [ ] I confirm that the issue I raised is related to the Protoshift server itself (and not dependent on other factors)
3535
- [ ] I have run the building process properly
36-
- [ ] I have attached necessary log records in the issue (you can also send them to `mihomo-technology@outlook.com`, making it disclosed after removing sensitive information). I also attached the necessary content of `latest.errtrace.log` (if an exception occurs).
37-
- [ ] I confirm that I have not included `latest.packet.log` in the main body of the issue, or it has removed `GetPlayerTokenReq(Rsp)`, `PlayerLoginReq(Rsp)` (to avoid leaking private information).
36+
- [ ] I have attached necessary log records in the issue (you can also send them to `mihomo-technology@outlook.com`, making it disclosed after removing sensitive information). I also attached the necessary content of `latest.errtrace.log` (if an exception occurs)
37+
- [ ] I confirm that the logs I have included in the body of the issue are not leaking my private information
3838
- [ ] I confirm that the phenomenon is unrelated to the defects of my server (the real game server)
3939
- [ ] **I am not running the server on any version of macOS, nor am I running the game client on iOS**
4040

@@ -63,7 +63,7 @@ Note: Asking in English can make your problem more widely known by the community
6363
- [ ] 我已浏览过多种 Issue 模板并确认当前模板适合我的问题
6464
- [ ] 我确认提出的 issue 与 Protoshift 服务器本身有关(而不取决于其他因素)
6565
- [ ] 我正确运行了生成
66-
- [ ] 我已在 issue 中附带必要的日志记录(也可发送至 `mihomo-technology@outlook.com`,去除敏感信息后的部分将被公开)。我还附带了 `latest.errtrace.log` 的必要内容(如果有发生异常)
67-
- [ ] 我确认没有将 `latest.packet.log` 包含在 issue 主体中,或其去除了 `GetPlayerTokenReq(Rsp)`, `PlayerLoginReq(Rsp)`(以避免泄露隐私信息)。
66+
- [ ] 我已在 issue 中附带必要的日志记录(也可发送至 `mihomo-technology@outlook.com`,去除敏感信息后的部分将被公开)。我还附带了 `latest.errtrace.log` 的必要内容(如果有发生异常)
67+
- [ ] 我确认在 issue 主体中附带的日志没有泄露隐私信息
6868
- [ ] 我确认现象与我的服务器(真正的游戏服务器)的本身缺陷无关
6969
- [ ] **我并非在 macOS 的任何版本上运行服务器,也并非在 iOS 上运行游戏客户端**

.github/ISSUE_TEMPLATE/2_windy_issue.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Note: Asking in English can make your problem more widely known by the community
3232
- [ ] I have browsed various Issue templates and confirmed that the current template is suitable for my problem
3333
- [ ] I confirm that the issue I raised is related to Windy (and not dependent on other factors)
3434
- [ ] I have attached necessary log records in the issue (you can also send them to `mihomo-technology@outlook.com`, making it disclosed after removing sensitive information). I also attached the necessary content of `latest.errtrace.log` (if an exception occurs).
35-
- [ ] I used [the luac compiler provided in the repository](https://github.com/YYHEggEgg/csharp-Protoshift/tree/main/csharp-Protoshift/resources/luac_bins) or a compiler that can be proven to be compatible with the anime game
35+
- [ ] I used [the luac compiler provided in the repository](https://github.com/YYHEggEgg/csharp-Protoshift/tree/main/csharp-Protoshift/resources/luac_bins) or another compiler that can be proven to be compatible with the anime game
3636
- [ ] I confirm that the lua script itself complies with `Lua 5.3.5` syntax, and does not include operations that `xlua` may prohibit, such as reading files (required by import modules)
3737
- [ ] **I am not running the server on any version of macOS, nor am I running the game client on iOS**
3838

@@ -64,6 +64,6 @@ Note: Asking in English can make your problem more widely known by the community
6464
- [ ] 我已浏览过多种 Issue 模板并确认当前模板适合我的问题
6565
- [ ] 我确认提出的 issue 与 Windy 有关(而不取决于其他因素)
6666
- [ ] 我已在 issue 中附带必要的日志记录(也可发送至 `mihomo-technology@outlook.com`,去除敏感信息后的部分将被公开)。我还附带了 `latest.errtrace.log` 的必要内容(如果有发生异常)。
67-
- [ ] 我使用 [存储库中打包提供的 luac 编译器](https://github.com/YYHEggEgg/csharp-Protoshift/tree/main/csharp-Protoshift/resources/luac_bins) 或可证明与某二游相兼容的编译器
67+
- [ ] 我使用 [存储库中打包提供的 luac 编译器](https://github.com/YYHEggEgg/csharp-Protoshift/tree/main/csharp-Protoshift/resources/luac_bins) 或可证明与某二游相兼容的其他编译器
6868
- [ ] 我确认 lua 脚本本身符合 `Lua 5.3.5` 的语法,并且不包含读取文件(如 import 模块)等 `xlua` 可能禁止的操作
6969
- [ ] **我并非在 macOS 的任何版本上运行服务器,也并非在 iOS 上运行游戏客户端**

.github/ISSUE_TEMPLATE/4_skill_issue.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Note: Asking in English can make your problem more widely known by the community
3838
- [ ] I have browsed various Issue templates and confirmed that the current template is suitable for my problem
3939
- [ ] I am using the Protobuf provided by the official build and ran the generation correctly
4040
- [ ] I have attached necessary log records in the issue (you can also send them to `mihomo-technology@outlook.com`, making it disclosed after removing sensitive information). I also attached the necessary content of `latest.errtrace.log` (if an exception occurs in the log).
41-
- [ ] I confirm that I have not included `latest.packet.log` in the main body of the issue, or it has removed `GetPlayerTokenReq(Rsp)`, `PlayerLoginReq(Rsp)` (to avoid leaking private information).
41+
- [ ] I confirm that the logs I have included in the body of the issue are not leaking my private information
4242
- [ ] I confirm that the phenomenon is unrelated to the defects of my server (the real game server)
4343
- [ ] I confirm that the phenomenon can be removed from any external factors (such as Windy, cheats, specific GM commands, or custom server data), or I have publicly disclosed these external deployment methods in the main body of the issue
4444
- [ ] **I am not running the server on any version of macOS, nor am I running the game client on iOS**
@@ -72,8 +72,8 @@ Note: Asking in English can make your problem more widely known by the community
7272
- [ ] 我已在 issue 区寻找过相关的问题但未得到解决
7373
- [ ] 我已浏览过多种 Issue 模板并确认当前模板适合我的问题
7474
- [ ] 我正使用官方 build 提供的 Protobuf 并且正确运行了生成
75-
- [ ] 我已在 issue 中附带必要的日志记录也可发送至 `mihomo-technology@outlook.com`,去除敏感信息后的部分将被公开)。我还附带了 `latest.errtrace.log` 的必要内容(如果日志中有发生异常)。
76-
- [ ] 我确认没有将 `latest.packet.log` 包含在 issue 主体中,或其去除了 `GetPlayerTokenReq(Rsp)`, `PlayerLoginReq(Rsp)`(以避免泄露隐私信息)。
75+
- [ ] 我已在 issue 中附带必要的日志记录(也可发送至 `mihomo-technology@outlook.com`,去除敏感信息后的部分将被公开)。我还附带了 `latest.errtrace.log` 的必要内容(如果日志中有发生异常)。
76+
- [ ] 我确认在 issue 主体中附带的日志没有泄露隐私信息
7777
- [ ] 我确认现象与我的服务器(真正的游戏服务器)的本身缺陷无关
7878
- [ ] 我确认现象可以在去除任何外置因素(如 Windy、外挂、特定 GM 命令、或定制版服务器等),或我已在 issue 主体中公开这些外置与部署方法
7979
- [ ] **我并非在 macOS 的任何版本上运行服务器,也并非在 iOS 上运行游戏客户端**

.github/ISSUE_TEMPLATE/5_optimition_request.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ Note: Asking in English can make your problem more widely known by the community
2121
## Requested Optimization Scheme
2222

2323
- [ ] I have a feasible plan for optimizing the maintainability of the existing code
24-
- [ ] I want to make Protoshift or HandlerGenerator support new features to make it easier to use
25-
- [ ] I believe that the Protoshift server needs and can perform JIT compilation of all Handlers at startup
26-
- [ ] I want to contribute to text localization solutions
24+
- [ ] I want to make Protoshift or HandlerGenerator (builder) support new features to make it easier to use
2725
- [ ] I want Windy to automatically run with more complex logic
2826
- [ ] I intend to promote smarter UDP packet (KCP handshake packet) forwarding, rate control and other network optimization schemes
2927
- [ ] I believe that ProtoHotPatch can introduce more complex process control (such as directly introducing external processing code at runtime) or relax restrictions (the existing restriction is that only Protos with unrecognized fields can perform ProtoHotPatch)
@@ -35,7 +33,6 @@ Note: Asking in English can make your problem more widely known by the community
3533

3634
- [ ] I have browsed various Issue templates and confirmed that the current template is suitable for my problem
3735
- [ ] I confirm that the requirement is an improvement rather than a bug fix
38-
- [ ] I confirm that it will not reduce the availability of the Protoshift server
3936
- [ ] I confirm that the phenomenon can be removed from any external factors (such as Windy, cheats, specific GM commands, or custom server data), or I have publicly disclosed these external and deployment methods in the main body of the issue
4037
- [ ] If the text proposes a specific implementation, I confirm that it can be used cross-platform
4138

@@ -52,9 +49,7 @@ Note: Asking in English can make your problem more widely known by the community
5249
## 请求的优化方案
5350

5451
- [ ] 我有对于现有代码可维护性优化的可行方案
55-
- [ ] 我想使 Protoshift 或 HandlerGenerator 支持新功能以使其更易于使用
56-
- [ ] 我认为 Protoshift 服务器有必要并且可以做到在启动时执行全部 Handler 的 JIT 编译
57-
- [ ] 我想贡献文本本地化方案
52+
- [ ] 我想使 Protoshift 或 HandlerGenerator(构建程序)支持新功能以使其更易于使用
5853
- [ ] 我想要 Windy 自动化运行带有更复杂的逻辑
5954
- [ ] 我意图推行更智能的 UDP 包(KCP 握手包)转发、速率控制等网络优化方案
6055
- [ ] 我认为 ProtoHotPatch 可以引入更复杂的流程控制(例如直接运行时引入外部处理代码)或放宽限制(现有限制为只有具有未识别字段的 Proto 才可进行 ProtoHotPatch)
@@ -66,6 +61,5 @@ Note: Asking in English can make your problem more widely known by the community
6661

6762
- [ ] 我已浏览过多种 Issue 模板并确认当前模板适合我的问题
6863
- [ ] 我确认需求的是一个改进而不是一种针对 bug 的修复
69-
- [ ] 我确认其不会降低 Protoshift 服务器的可用性
7064
- [ ] 我确认现象可以在去除任何外置因素(如 Windy、外挂、特定 GM 命令、或定制版服务器等),或我已在 issue 主体中公开这些外置与部署方法
7165
- [ ] 如果正文提出了具体实现,我确认其可以跨平台使用

.github/ISSUE_TEMPLATE/6_other_issues.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ Note: Asking in English can make your problem more widely known by the community
2727

2828
- [ ] I have searched for related issues in the issue area but have not resolved them
2929
- [ ] I have browsed various Issue templates and confirmed that the current template is suitable for my problem
30-
- [ ] I am using the Protobuf provided by the official build and ran the generation correctly
30+
- [ ] I am using the default Protobuf source and ran the build correctly
3131
- [ ] I have attached necessary log records in the issue (you can also send them to `mihomo-technology@outlook.com`, making it disclosed after removing sensitive information). I also attached the necessary content of `latest.errtrace.log` (if an exception occurs in the log).
32-
- [ ] I confirm that I have not included `latest.packet.log` in the main body of the issue, or it has removed `GetPlayerTokenReq(Rsp)`, `PlayerLoginReq(Rsp)` (to avoid leaking private information).
32+
- [ ] I confirm that the logs I have included in the body of the issue are not leaking my private information
3333
- [ ] I confirm that the phenomenon is unrelated to the defects of my server (the real game server)
3434
- [ ] I confirm that the phenomenon can be removed from any external factors (such as Windy, cheats, specific GM commands, or custom server data), or I have publicly disclosed these external and deployment methods in the main body of the issue
3535
- [ ] **I am not running the server on any version of macOS, nor am I running the game client on iOS**
@@ -55,9 +55,9 @@ Note: Asking in English can make your problem more widely known by the community
5555

5656
- [ ] 我已在 issue 区寻找过相关的问题但未得到解决
5757
- [ ] 我已浏览过多种 Issue 模板并确认当前模板适合我的问题
58-
- [ ] 我正使用官方 build 提供的 Protobuf 并且正确运行了生成
58+
- [ ] 我正使用默认提供的 Protobuf 并且正确运行了构建
5959
- [ ] 我已在 issue 中附带必要的日志记录(也可发送至 `mihomo-technology@outlook.com`,去除敏感信息后的部分将被公开)。我还附带了 `latest.errtrace.log` 的必要内容(如果日志中有发生异常)。
60-
- [ ] 我确认没有将 `latest.packet.log` 包含在 issue 主体中,或其去除了 `GetPlayerTokenReq(Rsp)`, `PlayerLoginReq(Rsp)`(以避免泄露隐私信息)。
60+
- [ ] 我确认在 issue 主体中附带的日志没有泄露隐私信息
6161
- [ ] 我确认现象与我的服务器(真正的游戏服务器)的本身缺陷无关
6262
- [ ] 我确认现象可以在去除任何外置因素(如 Windy、外挂、特定 GM 命令、或定制版服务器等),或我已在 issue 主体中公开这些外置与部署方法
6363
- [ ] **我并非在 macOS 的任何版本上运行服务器,也并非在 iOS 上运行游戏客户端**

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ contact_links:
66
- name: Fix Proto skill issue
77
about: Create a pull request to the outer protos repo
88
url: https://github.com/YYHEggEgg/mihomo-protos/pulls
9-
- name: FAQs and help
9+
- name: Get basic FAQs and Using Practices
10+
about: Visit our official blog
11+
url: https://yyheggegg.github.io/mihomo-gio-blogs/
12+
- name: Ask for help
1013
about: Join Discord to get more information
1114
url: https://discord.gg/3XkT93zsNy
12-
- name: Get Using Practices
13-
about: Join Discord to get more information
14-
url: https://discord.gg/NcAjuCSFvZ

Tests/ProtoshiftBenchmark/Program.cs

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using BenchmarkDotNet.Reports;
66
using BenchmarkDotNet.Running;
77
using CommandLine;
8+
using csharp_Protoshift.Configuration;
89
using csharp_Protoshift.GameSession;
910
using Microsoft.CodeAnalysis.CSharp.Syntax;
1011
using System.Text;
@@ -33,11 +34,12 @@ private static void Main(string[] args)
3334
File.Move(benchmark_source_file_shared,
3435
$"logs/{DateTime.Now:yyyy-MM-dd_HH-mm-ss}.{benchmark_source_file_suffix}");
3536
}
36-
var parser_args = new Parser(config =>
37-
{
37+
var parser_args = Parser.Default;
38+
//new Parser(config =>
39+
// {
3840
// Set custom ConsoleWriter during construction
39-
config.HelpWriter = TextWriter.Synchronized(new LogTextWriter("CommandLineParser"));
40-
});
41+
// config.HelpWriter = TextWriter.Synchronized(new LogTextWriter("CommandLineParser"));
42+
// });
4143
BenchmarkOptions global_opt = new BenchmarkOptions();
4244
parser_args.ParseArguments<BenchmarkOptions>(args)
4345
.WithNotParsed(errs =>
@@ -55,7 +57,12 @@ private static void Main(string[] args)
5557
}
5658
if (sourcefile == null) throw new Exception("im tired plz give a file ok?");
5759
SetUpBenchmarkSource(sourcefile, global_opt);
58-
new Program().GetBenchmarkArguments();
60+
61+
// Set up and test-run
62+
var instance = new Program();
63+
var runs = instance.GetBenchmarkArguments();
64+
if (runs.Any())
65+
instance.ProtoshiftBenchmark(runs.First());
5966

6067
BenchmarkRunner.Run<Program>(
6168
ManualConfig
@@ -86,6 +93,9 @@ static Program()
8693
}
8794
curdir = Directory.GetParent(curdir)?.FullName ?? throw new FileNotFoundException("csproj file not found!");
8895
}
96+
97+
Config.InitializeAsync($"{curdir}/../../csharp-Protoshift/config.json").Wait();
98+
worker = new(1001);
8999
}
90100

91101
public const char separateChar = PacketRecord.separateChar;
@@ -96,9 +106,9 @@ public class BenchmarkOptions
96106
[Option("minimum-packet-length", Required = false, Default = 1, HelpText =
97107
"The minimum packet length that can be included in the benchmark.")]
98108
public int MinimumPacketLength { get; set; }
99-
[Option("single-proto", Required = false, Default = null, HelpText =
100-
"Give this param to benchmark on only one specified packet proto.")]
101-
public string? TestSingleProto { get; set; }
109+
[Option("proto-filters", Required = false, Default = null, HelpText =
110+
"Give the params to benchmark on only the specified packet protos.")]
111+
public IEnumerable<string>? ProtoFilters { get; set; }
102112
[Option("each-proto-packet-limit", Required = false, Default = 1, HelpText =
103113
"How many packets that will be selected for each proto. " +
104114
"If running without --single-proto, just leave it default.")]
@@ -144,19 +154,20 @@ public static void SetUpBenchmarkSource(string sourcefile, BenchmarkOptions opt)
144154
ushort cmdid = ushort.Parse(values[4]);
145155
bool sentByClient = bool.Parse(values[5]);
146156
byte[] data = Convert.FromBase64String(values[7]);
147-
Int64 handlenanosec = Int64.Parse(values[9]);
157+
Int64 handlenanosec = Int64.Parse(values[8]);
148158
readres.Add((protoname, cmdid, sentByClient, data, i, handlenanosec));
149159
}
150160
}
151161

162+
HashSet<string> proto_filters = new(opt.ProtoFilters ?? Enumerable.Empty<string>());
152163
IEnumerable<IGrouping<string, (string protoname, ushort cmdid, bool sentByClient, byte[] body, int line_id, Int64 handlenanosec)>> select_res;
153164

154165
select_res =
155166
from record in readres
156167
orderby (opt.OrderByPacketTime ? record.handlenanosec : record.body.Length) descending
157168
orderby record.body.Length descending
158169
group record by record.protoname into gr
159-
where opt.TestSingleProto == null || gr.Key == opt.TestSingleProto
170+
where opt.ProtoFilters == null || proto_filters.Contains(gr.Key)
160171
select gr;
161172
StringBuilder sb = new();
162173
foreach (var proto_gr in select_res)
@@ -216,7 +227,7 @@ public override string ToString()
216227
}
217228
}
218229

219-
public static HandlerSession worker = new(1001);
230+
public static HandlerSession worker;
220231

221232
[Benchmark]
222233
[ArgumentsSource(nameof(GetBenchmarkArguments))]

Tests/run-benchmark.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
cd ProtoshiftBenchmark
2-
dotnet run --configuration Release --property:DefineConstants=TRACE%3bRELEASE%3bNET%3bNET6_0%3bNETCOREAPP%3bMIHOMO_KCP%3bPROTOSHIFT_BENCHMARK -- --extra-property "DefineConstants=TRACE%3bRELEASE%3bNET%3bNET6_0%3bNETCOREAPP%3bMIHOMO_KCP%3bPROTOSHIFT_BENCHMARK" $args
2+
dotnet run --configuration Release --property:DefineConstants=TRACE%3bRELEASE%3bNET%3bNET6_0%3bNETCOREAPP%3bMIHOMO_KCP%3bPROTOSHIFT_BENCHMARK -- --extra-property "DefineConstants=TRACE%3bRELEASE%3bNET%3bNET6_0%3bNETCOREAPP%3bMIHOMO_KCP%3bPROTOSHIFT_BENCHMARK" $args
3+
cd ..

0 commit comments

Comments
 (0)