type Transaction … type operation … type verb … const addVerb … const createVerb … const insertVerb … const replaceVerb … const deleteVerb … const flushVerb … // populateCommandBuf populates the transaction as series of nft commands to the given bytes.Buffer. func (tx *Transaction) populateCommandBuf(buf *bytes.Buffer) error { … } // String returns the transaction as a string containing the nft commands; if there is // a pending error, it will be output as a comment at the end of the transaction. func (tx *Transaction) String() string { … } // NumOperations returns the number of operations queued in the transaction. func (tx *Transaction) NumOperations() int { … } func (tx *Transaction) operation(verb verb, obj Object) { … } // Add adds an "nft add" operation to tx, ensuring that obj exists by creating it if it // did not already exist. (If obj is a Rule, it will be appended to the end of its chain, // or else added after the Rule indicated by this rule's Index or Handle.) The Add() call // always succeeds, but if obj is invalid, or inconsistent with the existing nftables // state, then an error will be returned when the transaction is Run. func (tx *Transaction) Add(obj Object) { … } // Create adds an "nft create" operation to tx, creating obj, which must not already // exist. (If obj is a Rule, it will be appended to the end of its chain, or else added // after the Rule indicated by this rule's Index or Handle.) The Create() call always // succeeds, but if obj is invalid, already exists, or is inconsistent with the existing // nftables state, then an error will be returned when the transaction is Run. func (tx *Transaction) Create(obj Object) { … } // Insert adds an "nft insert" operation to tx, inserting obj (which must be a Rule) at // the start of its chain, or before the other Rule indicated by this rule's Index or // Handle. The Insert() call always succeeds, but if obj is invalid or is inconsistent // with the existing nftables state, then an error will be returned when the transaction // is Run. func (tx *Transaction) Insert(obj Object) { … } // Replace adds an "nft replace" operation to tx, replacing an existing rule with obj // (which must be a Rule). The Replace() call always succeeds, but if obj is invalid, does // not contain the Handle of an existing rule, or is inconsistent with the existing // nftables state, then an error will be returned when the transaction is Run. func (tx *Transaction) Replace(obj Object) { … } // Flush adds an "nft flush" operation to tx, clearing the contents of obj. The Flush() // call always succeeds, but if obj does not exist (or does not support flushing) then an // error will be returned when the transaction is Run. func (tx *Transaction) Flush(obj Object) { … } // Delete adds an "nft delete" operation to tx, deleting obj. The Delete() call always // succeeds, but if obj does not exist or cannot be deleted based on the information // provided (eg, Handle is required but not set) then an error will be returned when the // transaction is Run. func (tx *Transaction) Delete(obj Object) { … }