fix: parse udp4, udp6, tcp4 or tcp6

This commit is contained in:
Quentin McGaw
2022-10-16 16:54:12 +00:00
parent cb804577a9
commit c954e6f231
2 changed files with 3 additions and 3 deletions

View File

@@ -81,7 +81,7 @@ func extractProto(line string) (protocol string, err error) {
}
switch fields[1] {
case "tcp", "udp":
case "tcp", "tcp4", "tcp6", "udp", "udp4", "udp6":
default:
return "", fmt.Errorf("%w: %s", errProtocolNotSupported, fields[1])
}

View File

@@ -25,9 +25,9 @@ func ExtractProto(b []byte) (tcp, udp bool, err error) {
s = strings.TrimSpace(s)
s = strings.ToLower(s)
switch s {
case "tcp":
case "tcp", "tcp4", "tcp6":
return true, false, nil
case "udp":
case "udp", "udp4", "udp6":
return false, true, nil
default:
return false, false, fmt.Errorf("%w: %s", ErrUnknownProto, s)