fix: parse udp4, udp6, tcp4 or tcp6
This commit is contained in:
@@ -81,7 +81,7 @@ func extractProto(line string) (protocol string, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch fields[1] {
|
switch fields[1] {
|
||||||
case "tcp", "udp":
|
case "tcp", "tcp4", "tcp6", "udp", "udp4", "udp6":
|
||||||
default:
|
default:
|
||||||
return "", fmt.Errorf("%w: %s", errProtocolNotSupported, fields[1])
|
return "", fmt.Errorf("%w: %s", errProtocolNotSupported, fields[1])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,9 +25,9 @@ func ExtractProto(b []byte) (tcp, udp bool, err error) {
|
|||||||
s = strings.TrimSpace(s)
|
s = strings.TrimSpace(s)
|
||||||
s = strings.ToLower(s)
|
s = strings.ToLower(s)
|
||||||
switch s {
|
switch s {
|
||||||
case "tcp":
|
case "tcp", "tcp4", "tcp6":
|
||||||
return true, false, nil
|
return true, false, nil
|
||||||
case "udp":
|
case "udp", "udp4", "udp6":
|
||||||
return false, true, nil
|
return false, true, nil
|
||||||
default:
|
default:
|
||||||
return false, false, fmt.Errorf("%w: %s", ErrUnknownProto, s)
|
return false, false, fmt.Errorf("%w: %s", ErrUnknownProto, s)
|
||||||
|
|||||||
Reference in New Issue
Block a user