Skip to content

Commit

Permalink
filter使用枚举
Browse files Browse the repository at this point in the history
  • Loading branch information
xljiulang committed Oct 28, 2022
1 parent 0c6ab3c commit da1c6b2
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 8 deletions.
2 changes: 1 addition & 1 deletion WindivertDotnet.Test/FilterTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void NetworkTest()
.Or(f => f.Network.LocalPort > 0)
.Or(f => f.Network.Loopback)
.Or(f => f.Network.Outbound)
.Or(f => f.Network.Protocol == (int)ProtocolType.Udp)
.Or(f => f.Network.Protocol == ProtocolType.Udp)
.Or(f => f.Network.RemoteAddr == IPAddress.Loopback.ToString())
.Or(f => f.Network.RemotePort == 443)
.Or(f => f.Network.SubIfIdx == 12);
Expand Down
45 changes: 38 additions & 7 deletions WindivertDotnet/IFilter.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Net.Sockets;

namespace WindivertDotnet
{
Expand Down Expand Up @@ -116,7 +117,7 @@ public interface IFilter
/// icmpV6属性集
/// </summary>
[FilterMember("icmpv6")]
public IICmp IcmpV6 { get; }
public IICmpV6 IcmpV6 { get; }


/// <summary>
Expand Down Expand Up @@ -171,7 +172,7 @@ public interface INetwork
/// <para>ProtocolType</para>
/// </summary>
[FilterMember("protocol")]
int Protocol { get; }
ProtocolType Protocol { get; }

/// <summary>
/// 本机IP地址
Expand Down Expand Up @@ -309,7 +310,7 @@ public interface IFlow
/// 协议类型(ProtocolType)
/// </summary>
[FilterMember("protocol")]
int Protocol { get; }
ProtocolType Protocol { get; }
}

/// <summary>
Expand Down Expand Up @@ -369,7 +370,7 @@ public interface ISocket
/// 协议类型(ProtocolType)
/// </summary>
[FilterMember("protocol")]
int Protocol { get; }
ProtocolType Protocol { get; }
}

/// <summary>
Expand Down Expand Up @@ -442,7 +443,7 @@ public interface IIP
/// <para>ProtocolType</para>
/// </summary>
[FilterMember]
int Protocol { get; }
ProtocolType Protocol { get; }

/// <summary>
/// 检验和
Expand Down Expand Up @@ -644,13 +645,43 @@ public interface IICmp
/// 类型
/// </summary>
[FilterMember]
int Type { get; }
IcmpV4MessageType Type { get; }

/// <summary>
/// 代码
/// </summary>
[FilterMember]
int Code { get; }
IcmpV4UnreachableCode Code { get; }

/// <summary>
/// 检验和
/// </summary>
[FilterMember]
int Checksum { get; }

/// <summary>
/// Rest of header
/// </summary>
[FilterMember]
int Body { get; }
}

/// <summary>
/// ICMP
/// </summary>
public interface IICmpV6
{
/// <summary>
/// 类型
/// </summary>
[FilterMember]
IcmpV6MessageType Type { get; }

/// <summary>
/// 代码
/// </summary>
[FilterMember]
IcmpV6UnreachableCode Code { get; }

/// <summary>
/// 检验和
Expand Down

0 comments on commit da1c6b2

Please sign in to comment.