| 73 | } |
| 74 | |
| 75 | func TestIPList_Update(t *testing.T) { |
| 76 | var ipList = iplibrary.NewIPList() |
| 77 | ipList.Add(&iplibrary.IPItem{ |
| 78 | Id: 1, |
| 79 | IPFrom: iputils.ToBytes("192.168.1.1"), |
| 80 | }) |
| 81 | |
| 82 | t.Log("===before===") |
| 83 | logs.PrintAsJSON(ipList.ItemsMap(), t) |
| 84 | logs.PrintAsJSON(ipList.SortedRangeItems(), t) |
| 85 | logs.PrintAsJSON(ipList.IPMap(), t) |
| 86 | |
| 87 | /**ipList.Add(&iplibrary.IPItem{ |
| 88 | Id: 2, |
| 89 | IPFrom: iputils.ToBytes("192.168.1.1"), |
| 90 | })**/ |
| 91 | ipList.Add(&iplibrary.IPItem{ |
| 92 | Id: 1, |
| 93 | //IPFrom: 123, |
| 94 | IPTo: iputils.ToBytes("192.168.1.2"), |
| 95 | }) |
| 96 | |
| 97 | t.Log("===after===") |
| 98 | logs.PrintAsJSON(ipList.ItemsMap(), t) |
| 99 | logs.PrintAsJSON(ipList.SortedRangeItems(), t) |
| 100 | logs.PrintAsJSON(ipList.IPMap(), t) |
| 101 | } |
| 102 | |
| 103 | func TestIPList_Update_AllItems(t *testing.T) { |
| 104 | var ipList = iplibrary.NewIPList() |