Replaced all proto numbers in netutils with the defined const
Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
This commit is contained in:
parent
db2f7c6f28
commit
560d156e36
|
@ -134,11 +134,11 @@ type Protocol uint8
|
||||||
|
|
||||||
func (p Protocol) String() string {
|
func (p Protocol) String() string {
|
||||||
switch p {
|
switch p {
|
||||||
case 1:
|
case ICMP:
|
||||||
return "icmp"
|
return "icmp"
|
||||||
case 6:
|
case TCP:
|
||||||
return "tcp"
|
return "tcp"
|
||||||
case 17:
|
case UDP:
|
||||||
return "udp"
|
return "udp"
|
||||||
default:
|
default:
|
||||||
return fmt.Sprintf("%d", p)
|
return fmt.Sprintf("%d", p)
|
||||||
|
@ -149,11 +149,11 @@ func (p Protocol) String() string {
|
||||||
func ParseProtocol(s string) Protocol {
|
func ParseProtocol(s string) Protocol {
|
||||||
switch strings.ToLower(s) {
|
switch strings.ToLower(s) {
|
||||||
case "icmp":
|
case "icmp":
|
||||||
return 1
|
return ICMP
|
||||||
case "udp":
|
case "udp":
|
||||||
return 17
|
return UDP
|
||||||
case "tcp":
|
case "tcp":
|
||||||
return 6
|
return TCP
|
||||||
default:
|
default:
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue