File tree Expand file tree Collapse file tree 1 file changed +22
-22
lines changed Expand file tree Collapse file tree 1 file changed +22
-22
lines changed Original file line number Diff line number Diff line change @@ -68,29 +68,29 @@ func GetPorts() ([]Entry, error) {
68
68
func parsePortsFromRules (rules []string ) ([]Entry , error ) {
69
69
var entries []Entry
70
70
for _ , rule := range rules {
71
- if found := findPortRegex .FindStringSubmatch (rule ); found != nil {
72
- if len (found ) == 4 {
73
- port64 , err := strconv .ParseInt (found [3 ], 10 , 32 )
74
- if err != nil {
75
- return nil , err
76
- }
77
- port := int (port64 )
78
-
79
- istcp := found [2 ] == "tcp"
80
-
81
- // When no IP is present the rule applies to all interfaces.
82
- ip := found [1 ]
83
- if ip == "" {
84
- ip = "0.0.0.0"
85
- }
86
- ent := Entry {
87
- IP : net .ParseIP (ip ),
88
- Port : port ,
89
- TCP : istcp ,
90
- }
91
- entries = append (entries , ent )
92
- }
71
+ found := findPortRegex .FindStringSubmatch (rule )
72
+ if len (found ) != 4 {
73
+ continue
74
+ }
75
+ port64 , err := strconv .ParseInt (found [3 ], 10 , 32 )
76
+ if err != nil {
77
+ return nil , err
78
+ }
79
+ port := int (port64 )
80
+
81
+ isTCP := found [2 ] == "tcp"
82
+
83
+ // When no IP is present the rule applies to all interfaces.
84
+ ip := found [1 ]
85
+ if ip == "" {
86
+ ip = "0.0.0.0"
87
+ }
88
+ ent := Entry {
89
+ IP : net .ParseIP (ip ),
90
+ Port : port ,
91
+ TCP : isTCP ,
93
92
}
93
+ entries = append (entries , ent )
94
94
}
95
95
96
96
return entries , nil
You can’t perform that action at this time.
0 commit comments