引用Nuget包
dotnet add package TouchSocket --version 2.0.4
dotnet add package Google.Protobuf.Tools --version 3.26.1
dotnet add package Grpc.Tools --version 2.62.0
dotnet add package Google.Protobuf --version 3.26.1
实现过滤器-自定义解析规则
CodeInputSteam codeInputStream =new CodeInputStream(byteBlock);
int varint32=codeInputStream.ReadEnum();
int postion=(int)codeInputStream.Postion;
if(byteBlock.Len>=varint32+codeInputStream.Position){
byte[] bytes=new byte[varint32+postion);
Buffer.BlockCopy(byteBlock.ToArray(),0,bytes,0,bytes.Length);
CodeInputStream cts=new CodeInputStream(bytes);
var message=new DefeatMessage();
cts.ReadMessage(message);
byteBlock.Pos=bytes.Length;
return FilterResult.Success;
}else{
byteBlock.Pos=0;
return FilterResult.Cache;
}