Skip to content

Commit

Permalink
chore: correct typos in system/network/ping.go
Browse files Browse the repository at this point in the history
Log:
(cherry picked from commit 30df307)
  • Loading branch information
felixonmars authored and fly602 committed Sep 4, 2024
1 parent 4108809 commit 8db8a21
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions system/network1/ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ const (
typeEchoReply = 0
typeEchoRequestIPV6 = 128
typeEchoReplyIPV6 = 129
typeNetUnrechable = 3
typeNetUnreachable = 3

codeNetUnrechable = 0
codeHostUnrechable = 1
codeProtocolUnrechable = 2
codePortUnrechable = 3
codeNetUnreachable = 0
codeHostUnreachable = 1
codeProtocolUnreachable = 2
codePortUnreachable = 3

ipHeaderMinLen = 20
ipProtocolICMP = 1
Expand Down Expand Up @@ -231,19 +231,19 @@ func handleICMPReply(icmp *ICMP) error {
if icmp.Type == typeEchoReply {
return nil
}
if icmp.Type != typeNetUnrechable {
if icmp.Type != typeNetUnreachable {
return fmt.Errorf("unknown error")
}

var msg string
switch icmp.Code {
case codeNetUnrechable:
case codeNetUnreachable:
msg = "network unreachable"
case codeHostUnrechable:
case codeHostUnreachable:
msg = "host unreachable"
case codeProtocolUnrechable:
case codeProtocolUnreachable:
msg = "protocol unreachable"
case codePortUnrechable:
case codePortUnreachable:
msg = "host port unreachable"
}
return fmt.Errorf(msg)
Expand Down

0 comments on commit 8db8a21

Please sign in to comment.