mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-11-03 04:10:25 +08:00
优化代码
This commit is contained in:
@@ -4,7 +4,7 @@ package iputils
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"encoding/hex"
|
||||
"math"
|
||||
"math/big"
|
||||
"net"
|
||||
@@ -111,10 +111,10 @@ func ToHex(ip string) string {
|
||||
}
|
||||
|
||||
if rawIP.To4() != nil {
|
||||
return fmt.Sprintf("%x", rawIP.To4())
|
||||
return hex.EncodeToString(rawIP.To4())
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%x", rawIP.To16())
|
||||
return hex.EncodeToString(rawIP.To16())
|
||||
}
|
||||
|
||||
func ToLittleLong(ip string) string {
|
||||
|
||||
Reference in New Issue
Block a user