bramr / tor-exits
从tor项目获取tor出口列表,并以方便的方式提供。
v1.0.0
2016-11-21 22:58 UTC
Requires
- php: >=5.6.0
- guzzlehttp/guzzle: ~6.0
- psr/http-message: ~1.0
- psr/log: ~1.0
Requires (Dev)
- monolog/monolog: ^1.21
- php-mock/php-mock: ~1.0
- phpunit/phpunit: ~5.0
This package is not auto-updated.
Last update: 2024-09-23 13:13:30 UTC
README
一个简单的库,用于检索当前方便的Tor出口节点/中继列表。
安装
安装tor-exits最简单的方法是使用Composer。
composer require bramr/tor-exits
用法
$clientIp = '127.0.0.1'; //simplest example using tor project exit node list $parser = new TorProjectParser(new TorProjectCollector()); $ipList = IpList::fromParserWithCache($parser, new IpListJsonCache()); if ($ipList->contains($clientIp)) { echo 'client uses Tor.'; }
还有更多配置选项,更多复杂示例请参阅:example.php
重要
请勿使用此代码直接阻止来自Tor网络的用户。
使用Tor有完全合理的理由。(以及更好的方法来阻止您网站的所有Tor流量)
也请勿每小时刷新列表超过一次。
共识文档仅每小时更新一次,因此更频繁地获取出口节点列表是没有意义的。
我自己不在生产环境中使用此代码。我主要用它在个人项目中。
如果您遇到问题,请随时联系我。我不介意帮忙。
许可协议
MIT,详情请见LICENSE文件。