Documentation ¶
Overview ¶
package iptables
package iptables
Index ¶
- func GetIPCountry(ip string) string
- func GetIpList() []string
- func RmDuplicate(list *[]string) []string
- type Error
- type IPTables
- func (ipt *IPTables) Append(table, chain string, rulespec ...string) error
- func (ipt *IPTables) AppendUnique(table, chain string, rulespec ...string) error
- func (ipt *IPTables) ClearChain(table, chain string) error
- func (ipt *IPTables) Delete(table, chain string, rulespec ...string) error
- func (ipt *IPTables) DeleteChain(table, chain string) error
- func (ipt *IPTables) Exists(table, chain string, rulespec ...string) (bool, error)
- func (ipt *IPTables) Insert(table, chain string, pos int, rulespec ...string) error
- func (ipt *IPTables) List(table, chain string) ([]string, error)
- func (ipt *IPTables) ListChains(table string) ([]string, error)
- func (ipt *IPTables) NewChain(table, chain string) error
- func (ipt *IPTables) Proto() Protocol
- func (ipt *IPTables) RenameChain(table, oldChain, newChain string) error
- type Protocol
- type Unlocker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetIPCountry ¶
Types ¶
type IPTables ¶
type IPTables struct {
// contains filtered or unexported fields
}
func New ¶
New creates a new IPTables. For backwards compatibility, this always uses IPv4, i.e. "iptables".
func NewWithProtocol ¶
New creates a new IPTables for the given proto. The proto will determine which command is used, either "iptables" or "ip6tables".
func (*IPTables) AppendUnique ¶
AppendUnique acts like Append except that it won't add a duplicate
func (*IPTables) ClearChain ¶
ClearChain flushed (deletes all rules) in the specified table/chain. If the chain does not exist, a new one will be created
func (*IPTables) DeleteChain ¶
DeleteChain deletes the chain in the specified table. The chain must be empty
func (*IPTables) ListChains ¶
ListChains returns a slice containing the name of each chain in the specified table.
func (*IPTables) NewChain ¶
NewChain creates a new chain in the specified table. If the chain already exists, it will result in an error.
func (*IPTables) RenameChain ¶
RenameChain renames the old chain to the new one.