MCPcopy
hub / github.com/netbirdio/netbird / PacketFilter

Interface PacketFilter

client/iface/device/device_filter.go:15–33  ·  view source on GitHub ↗

PacketFilter interface for firewall abilities

Source from the content-addressed store, hash-verified

13
14// PacketFilter interface for firewall abilities
15type PacketFilter interface {
16 // FilterOutbound filter outgoing packets from host to external destinations
17 FilterOutbound(packetData []byte, size int) bool
18
19 // FilterInbound filter incoming packets from external sources to host
20 FilterInbound(packetData []byte, size int) bool
21
22 // SetUDPPacketHook registers a hook for outbound UDP packets matching the given IP and port.
23 // Hook function returns true if the packet should be dropped.
24 // Only one UDP hook is supported; calling again replaces the previous hook.
25 // Pass nil hook to remove.
26 SetUDPPacketHook(ip netip.Addr, dPort uint16, hook func(packet []byte) bool)
27
28 // SetTCPPacketHook registers a hook for outbound TCP packets matching the given IP and port.
29 // Hook function returns true if the packet should be dropped.
30 // Only one TCP hook is supported; calling again replaces the previous hook.
31 // Pass nil hook to remove.
32 SetTCPPacketHook(ip netip.Addr, dPort uint16, hook func(packet []byte) bool)
33}
34
35// PacketCapture captures raw packets for debugging. Implementations must be
36// safe for concurrent use and must not block.

Callers 19

TestDeviceWrapperReadFunction · 0.65
ReadMethod · 0.65
TestDeviceWrapperReadFunction · 0.65
WriteMethod · 0.65
TestPeerACLFilteringFunction · 0.65
TestPeerACLFilteringIPv6Function · 0.65
StopMethod · 0.65
filterDNSTrafficMethod · 0.65
TestTracePacketFunction · 0.65

Implementers 4

MockPacketFilterclient/iface/mocks/filter.go
MockPacketFilterMockRecorderclient/iface/mocks/filter.go
Managerclient/firewall/uspfilter/filter.go
HooksFilterclient/firewall/uspfilter/hooks_filter

Calls

no outgoing calls

Tested by

no test coverage detected