Documentation
¶
Index ¶
- Constants
- func AddChain(tab, chain string) error
- func AddChainWithAppend(tab, parentChain, chain string) error
- func AddFilterRule(chain string, policy FilterRules) error
- func AddForward(protocol, srcPort, dest, destPort, iface string, save bool) error
- func AddRule(tab, chain, rule string) error
- func AppendChain(tab string, parentChain, chain string) error
- func BindChain(tab, targetChain, chain string, position int) error
- func CheckChainBind(tab, parentChain, chain string) (bool, error)
- func CheckChainExist(tab, chain string) (bool, error)
- func CheckRuleExist(tab, chain, rule string) bool
- func ClearChain(tab, chain string) error
- func DeleteFilterRule(chain string, policy FilterRules) error
- func DeleteForward(num string, protocol, srcPort, dest, destPort, iface string) error
- func DeleteRule(tab, chain, rule string) error
- func FindChainNum(tab, targetChain, chain string) (int, error)
- func LoadDefaultStrategy(chain string) (string, error)
- func LoadInitStatus(clientName, tab string) (bool, bool)
- func LoadRulesFromFile(tab, chain, fileName string) error
- func NewChain(tab, chain string) error
- func Run(tab, rule string) error
- func RunWithStd(tab, rule string) (string, error)
- func RunWithoutIgnore(tab, rule string) (string, error)
- func SaveRulesToFile(tab, chain, fileName string) error
- func UnbindChain(tab, targetChain, chain string) error
- type FilterRules
- type IptablesNatInfo
Constants ¶
View Source
const ( Chain1PanelPreRouting = "1PANEL_PREROUTING" Chain1PanelPostRouting = "1PANEL_POSTROUTING" Chain1PanelForward = "1PANEL_FORWARD" ChainInput = "INPUT" ChainOutput = "OUTPUT" Chain1PanelInput = "1PANEL_INPUT" Chain1PanelOutput = "1PANEL_OUTPUT" Chain1PanelBasicBefore = "1PANEL_BASIC_BEFORE" Chain1PanelBasic = "1PANEL_BASIC" Chain1PanelBasicAfter = "1PANEL_BASIC_AFTER" )
View Source
const ( EstablishedRule = "-m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT -m comment --comment 'ESTABLISHED Whitelist'" IoRuleIn = "-i lo -j ACCEPT -m comment --comment 'Loopback Whitelist'" DropAllTcp = "-p tcp -j DROP" DropAllUdp = "-p udp -j DROP" AllowSSH = "-p tcp --dport ssh -j ACCEPT" )
View Source
const ( ACCEPT = "ACCEPT" DROP = "DROP" REJECT = "REJECT" ANYWHERE = "anywhere" )
View Source
const ( FilterTab = "filter" NatTab = "nat" )
View Source
const ( BasicBeforeFileName = "1panel_basic_before.rules" BasicFileName = "1panel_basic.rules" BasicAfterFileName = "1panel_basic_after.rules" InputFileName = "1panel_input.rules" OutputFileName = "1panel_out.rules" ForwardFileName = "1panel_forward.rules" ForwardFileName1 = "1panel_forward_pre.rules" ForwardFileName2 = "1panel_forward_post.rules" )
Variables ¶
This section is empty.
Functions ¶
func AddChainWithAppend ¶
func AddFilterRule ¶
func AddFilterRule(chain string, policy FilterRules) error
func AddForward ¶
func AppendChain ¶
func CheckChainBind ¶
func CheckChainExist ¶
func CheckRuleExist ¶
func ClearChain ¶
func DeleteFilterRule ¶
func DeleteFilterRule(chain string, policy FilterRules) error
func DeleteForward ¶
func DeleteRule ¶
func FindChainNum ¶
func LoadDefaultStrategy ¶
func LoadInitStatus ¶
func LoadRulesFromFile ¶
func RunWithStd ¶
func RunWithoutIgnore ¶
func SaveRulesToFile ¶
func UnbindChain ¶
Types ¶
type FilterRules ¶
type FilterRules struct {
ID uint `json:"id"`
Chain string `json:"chain"`
Protocol string `json:"protocol"`
SrcPort string `json:"srcPort"`
DstPort string `json:"dstPort"`
SrcIP string `json:"srcIP"`
DstIP string `json:"dstIP"`
Strategy string `json:"strategy"`
Description string `json:"description"`
}
func ReadFilterRulesByChain ¶
func ReadFilterRulesByChain(chain string) ([]FilterRules, error)
type IptablesNatInfo ¶
type IptablesNatInfo struct {
Num string `json:"num"`
Protocol string `json:"protocol"`
InIface string `json:"inIface"`
OutIface string `json:"outIface"`
Source string `json:"source"`
Destination string `json:"destination"`
SrcPort string `json:"srcPort"`
DestPort string `json:"destPort"`
}
func ListForward ¶
func ListForward(chain ...string) ([]IptablesNatInfo, error)
Click to show internal directories.
Click to hide internal directories.