Documentation ¶
Index ¶
- Constants
- func HelperCheckFilter(filter string) (bool, int)
- func HelperEvalFilter(packet *Packet, filter string) (bool, error)
- func LoadDLL(path64, path32 string)
- type ChecksumFlag
- type Direction
- type Event
- type Layer
- type OpenFlag
- type Packet
- func (p *Packet) CalcNewChecksum(wd *WinDivertHandle)
- func (p *Packet) Direction() Direction
- func (p *Packet) DstIP() net.IP
- func (p *Packet) DstPort() (uint16, error)
- func (p *Packet) EvalFilter(filter string) (bool, error)
- func (p *Packet) IpVersion() int
- func (p *Packet) NextHeaderProtocolName() string
- func (p *Packet) NextHeaderType() uint8
- func (p *Packet) ParseHeaders()
- func (p *Packet) Send(wd *WinDivertHandle) (uint, error)
- func (p *Packet) SetDstIP(ip net.IP)
- func (p *Packet) SetDstPort(port uint16) error
- func (p *Packet) SetSrcIP(ip net.IP)
- func (p *Packet) SetSrcPort(port uint16) error
- func (p *Packet) SrcIP() net.IP
- func (p *Packet) SrcPort() (uint16, error)
- func (p *Packet) String() string
- func (p *Packet) VerifyParsed()
- type Priority
- type WinDivertAddress
- func (w *WinDivertAddress) Direction() Direction
- func (w *WinDivertAddress) Event() Event
- func (w *WinDivertAddress) IPChecksumValid() bool
- func (w *WinDivertAddress) IPv6() bool
- func (w *WinDivertAddress) Impostor() bool
- func (w *WinDivertAddress) Layer() Layer
- func (w *WinDivertAddress) Loopback() bool
- func (w *WinDivertAddress) Outbound() bool
- func (w *WinDivertAddress) Sniffed() bool
- func (w *WinDivertAddress) String() string
- func (w *WinDivertAddress) TCPChecksumValid() bool
- func (w *WinDivertAddress) UDPChecksumValid() bool
- type WinDivertHandle
- func (wd *WinDivertHandle) Close() error
- func (wd *WinDivertHandle) HelperCalcChecksum(packet *Packet)
- func (wd *WinDivertHandle) Packets() (chan *Packet, error)
- func (wd *WinDivertHandle) RecalculateChecksums(packet *Packet, flags ChecksumFlag)
- func (wd *WinDivertHandle) Recv() (*Packet, error)
- func (wd *WinDivertHandle) Send(packet *Packet) (uint, error)
Constants ¶
const ( PacketBufferSize = 1500 PacketChanCapacity = 256 WinDivertDirectionOutbound Direction = 1 WinDivertDirectionInbound Direction = 0 )
const ( // The highest priority a handle can have. PriorityMax = 30000 // The default handle priority. // // Note that multiple handles should not have the same priority. PriorityDefault = 0 // The lowest priority a handle can have. PriorityLowest = -PriorityMax )
const ( ChecksumAll = 0x00 ChecksumNoIP = 0x01 ChecksumNoICMP = 0x02 ChecksumNoICMPv6 = 0x04 ChecksumNoTCP = 0x08 ChecksumNoUDP = 0x10 )
Variables ¶
This section is empty.
Functions ¶
func HelperCheckFilter ¶
Take the given filter and check if it contains any error https://reqrypt.org/windivert-doc.html#divert_helper_check_filter
func HelperEvalFilter ¶
Take a packet and compare it with the given filter Returns true if the packet matches the filter https://reqrypt.org/windivert-doc.html#divert_helper_eval_filter
Types ¶
type ChecksumFlag ¶
type ChecksumFlag int64
type Packet ¶
type Packet struct { Raw []byte Addr *WinDivertAddress PacketLen uint IpHdr header.IPHeader NextHeader header.ProtocolHeader // contains filtered or unexported fields }
Represents a packet
func (*Packet) CalcNewChecksum ¶
func (p *Packet) CalcNewChecksum(wd *WinDivertHandle)
Recalculate the packet's checksum Shortcut for WinDivertHelperCalcChecksum
func (*Packet) Direction ¶
Returns the Direction of the packet WinDivertDirectionInbound (true) for inbound Packets WinDivertDirectionOutbound (false) for outbound packets Shortcut for Addr.Direction()
func (*Packet) DstPort ¶
Returns the destination port of the packet Shortcut for NextHeader.DstPort()
func (*Packet) EvalFilter ¶
Check the packet with the filter Returns true if the packet matches the filter
func (*Packet) NextHeaderProtocolName ¶
Returns the name of the protocol
func (*Packet) NextHeaderType ¶
Returns the IP Protocol number of the next Header https://en.wikipedia.org/wiki/List_of_IP_protocol_numbers
func (*Packet) Send ¶
func (p *Packet) Send(wd *WinDivertHandle) (uint, error)
Inject the packet on the Network Stack If the packet has been modified calls WinDivertHelperCalcChecksum to get a new checksum
func (*Packet) SetDstPort ¶
Sets the destination port of the packet Shortcut for NextHeader.SetDstPort()
func (*Packet) SetSrcPort ¶
Sets the source port of the packet Shortcut for NextHeader.SetSrcPort()
func (*Packet) VerifyParsed ¶
func (p *Packet) VerifyParsed()
Check if the headers have already been parsed and call ParseHeaders() if not
type WinDivertAddress ¶
Represents a WinDivertAddress struct
See : https://reqrypt.org/windivert-doc.html#divert_address
func (*WinDivertAddress) Direction ¶
func (w *WinDivertAddress) Direction() Direction
Direction returns the direction of the packet
func (*WinDivertAddress) Event ¶
func (w *WinDivertAddress) Event() Event
func (*WinDivertAddress) IPChecksumValid ¶
func (w *WinDivertAddress) IPChecksumValid() bool
func (*WinDivertAddress) IPv6 ¶
func (w *WinDivertAddress) IPv6() bool
func (*WinDivertAddress) Impostor ¶
func (w *WinDivertAddress) Impostor() bool
func (*WinDivertAddress) Layer ¶
func (w *WinDivertAddress) Layer() Layer
func (*WinDivertAddress) Loopback ¶
func (w *WinDivertAddress) Loopback() bool
func (*WinDivertAddress) Outbound ¶
func (w *WinDivertAddress) Outbound() bool
func (*WinDivertAddress) Sniffed ¶
func (w *WinDivertAddress) Sniffed() bool
func (*WinDivertAddress) String ¶
func (w *WinDivertAddress) String() string
func (*WinDivertAddress) TCPChecksumValid ¶
func (w *WinDivertAddress) TCPChecksumValid() bool
func (*WinDivertAddress) UDPChecksumValid ¶
func (w *WinDivertAddress) UDPChecksumValid() bool
type WinDivertHandle ¶
type WinDivertHandle struct {
// contains filtered or unexported fields
}
Used to call WinDivert's functions
func OpenHandle ¶
func OpenHandle(filter string, layer Layer, priority uint16, flags OpenFlag) (*WinDivertHandle, error)
OpenHandle opens a new WinDivert handle.
func OpenHandleWithFilter ¶
func OpenHandleWithFilter(filter string) (*WinDivertHandle, error)
func (*WinDivertHandle) Close ¶
func (wd *WinDivertHandle) Close() error
Close the Handle See https://reqrypt.org/windivert-doc.html#divert_close
func (*WinDivertHandle) HelperCalcChecksum ¶
func (wd *WinDivertHandle) HelperCalcChecksum(packet *Packet)
Calls WinDivertHelperCalcChecksum to calculate the packet's chacksum https://reqrypt.org/windivert-doc.html#divert_helper_calc_checksums
func (*WinDivertHandle) Packets ¶
func (wd *WinDivertHandle) Packets() (chan *Packet, error)
Create a new channel that will be used to pass captured packets and returns it calls recvLoop to maintain a loop
func (*WinDivertHandle) RecalculateChecksums ¶
func (wd *WinDivertHandle) RecalculateChecksums(packet *Packet, flags ChecksumFlag)
func (*WinDivertHandle) Recv ¶
func (wd *WinDivertHandle) Recv() (*Packet, error)
Divert a packet from the Network Stack https://reqrypt.org/windivert-doc.html#divert_recv
func (*WinDivertHandle) Send ¶
func (wd *WinDivertHandle) Send(packet *Packet) (uint, error)
Inject the packet on the Network Stack https://reqrypt.org/windivert-doc.html#divert_send