mirror of
https://github.com/clearlinux/libnetwork.git
synced 2026-09-07 06:11:49 +00:00
Replaced all proto numbers in netutils with the defined const
Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
This commit is contained in:
+6
-6
@@ -134,11 +134,11 @@ type Protocol uint8
|
||||
|
||||
func (p Protocol) String() string {
|
||||
switch p {
|
||||
case 1:
|
||||
case ICMP:
|
||||
return "icmp"
|
||||
case 6:
|
||||
case TCP:
|
||||
return "tcp"
|
||||
case 17:
|
||||
case UDP:
|
||||
return "udp"
|
||||
default:
|
||||
return fmt.Sprintf("%d", p)
|
||||
@@ -149,11 +149,11 @@ func (p Protocol) String() string {
|
||||
func ParseProtocol(s string) Protocol {
|
||||
switch strings.ToLower(s) {
|
||||
case "icmp":
|
||||
return 1
|
||||
return ICMP
|
||||
case "udp":
|
||||
return 17
|
||||
return UDP
|
||||
case "tcp":
|
||||
return 6
|
||||
return TCP
|
||||
default:
|
||||
return 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user