Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/IntelligenceX/ip2tor
IP2Tor allows to determine whether an IP address is a Tor exit node.
https://github.com/IntelligenceX/ip2tor
Last synced: 6 days ago
JSON representation
IP2Tor allows to determine whether an IP address is a Tor exit node.
- Host: GitHub
- URL: https://github.com/IntelligenceX/ip2tor
- Owner: IntelligenceX
- License: unlicense
- Created: 2020-07-04T22:49:42.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-07-06T17:23:11.000Z (over 4 years ago)
- Last Synced: 2024-08-02T20:44:31.836Z (3 months ago)
- Language: Go
- Homepage:
- Size: 9.77 KB
- Stars: 25
- Watchers: 3
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# IP2Tor
IP2Tor allows to check if an IP address is a Tor exit node. This can be used to identify and block traffic from the Tor network. IPv4 and IPv6 addresses are supported.
It will run a daemon to download the Tor list from below sources and update it according to the time specified. It optionally uses a local file to cache the last results and allow continuous operation even after restart of your application.
Tor node lists:
* https://check.torproject.org/torbulkexitlist
* https://www.dan.me.uk/tornodesIt was observed that those lists only match about 72%, so they are both used as source by this package.
## Usage
It is a Go package with no external dependencies. To download it:
```shell
go get -u github.com/IntelligenceX/ip2tor
```Then use it like this:
```go
package mainimport (
"github.com/IntelligenceX/ip2tor"
)func init() {
// Only download exit nodes, refetch the list every 2 hours.
// Cache it to the file "tor-ips.txt".
ip2tor.Init(1, time.Hour*2, "tor-ips.txt")
}func main() {
ip := net.ParseIP("1.2.3.4")ip2tor.IsTor(ip) // returns true or false
}
```