Backend implements platform.Backend on Linux.
| 49 | |
| 50 | // Backend implements platform.Backend on Linux. |
| 51 | type Backend struct { |
| 52 | cfg Config |
| 53 | |
| 54 | mu sync.Mutex |
| 55 | opened bool |
| 56 | scope platform.Scope |
| 57 | nfq *nfqueue.Nfqueue |
| 58 | rawSock int |
| 59 | packets chan platform.Packet |
| 60 | closed chan struct{} |
| 61 | // cancelReader cancels the context passed to nfqueue.Register. nfqueue's |
| 62 | // internal reader goroutine only exits when this context is Done, so |
| 63 | // Close() must call it before invoking nfq.Close() or Close hangs. |
| 64 | cancelReader context.CancelFunc |
| 65 | addedRules [][]string // exact args we passed to iptables -A, for safe cleanup |
| 66 | } |
| 67 | |
| 68 | // New returns an unopened Backend. |
| 69 | func New(cfg Config) *Backend { |
nothing calls this directly
no outgoing calls
no test coverage detected