PacketFilter interface for firewall abilities
| 13 | |
| 14 | // PacketFilter interface for firewall abilities |
| 15 | type 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. |
no outgoing calls
no test coverage detected