ffi

package
v0.0.0-...-0092326 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const WinDivertBatchMax = 0xFF /* 255 */
View Source
const WinDivertMTUMax = 40 + 0xFFFF
View Source
const WinDivertParamQueueLengthDefault = 4096
View Source
const WinDivertParamQueueLengthMax = 16384
View Source
const WinDivertParamQueueLengthMin = 32
View Source
const WinDivertParamQueueSizeDefault = 4194304 /* 4MB */
View Source
const WinDivertParamQueueSizeMax = 33554432 /* 32MB */
View Source
const WinDivertParamQueueSizeMin = 65535 /* 64KB */
View Source
const WinDivertParamQueueTimeDefault = 2000 /* 2s */
View Source
const WinDivertParamQueueTimeMax = 16000 /* 16s */
View Source
const WinDivertParamQueueTimeMin = 100 /* 100ms */
View Source
const WinDivertPriorityDefault = Priority(0)
View Source
const WinDivertPriorityHighest = Priority(30000)
View Source
const WinDivertPriorityLowest = Priority(-WinDivertPriorityHighest)

Variables

This section is empty.

Functions

This section is empty.

Types

type ChecksumFlag

type ChecksumFlag int64
const (
	All      ChecksumFlag = 0x00
	NoIP     ChecksumFlag = 0x01
	NoICMP   ChecksumFlag = 0x02
	NoICMPv6 ChecksumFlag = 0x04
	NoTCP    ChecksumFlag = 0x08
	NoUDP    ChecksumFlag = 0x10
)

func (ChecksumFlag) String

func (i ChecksumFlag) String() string

type Direction

type Direction int
const (
	Outbound Direction = 1
	Inbound  Direction = 0
)

func (Direction) String

func (i Direction) String() string

type Event

type Event int

WINDIVERT_EVENT https://reqrypt.org/windivert-doc.html#divert_events

const (
	NetworkPacket Event = iota
	FlowEstablished
	FlowDeleted
	SocketBind
	SocketConnect
	SocketListen
	SocketAccept
	SocketClose
	ReflectOpen
	ReflectClose
)

func (Event) String

func (i Event) String() string

type Filter

type Filter string

func (*Filter) String

func (f *Filter) String() string

String returns the string representation of the filter, with trailing zeroes trimmed

type Flag

type Flag uint8
const (
	None        Flag = 0x00
	Sniff       Flag = 0x01
	Drop        Flag = 0x02
	ReceiveOnly Flag = 0x04
	SendOnly    Flag = 0x08
	NoInstall   Flag = 0x10
	Fragments   Flag = 0x20
)

func (Flag) String

func (flags Flag) String() string

type Layer

type Layer int

WINDIVERT_LAYER https://reqrypt.org/windivert-doc.html#divert_layers

const (
	// Network packets to/from the local machine.
	Network Layer = iota
	// Network packets passing through the local machine.
	NetworkForward
	// Network flow established/deleted events.
	Flow
	// Socket operation events.
	Socket
	// Reflect WinDivert handle events.
	Reflect
)

func (Layer) String

func (i Layer) String() string

type Packet

type Packet struct {
	Address *WinDivertAddress
	Length  uint
	Content []byte
}

Wrapped packet

func (*Packet) Decode

func (p *Packet) Decode(options gopacket.DecodeOptions) gopacket.Packet

func (*Packet) IPVersion

func (p *Packet) IPVersion() uint8

type Param

type Param int

WINDIVERT_PARAM

const (
	QueueLength  Param = 0
	QueueTime    Param = 1
	QueueSize    Param = 2
	VersionMajor Param = 3
	VersionMinor Param = 4
)

func (Param) String

func (i Param) String() string

type Priority

type Priority int16

Priority of the handles Multiple handles should not have the same priority.

type Shutdown

type Shutdown int64

WINDIVERT_SHUTDOWN

const (
	Recv Shutdown = 0x1
	Send Shutdown = 0x2
	Both Shutdown = 0x3
)

func (Shutdown) String

func (i Shutdown) String() string

type WinDivertAddress

type WinDivertAddress struct {
	// A timestamp indicating when event occurred.
	Timestamp int64
	// contains filtered or unexported fields
}

WINDIVERT_ADDRESS https://reqrypt.org/windivert-doc.html#divert_address

func (*WinDivertAddress) Direction

func (a *WinDivertAddress) Direction() Direction

Direction returns the direction of the packet

func (*WinDivertAddress) Event

func (a *WinDivertAddress) Event() Event

The captured event (WINDIVERT_EVENT_*).

func (*WinDivertAddress) Flow

func (*WinDivertAddress) IPChecksumValid

func (a *WinDivertAddress) IPChecksumValid() bool

Set to 1 if the IPv4 checksum is valid, 0 otherwise.

func (*WinDivertAddress) IPv6

