File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ type Entry struct {
17
17
18
18
// This regex can detect a line in the iptables added by portmap to do the
19
19
// forwarding. The following two are examples of lines (notice that one has the
20
- // destinateion IP and the other does not):
20
+ // destination IP and the other does not):
21
21
// -A CNI-DN-2e2f8d5b91929ef9fc152 -d 127.0.0.1/32 -p tcp -m tcp --dport 8081 -j DNAT --to-destination 10.4.0.7:80
22
22
// -A CNI-DN-04579c7bb67f4c3f6cca0 -p tcp -m tcp --dport 8082 -j DNAT --to-destination 10.4.0.10:80
23
23
// The -A on the front is to amend the rule that was already created. portmap
@@ -27,7 +27,7 @@ type Entry struct {
27
27
// ipv4 IP address. We need to detect this IP.
28
28
// --dport is the destination port. We need to detect this port
29
29
// -j DNAT this tells us it's the line doing the port forwarding.
30
- var findPortRegex = regexp .MustCompile (`.* -A\W +CNI-DN-\w*\W +(?:-d ((?:\b25[0-5]|\b2[0-4][0-9]|\b[01]?[0-9][0-9]?)(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}))?(?:/\d+\W+ )?-p.*--dport (\d+) -j DNAT` )
30
+ var findPortRegex = regexp .MustCompile (`-A\s +CNI-DN-\w*\s +(?:-d ((?:\b25[0-5]|\b2[0-4][0-9]|\b[01]?[0-9][0-9]?)(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}))?(?:/32\s+ )?-p .*--dport (\d+) -j DNAT` )
31
31
32
32
func GetPorts () ([]Entry , error ) {
33
33
// TODO: add support for ipv6
You can’t perform that action at this time.
0 commit comments