From 13883973e5f425e992c1b6cdad36f5cdfe1f79c8 Mon Sep 17 00:00:00 2001 From: sid Date: Sat, 8 Oct 2016 23:49:10 +1300 Subject: [PATCH] A bit more readme and tidying up comments --- README.md | 19 +++++++++++++++++-- src/Tor/TorDetector.php | 1 + 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c091ab0..a980694 100644 --- a/README.md +++ b/README.md @@ -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) \ No newline at end of file diff --git a/src/Tor/TorDetector.php b/src/Tor/TorDetector.php index 7ce2e7b..bfe348e 100644 --- a/src/Tor/TorDetector.php +++ b/src/Tor/TorDetector.php @@ -11,6 +11,7 @@ * * Thanks to https://jrnv.nl/detecting-the-use-of-proxies-and-tor-network-6c240d6cc5f#.k8ldcs21o * + * @package OnlineSid\Tor */ class TorDetector {