Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
xljiulang authored Oct 13, 2022
1 parent 6c68cf9 commit ecf7b23
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@

### 2 功能介绍
* Filter对象支持Labda构建filter language,脱离字符串的苦海;
* WinDivert对象自动维护Windivert句柄,提供接收包与发送包方法;
* WinDivertPacket提供获取包有效数据长度、解包、重构chucksums等;
* WinDivertParseResult提供对解包的数据进行精细修改,修改后对Packet直接生效;
* 基于IOCP的Task异步发送与接收;
* 内存安全的WinDivert对象,基于IOCP的ValueTask异步发送与接收方法;
* 内存安全的WinDivertPacket对象,提供获取包有效数据长度、解包、重构chucksums等;
* WinDivertParseResult提供对解包的数据进行精细修改,修改后对WinDivertPacket直接生效;

### 3 如何使用
```
Expand All @@ -20,12 +19,12 @@ var filter = Filter.True
using var divert = new WinDivert(filter, WinDivertLayer.Network);
using var packet = new WinDivertPacket();
var addr = new WinDivertAddress();
using var addr = new WinDivertAddress();
while(true)
{
// 读包
await divert.RecvAsync(packet, ref addr);
await divert.RecvAsync(packet, addr);
// 解包
var result = packet.GetParseResult();
Expand All @@ -34,8 +33,8 @@ while(true)
result.TcpHeader->DstPort = 443;
// 重算checksums
packet.CalcChecksums(ref addr);
packet.CalcChecksums(addr);
// 修改后发出
await divert.SendAsync(packet, ref addr);
await divert.SendAsync(packet, addr);
}

0 comments on commit ecf7b23

Please sign in to comment.