Documentation
¶
Rendered for windows/amd64
Index ¶
- Constants
- Variables
- func CalcChecksums(packet []byte) []byte
- func FormatIPAddress(addr [4]uint32) net.IP
- func FormatIPv4Address(addr [4]uint32) net.IP
- func FormatIPv6Address(addr [4]uint32) net.IP
- type Address
- func (addr Address) IsIPChecksum() (bool, error)
- func (addr Address) IsIPv6() (bool, error)
- func (addr Address) IsImpostor() (bool, error)
- func (addr Address) IsLoopback() (bool, error)
- func (addr Address) IsOutbound() (bool, error)
- func (addr Address) IsSniffed() (bool, error)
- func (addr Address) IsTCPChecksum() (bool, error)
- func (addr Address) IsUDPChecksum() (bool, error)
- type DataFlow
- type DataNetwork
- type DataReflect
- type DataSocket
- type Handle
- func (h Handle) Close() error
- func (h Handle) GetParam(param uintptr) (uint64, error)
- func (h Handle) GetVersion() (version string, err error)
- func (h Handle) Recv(packet []byte) (n int, addr Address, err error)
- func (h Handle) Send(packet []byte, addr Address) (n int, err error)
- func (h Handle) SetParam(param uintptr, value uint64) error
Constants ¶
View Source
const ( InvalidHandleValue = -1 // https://github.com/basil00/Divert/blob/master/include/windivert.h PacketFlagSniffed = 1 /* Packet was sniffed? */ PacketFlagOutbound = 1 << 1 /* Packet is outound? */ PacketFlagLoopback = 1 << 2 /* Packet is loop? */ PacketFlagImpostor = 1 << 3 /* Packet is Impostor? */ PacketFlagIPv6 = 1 << 4 /* Packet is IPv6? */ PacketFlagIPChecksum = 1 << 5 /* Packet has valid IPv4 checksum? */ PacketFlagTCPChecksum = 1 << 6 /* Packet has valid TCP checksum? */ PacketFlagUDPChecksum = 1 << 7 /* Packet has valid UDP checksum? */ // WinDivert events. EventNetworkPacket = 0 /* Network packet. */ EventNetworkFlowEstablished = 1 /* Flow established. */ EventNetworkFlowDelete = 2 /* Flow deleted. */ EventSocketBind = 3 /* Socket bind. */ EventSocketConnect = 4 /* Socket connect. */ EventSocketListen = 5 /* Socket listen. */ EventSocketAccept = 6 /* Socket accept. */ EventSocketClose = 7 /* Socket close. */ EventReflectOpen = 8 /* WinDivert handle opened. */ EventReflectClose = 9 /* WinDivert handle closed. */ LayerNetwork = 0 LayerNetworkForward = 1 LayerFlow = 2 LayerSocket = 3 LayerReflect = 4 FlagSniff = 1 FlagDrop = 2 FlagRecvOnly = 4 FlagReadOnly = 4 FlagSendOnly = 8 FlagWriteOnly = 8 FlagNoInstall = 16 FlagFragment = 32 DirectionOutbound = 0 DirectionInbound = 1 ParamQueueLen = 0 ParamQueueTime = 1 ParamQueueSize = 2 ParamMajorVersion = 3 ParamMinorVersion = 4 )
Variables ¶
View Source
var (
DLLVersion string
)
Functions ¶
func CalcChecksums ¶
func FormatIPAddress ¶
func FormatIPv4Address ¶
func FormatIPv6Address ¶
Types ¶
type Address ¶
type Address struct { Timestamp int64 /* Packet's timestamp. */ Layer uint8 /* Packet's layer. */ Event uint8 /* Packet event. */ Flags uint8 /* Packet Flags: Sniffed, Outbound, Loopback, Impostor, IPv6, IPChecksum, TCPChecksum, UDPChecksum */ Reserved1 uint8 /* Reserved1 */ Reserved2 uint32 /* Reserved2 */ Data [64]byte }
func (Address) IsIPChecksum ¶
func (Address) IsImpostor ¶
func (Address) IsLoopback ¶
func (Address) IsOutbound ¶
func (Address) IsTCPChecksum ¶
func (Address) IsUDPChecksum ¶
type DataFlow ¶
type DataFlow struct { EndpointId uint64 /* Endpoint ID. */ ParentEndpointId uint64 /* Parent Endpoint ID. */ ProcessId uint32 /* Process ID. */ LocalAddr [4]uint32 /* Local address. */ RemoteAddr [4]uint32 /* Remote address. */ LocalPort uint16 /* Local port. */ RemotePort uint16 /* Remote port. */ Protocol uint8 /* Protocol. */ }
type DataNetwork ¶
type DataNetwork struct { IfIdx uint32 /* Packet's interface index. */ SubIfIdx uint32 /* Packet's sub-interface index. */ }
https://github.com/basil00/Divert/blob/master/include/windivert.h
type DataReflect ¶
type DataSocket ¶
type DataSocket struct { EndpointId uint64 /* Endpoint ID. */ ParentEndpointId uint64 /* Parent Endpoint ID. */ ProcessId uint32 /* Process ID. */ LocalAddr [4]uint32 /* Local address. */ RemoteAddr [4]uint32 /* Remote address. */ LocalPort uint16 /* Local port. */ RemotePort uint16 /* Remote port. */ Protocol uint8 /* Protocol. */ }
Click to show internal directories.
Click to hide internal directories.