ContainsExpires 判断是否包含某个IP
(ipBytes []byte)
| 98 | |
| 99 | // ContainsExpires 判断是否包含某个IP |
| 100 | func (this *IPList) ContainsExpires(ipBytes []byte) (expiresAt int64, ok bool) { |
| 101 | if this.isDeleted { |
| 102 | return |
| 103 | } |
| 104 | |
| 105 | this.mu.RLock() |
| 106 | defer this.mu.RUnlock() |
| 107 | |
| 108 | if len(this.allItemsMap) > 0 { |
| 109 | return 0, true |
| 110 | } |
| 111 | |
| 112 | var item = this.lookupIP(ipBytes) |
| 113 | |
| 114 | if item == nil { |
| 115 | return |
| 116 | } |
| 117 | |
| 118 | return item.ExpiredAt, true |
| 119 | } |
| 120 | |
| 121 | // ContainsIPStrings 是否包含一组IP中的任意一个,并返回匹配的第一个Item |
| 122 | func (this *IPList) ContainsIPStrings(ipStrings []string) (item *IPItem, found bool) { |