Documentation
¶
Overview ¶
Firewall Common includes common stuff may be used while dealing with all firewalls, like Srouce IP, Destination IP, Destination Port and Application.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateIPs ¶
The goal is to get a list of IPs and check if all are valid IP addresses. ValidateIPs gets a slice of strings and if all IPs are valid return list of IPs as a slice of string and nil as error. Otherwise, it returns an empty slice and an error
func WriteFwRuleSimpleCSV ¶
func WriteFwRuleSimpleCSV(fpath string, fws []FwRuleSimple) error
WriteFwRuleSimpleCSV ...
Types ¶
type FwRule ¶
type FwRule struct { SrcIPs []string DstIPs []string Protocol []string // TCP/UDP Ports []string Application string Needed bool // If firewall rule is needed }
FwRule ...
func ConvertSimpleToFwRule ¶
func ConvertSimpleToFwRule(fws []FwRuleSimple) []FwRule
ConvertSimpleToFwRule ...
func ParseRecords ¶
ParseRecords is to parse
func ReadFWRulesFile ¶
The goal is to read an CSV file and convert it to firewall rules. The assumtion is that the file is in the right format as the function ParseRecords on his package expected. ReadFWRulesFile gets a file patch, reads it and return a slice of FwRule
type FwRuleSimple ¶
type FwRuleSimple struct { // If the Type FwRule is used, FwRuleIdx is the index of FwRule FwRuleIdx int SrcIP string // Srouce IP SrcZone string // Source Zone SrcInt string // Source Interface DstIP string // Destination IP DstZone string // Destination Zone DstInt string // Destination Interface Protocol string // TCP/UDP Port string Application string Needed bool // If firewall rule is needed }
FwRuleSimple ...
func ConvertFwRuleToSimple ¶
func ConvertFwRuleToSimple(fwr []FwRule) []FwRuleSimple
ConvertFwRuleToSimple converts a slice of FwRule to a slice of FwRuleSimple