denpa / php-levin
monero的Levin协议的纯PHP实现。
v1.0.1
2019-02-23 22:46 UTC
Requires
- php: >=7.1
- ext-sockets: *
Requires (Dev)
- php-vfs/php-vfs: ^1.4
- phpunit/phpunit: ^7.0 | ^8.0
This package is auto-updated.
Last update: 2024-09-06 06:32:49 UTC
README
示例
require 'vendor/autoload.php'; use Denpa\Levin; $vars = [ 'network_id' => 'somenetwork', ]; Levin\connection($ip, $port, $vars)->connect( function ($bucket, $connection) { if ($bucket->isRequest('supportflags', 'timedsync', 'ping')) { // respond to supportflags, timedsync and ping requests // to keep the connection open $connection->write($bucket->response()); } if ($bucket->isResponse('handshake')) { // send ping request to the server after // receiving handshake response $connection->write(Levin\request('ping')); } if ($bucket->isResponse('ping')) { // dump server response to the console var_dump($bucket->getPayload()); // returning false closes connection return false; } } );
请求支持
通知支持
异常
Denpa\Levin\Exceptions\ConnectionException
- 在连接错误时抛出。Denpa\Levin\Exceptions\EntryTooLargeException
- 当类型或包大小过大时抛出。Denpa\Levin\Exceptions\SignatureMismatchException
- 在段或桶签名不匹配时抛出。Denpa\Levin\Exceptions\UnexpectedTypeException
- 在意外或无效类型时抛出。Denpa\Levin\Exceptions\UnknownCommandException
- 在未知命令时抛出。Denpa\Levin\Exceptions\UnpackException
- 在无法解包二进制数据时抛出。
许可证
本产品遵循MIT许可证分发。
鸣谢
基于py-levin进行开发。
捐赠
如果您喜欢这个项目,可以使用以下地址之一进行捐赠:
BTC
3L6dqSBNgdpZan78KJtzoXEk9DN3sgEQJu
Monero
458j3EKczYFEE1Gku9ENUgTj4KUtHbqP9hT82vFRdZHiBRfbVFDUE7QArtAB63cNZiKMgBgwrD4k1Wtac8ZgoKx2GUHFpo2
Safex
Safex61BqfGVucrCo71xPxhQi4L1oMaRYUHwBKMuHVy8UTR1HkBjhJx4WafkLvhSwUeshkonyDjvYFiBrRDeEcrL5k6JLALD85L2T
❤感谢您的支持!❤