mirror of
https://github.com/M66B/NetGuard.git
synced 2024-12-25 01:07:52 +00:00
Added protocol names
This commit is contained in:
parent
eb84155b8a
commit
06a6af716b
1 changed files with 14 additions and 1 deletions
|
@ -450,24 +450,37 @@ public class Util {
|
||||||
public static String getProtocolName(int protocol, int version, boolean brief) {
|
public static String getProtocolName(int protocol, int version, boolean brief) {
|
||||||
// https://en.wikipedia.org/wiki/List_of_IP_protocol_numbers
|
// https://en.wikipedia.org/wiki/List_of_IP_protocol_numbers
|
||||||
String p = null;
|
String p = null;
|
||||||
|
String b = null;
|
||||||
switch (protocol) {
|
switch (protocol) {
|
||||||
case 0:
|
case 0:
|
||||||
p = "HOPO";
|
p = "HOPO";
|
||||||
|
b = "H";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
p = "IGMP";
|
||||||
|
b = "G";
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
case 58:
|
case 58:
|
||||||
p = "ICMP";
|
p = "ICMP";
|
||||||
|
b = "I";
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
p = "TCP";
|
p = "TCP";
|
||||||
|
b = "T";
|
||||||
break;
|
break;
|
||||||
case 17:
|
case 17:
|
||||||
p = "UDP";
|
p = "UDP";
|
||||||
|
b = "U";
|
||||||
|
break;
|
||||||
|
case 50:
|
||||||
|
p = "ESP";
|
||||||
|
b = "E";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (p == null)
|
if (p == null)
|
||||||
return Integer.toString(protocol) + "/" + version;
|
return Integer.toString(protocol) + "/" + version;
|
||||||
return ((brief ? p.substring(0, 1) : p) + (version > 0 ? version : ""));
|
return ((brief ? b : p) + (version > 0 ? version : ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface DoubtListener {
|
public interface DoubtListener {
|
||||||
|
|
Loading…
Reference in a new issue