Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
xljiulang committed Oct 17, 2022
1 parent fdd8e69 commit 2fafeff
Showing 1 changed file with 38 additions and 35 deletions.
73 changes: 38 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,45 +15,48 @@

### 3 Api表
#### 3.1 WinDivert
| Api | 描述 |
| ------------------------------------------------------------------------------ | ------------------ |
| int Recv(WinDivertPacket, WinDivertAddress) | 同步阻塞读取数据包 |
| int Recv(WinDivertPacket, WinDivertAddress, CancellationToken) | 同步阻塞读取数据包 |
| `ValueTask<int>` RecvAsync(WinDivertPacket, WinDivertAddress) | 异步IO读取数据包 |
| `ValueTask<int>` RecvAsync(WinDivertPacket, WinDivertAddress, CancellationToken) | 异步IO读取数据包 |
| int Send(WinDivertPacket, WinDivertAddress) | 同步阻塞发送数据包 |
| int Send(WinDivertPacket, WinDivertAddress, CancellationToken) | 同步阻塞发送数据包 |
| `ValueTask<int>` SendAsync(WinDivertPacket, WinDivertAddress) | 异步IO发送数据包 |
| `ValueTask<int>` SendAsync(WinDivertPacket, WinDivertAddress, CancellationToken) | 异步IO发送数据包 |
| Api | 描述 | 原Api |
| -------------------------------------------------------------------------------- | ------------------ | ----------------- |
| WinDivert(Filter, WinDivertLayer, short , WinDivertFlag) | 构造器 | WinDivertOpen |
| int Recv(WinDivertPacket, WinDivertAddress) | 同步阻塞读取数据包 | RecvEx |
| int Recv(WinDivertPacket, WinDivertAddress, CancellationToken) | 同步阻塞读取数据包 | RecvEx |
| `ValueTask<int>` RecvAsync(WinDivertPacket, WinDivertAddress) | 异步IO读取数据包 | RecvEx |
| `ValueTask<int>` RecvAsync(WinDivertPacket, WinDivertAddress, CancellationToken) | 异步IO读取数据包 | RecvEx |
| int Send(WinDivertPacket, WinDivertAddress) | 同步阻塞发送数据包 | SendEx |
| int Send(WinDivertPacket, WinDivertAddress, CancellationToken) | 同步阻塞发送数据包 | SendEx |
| `ValueTask<int>` SendAsync(WinDivertPacket, WinDivertAddress) | 异步IO发送数据包 | SendEx |
| `ValueTask<int>` SendAsync(WinDivertPacket, WinDivertAddress, CancellationToken) | 异步IO发送数据包 | SendEx |
| bool Shutdown(WinDivertShutdown) | 关闭 | WinDivertShutdown |
| void Dispose() | 关闭并释放资源 | WinDivertClose |

#### 3.2 Filter
| Api | 描述 |
| --------------------------------------------- | ------------------------- |
| static string Format(string, WinDivertLayer) | 格式化filter |
| static string Compile(string, WinDivertLayer) | 编译filter |
| static Filter True { get; } | 获取值为true的filter |
| static Filter False { get; } | 获取值为false的filter |
| Filter And(Expression<Func<IFilter, bool>>) | 使用and逻辑创建新的fitler |
| Filter And(Filter) | 使用and逻辑创建新的fitler |
| Filter Or(Expression<Func<IFilter, bool>>) | 使用or逻辑创建新的fitler |
| Filter Or(Filter) | 使用or逻辑创建新的fitler |
| Api | 描述 | 原Api |
| --------------------------------------------- | ------------------------- | ---------------------------- |
| static string Format(string, WinDivertLayer) | 格式化filter | WinDivertHelperFormatFilter |
| static string Compile(string, WinDivertLayer) | 编译filter | WinDivertHelperCompileFilter |
| static Filter True { get; } | 获取值为true的filter ||
| static Filter False { get; } | 获取值为false的filter ||
| Filter And(Expression<Func<IFilter, bool>>) | 使用and逻辑创建新的fitler ||
| Filter And(Filter) | 使用and逻辑创建新的fitler | |
| Filter Or(Expression<Func<IFilter, bool>>) | 使用or逻辑创建新的fitler ||
| Filter Or(Filter) | 使用or逻辑创建新的fitler | |

#### 3.3 WinDivertPacket
| Api | 描述 |
| --------------------------------------------------- | --------------------------------------------------------------- |
| int Capacity { get; } | 获取缓冲区容量 |
| int Length { get; set;} | 获取或设置有效数据的长度 |
| Span<byte> Span { get; } | 获取有效数据视图 |
| void Clear() | 将有效数据清0 |
| Span<byte> GetSpan(int, int) | 获取缓冲区的Span |
| bool CalcChecksums(WinDivertAddress, ChecksumsFlag) | 重新计算和修改相关的Checksums |
| bool CalcNetworkIfIdx(WinDivertAddress ) | 根据IP地址重新计算和修改addr的Network->IfIdx |
| bool CalcOutboundFlag(WinDivertAddress) | 根据IP地址和addr.Network->IfIdx重新计算和修改addr的Outbound标记 |
| bool CalcLoopbackFlag(WinDivertAddress) | 根据IP地址重新计算和修改addr的Loopback标记 |
| bool DecrementTTL() | ttl减1 |
| int GetHashCode() | 获取包的哈希 |
| int GetHashCode(long) | 获取包的哈希 |
| WinDivertParseResult GetParseResult() | 获取包的解析结果 |
| Api | 描述 | 原Api |
| --------------------------------------------------- | --------------------------------------------------------------- | ---------------------------- |
| int Capacity { get; } | 获取缓冲区容量 ||
| int Length { get; set;} | 获取或设置有效数据的长度 ||
| Span<byte> Span { get; } | 获取有效数据视图 ||
| void Clear() | 将有效数据清0 ||
| Span<byte> GetSpan(int, int) | 获取缓冲区的Span ||
| bool CalcChecksums(WinDivertAddress, ChecksumsFlag) | 重新计算和修改相关的Checksums | WinDivertHelperCalcChecksums |
| bool CalcNetworkIfIdx(WinDivertAddress ) | 根据IP地址重新计算和修改addr的Network->IfIdx ||
| bool CalcOutboundFlag(WinDivertAddress) | 根据IP地址和addr.Network->IfIdx重新计算和修改addr的Outbound标记 ||
| bool CalcLoopbackFlag(WinDivertAddress) | 根据IP地址重新计算和修改addr的Loopback标记 ||
| bool DecrementTTL() | ttl减1 | WinDivertHelperDecrementTTL |
| int GetHashCode() | 获取包的哈希 | WinDivertHelperHashPacket |
| int GetHashCode(long) | 获取包的哈希 | WinDivertHelperHashPacket |
| WinDivertParseResult GetParseResult() | 获取包的解析结果 | WinDivertHelperParsePacket |

#### 3.4 WinDivertRouter
| Api | 描述 |
Expand Down

0 comments on commit 2fafeff

Please sign in to comment.