NIC 对象绑定IP还未实现完成 明天继续

This commit is contained in:
impact-eintr
2022-11-24 21:32:04 +08:00
parent e51d8ea721
commit 4589d971fd
5 changed files with 165 additions and 10 deletions

View File

@@ -108,12 +108,11 @@ type Stats struct {
}
func (a Address) String() string {
fmt.Println(string(a), len(a))
switch len(a) {
case 4:
fmt.Println(string(a))
return fmt.Sprintf("%d.%d.%d.%d", int(a[0]), int(a[1]), int(a[2]), int(a[3]))
case 16:
fmt.Println(string(a))
// Find the longest subsequence of hexadecimal zeros.
start, end := -1, -1
for i := 0; i < len(a); i += 2 {