{"id":21846204,"url":"https://github.com/owenvoke/dht-search","last_synced_at":"2025-07-27T04:08:16.827Z","repository":{"id":57046097,"uuid":"87832777","full_name":"owenvoke/dht-search","owner":"owenvoke","description":"A collection of tools for searching DHT via PHP.","archived":false,"fork":false,"pushed_at":"2019-06-03T15:39:57.000Z","size":34,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-14T13:32:18.703Z","etag":null,"topics":["dht","php"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/pxgamer/dht-search","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/owenvoke.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-10T16:22:49.000Z","updated_at":"2024-12-13T11:48:54.000Z","dependencies_parsed_at":"2022-08-24T03:40:28.146Z","dependency_job_id":null,"html_url":"https://github.com/owenvoke/dht-search","commit_stats":null,"previous_names":["pxgamer/dht-search"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/owenvoke/dht-search","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owenvoke%2Fdht-search","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owenvoke%2Fdht-search/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owenvoke%2Fdht-search/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owenvoke%2Fdht-search/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/owenvoke","download_url":"https://codeload.github.com/owenvoke/dht-search/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owenvoke%2Fdht-search/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266094373,"owners_count":23875623,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dht","php"],"created_at":"2024-11-27T23:13:16.645Z","updated_at":"2025-07-27T04:08:16.809Z","avatar_url":"https://github.com/owenvoke.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dht-search\n\n[![Latest Version on Packagist][ico-version]][link-packagist]\n[![Software License][ico-license]](LICENSE.md)\n[![Build Status][ico-travis]][link-travis]\n[![Style CI][ico-styleci]][link-styleci]\n[![Code Coverage][ico-code-quality]][link-code-quality]\n[![Total Downloads][ico-downloads]][link-downloads]\n\nA collection of tools for searching DHT via PHP.\n\n## Structure\n\n```\nsrc/\ntests/\nvendor/\n```\n\n## Install\n\nVia Composer\n\n``` bash\n$ composer require pxgamer/dht\n```\n\n## Usage\n\n``` php\n$serv = null;\n\n$this-\u003enode_id = Base::get_node_id();\n\n$table = array();\n\n$last_find = time();\n\n$threads = [];\n\nLogger::write(date('Y-m-d H:i:s', time()) . \" - Starting service...\\n\");\n\n$serv = new swoole_server('0.0.0.0', 6882, SWOOLE_PROCESS, SWOOLE_SOCK_UDP);\n$serv-\u003eset(array(\n    'worker_num' =\u003e WORKER_NUM,\n    'daemonize' =\u003e false,\n    'max_request' =\u003e MAX_REQUEST,\n    'dispatch_mode' =\u003e 2,\n    'log_file' =\u003e ABSPATH . '/error.log'\n));\n$serv-\u003eon('WorkerStart', function ($serv, $worker_id) {\n    swoole_timer_tick(AUTO_FIND_TIME, 'timer');\n    auto_find_node();\n});\n$serv-\u003eon('Receive', function ($serv, $fd, $from_id, $data) {\n\n    if (strlen($data) == 0) {\n        return false;\n    }\n\n\n    $msg = Base::decode($data);\n    if (empty($msg['y'])) {\n        return false;\n    }\n\n\n    $fdinfo = $serv-\u003econnection_info($fd, $from_id);\n    if (empty($fdinfo['remote_ip'])) {\n        return false;\n    }\n\n\n    if ($msg['y'] == 'r') {\n\n        if (array_key_exists('nodes', $msg['r'])) {\n            Response::action($msg, array($fdinfo['remote_ip'], $fdinfo['remote_port']));\n        }\n    } elseif ($msg['y'] == 'q') {\n\n        Request::action($msg, array($fdinfo['remote_ip'], $fdinfo['remote_port']));\n    } else {\n        return false;\n    }\n});\n\n$serv-\u003estart();\n```\n\n## Change log\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Testing\n\n``` bash\n$ composer test\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) and [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) for details.\n\n## Security\n\nIf you discover any security related issues, please email owzie123@gmail.com instead of using the issue tracker.\n\n## Credits\n\n- [pxgamer][link-author]\n- [All Contributors][link-contributors]\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n[ico-version]: https://img.shields.io/packagist/v/pxgamer/dht-search.svg?style=flat-square\n[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square\n[ico-travis]: https://img.shields.io/travis/pxgamer/dht-search/master.svg?style=flat-square\n[ico-styleci]: https://styleci.io/repos/87832777/shield\n[ico-code-quality]: https://img.shields.io/codecov/c/github/pxgamer/dht-search.svg?style=flat-square\n[ico-downloads]: https://img.shields.io/packagist/dt/pxgamer/dht-search.svg?style=flat-square\n\n[link-packagist]: https://packagist.org/packages/pxgamer/dht-search\n[link-travis]: https://travis-ci.org/pxgamer/dht-search\n[link-styleci]: https://styleci.io/repos/87832777\n[link-code-quality]: https://codecov.io/gh/pxgamer/dht-search\n[link-downloads]: https://packagist.org/packages/pxgamer/dht-search\n[link-author]: https://github.com/pxgamer\n[link-contributors]: ../../contributors\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fowenvoke%2Fdht-search","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fowenvoke%2Fdht-search","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fowenvoke%2Fdht-search/lists"}