Skip to content

Commit

Permalink
A bit more readme and tidying up comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sid committed Oct 8, 2016
1 parent 10607c4 commit 1388397
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
# tor-detector
# Tor Detector PHP library
A library to detect if your website visitor is from a TOR network or not.

At the moment this is achieved by using a DNS lookup method as described in https://trac.torproject.org/projects/tor/wiki/doc/TorDNSExitList

# Credit
## Usage

```php
$tor_detector = new OnlineSid\Tor\TorDetector();

$your_server_ip = '1.2.3.4'; // the IP address of your server (web server)
$user_ip = '62.102.148.67'; // is this IP from TOR exit node?

if ($tor_detector->check($user_ip, 80, $your_server_ip)) {
echo "Tor!\n";
} else {
echo "Not TOR!\n";
}
```

## Credit
Original code is taken from https://jrnv.nl/detecting-the-use-of-proxies-and-tor-network-6c240d6cc5f (it wasn't working but very close)
1 change: 1 addition & 0 deletions src/Tor/TorDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*
* Thanks to https://jrnv.nl/detecting-the-use-of-proxies-and-tor-network-6c240d6cc5f#.k8ldcs21o
*
* @package OnlineSid\Tor
*/
class TorDetector
{
Expand Down

0 comments on commit 1388397

Please sign in to comment.