https://github.com/vicanso/ips
Check ip is exists in iplist
https://github.com/vicanso/ips
ip ips
Last synced: 8 months ago
JSON representation
Check ip is exists in iplist
- Host: GitHub
- URL: https://github.com/vicanso/ips
- Owner: vicanso
- License: apache-2.0
- Created: 2019-08-02T12:58:13.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2021-03-20T05:10:40.000Z (over 5 years ago)
- Last Synced: 2024-12-27T19:44:58.186Z (over 1 year ago)
- Topics: ip, ips
- Language: Go
- Size: 13.7 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ips
[](https://github.com/vicanso/ips/actions)
Check ip is exists in iplist.
## API
```go
ips := ips.NewWithoutMutex()
ips.Add("12.12.12.12", "12.12.12.13", "192.168.1.1/24")
fmt.Println(ips.Contains("192.168.1.1"))
ips.Replace("1.1.1.1")
ips.Reset()
```
If you need to change the ip anytime, you shuuld add `mutex`.
```go
ips := ips.New()
ips.Add("12.12.12.12")
ips.Add("12.12.12.13")
ips.Add("192.168.1.1/24")
fmt.Println(ips.Contains("192.168.1.1"))
ips.Replace("1.1.1.1")
ips.Reset()
```