func (a *WinDivertAddress) IPv6() bool

Set to 1 for IPv6 packets/events, 0 otherwise.

func (*WinDivertAddress) Impostor

func (a *WinDivertAddress) Impostor() bool

Set to 1 for impostor packets, 0 otherwise.

func (*WinDivertAddress) Layer

func (a *WinDivertAddress) Layer() Layer

The handle's layer (WINDIVERT_LAYER_*).

func (*WinDivertAddress) Loopback

func (a *WinDivertAddress) Loopback() bool

Set to 1 for loopback packets, 0 otherwise.

func (*WinDivertAddress) Network

func (*WinDivertAddress) Reflect

func (*WinDivertAddress) Sniffed

func (a *WinDivertAddress) Sniffed() bool

Set to 1 if the event was sniffed (i.e., not blocked), 0 otherwise.

func (*WinDivertAddress) Socket

func (*WinDivertAddress) TCPChecksumValid

func (a *WinDivertAddress) TCPChecksumValid() bool

Set to 1 if the TCP checksum is valid, 0 otherwise.

func (*WinDivertAddress) UDPChecksumValid

func (a *WinDivertAddress) UDPChecksumValid() bool

Set to 1 if the UDP checksum is valid, 0 otherwise.

type WinDivertDataFlow

type WinDivertDataFlow addressInternalUnion

WINDIVERT_DATA_FLOW

func (*WinDivertDataFlow) Endpoint

func (d *WinDivertDataFlow) Endpoint() uint64

The endpoint ID of the flow.

func (*WinDivertDataFlow) LocalAddr

func (d *WinDivertDataFlow) LocalAddr() netip.Addr

func (*WinDivertDataFlow) LocalPort

func (d *WinDivertDataFlow) LocalPort() uint16

func (*WinDivertDataFlow) ParentEndpoint

func (d *WinDivertDataFlow) ParentEndpoint() uint64

The parent endpoint ID of the flow.

func (*WinDivertDataFlow) ProcessId

func (d *WinDivertDataFlow) ProcessId() uint32

The ID of the process associated with the flow.

func (*WinDivertDataFlow) Protocol

func (d *WinDivertDataFlow) Protocol() uint8

func (*WinDivertDataFlow) RemoteAddr

func (d *WinDivertDataFlow) RemoteAddr() netip.Addr

func (*WinDivertDataFlow) RemotePort

func (d *WinDivertDataFlow) RemotePort() uint16

type WinDivertDataNetwork

type WinDivertDataNetwork addressInternalUnion

WINDIVERT_DATA_NETWORK

func (*WinDivertDataNetwork) IfIdx

func (d *WinDivertDataNetwork) IfIdx() uint32

The interface index on which the packet arrived (for inbound packets), or is to be sent (for outbound packets).

func (*WinDivertDataNetwork) SubIfIdx

func (d *WinDivertDataNetwork) SubIfIdx() uint32

The sub-interface index for IfIdx.

type WinDivertDataReflect

type WinDivertDataReflect addressInternalUnion

WINDIVERT_DATA_REFLECT

func (*WinDivertDataReflect) Flags

func (d *WinDivertDataReflect) Flags() Flag

func (*WinDivertDataReflect) Layer

func (d *WinDivertDataReflect) Layer() Layer

func (*WinDivertDataReflect) Priority

func (d *WinDivertDataReflect) Priority() int16

func (*WinDivertDataReflect) ProcessId

func (d *WinDivertDataReflect) ProcessId() uint32

The ID of the process that opened the handle.

func (*WinDivertDataReflect) Timestamp

func (d *WinDivertDataReflect) Timestamp() int64

A timestamp indicating when the handle was opened.

type WinDivertDataSocket

type WinDivertDataSocket addressInternalUnion

WINDIVERT_DATA_SOCKET

func (*WinDivertDataSocket) Endpoint

func (d *WinDivertDataSocket) Endpoint() uint64

The endpoint ID of the socket operation.

func (*WinDivertDataSocket) LocalAddr

func (d *WinDivertDataSocket) LocalAddr() netip.Addr

func (*WinDivertDataSocket) LocalPort

func (d *WinDivertDataSocket) LocalPort() uint16

func (*WinDivertDataSocket) ParentEndpoint

func (d *WinDivertDataSocket) ParentEndpoint() uint64

The parent endpoint ID of the socket operation.

func (*WinDivertDataSocket) ProcessId

func (d *WinDivertDataSocket) ProcessId() uint32

The ID of the process associated with the socket operation.

func (*WinDivertDataSocket) Protocol

func (d *WinDivertDataSocket) Protocol() uint8

func (*WinDivertDataSocket) RemoteAddr

func (d *WinDivertDataSocket) RemoteAddr() netip.Addr

func (*WinDivertDataSocket) RemotePort

func (d *WinDivertDataSocket) RemotePort() uint16

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL