{"id":16949461,"url":"https://github.com/tailhook/tk-listen","last_synced_at":"2025-09-01T03:09:11.033Z","repository":{"id":57669936,"uuid":"84469462","full_name":"tailhook/tk-listen","owner":"tailhook","description":"A library that allows to listen network sockets with proper resource limits and error handling","archived":false,"fork":false,"pushed_at":"2018-12-29T19:11:18.000Z","size":37,"stargazers_count":30,"open_issues_count":4,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-07-30T03:57:26.850Z","etag":null,"topics":["asynchronous","futures","listen","network","rust","tcp","tokio"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tailhook.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-09T17:21:29.000Z","updated_at":"2023-02-08T08:42:24.000Z","dependencies_parsed_at":"2022-09-26T20:40:40.086Z","dependency_job_id":null,"html_url":"https://github.com/tailhook/tk-listen","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/tailhook/tk-listen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tailhook%2Ftk-listen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tailhook%2Ftk-listen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tailhook%2Ftk-listen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tailhook%2Ftk-listen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tailhook","download_url":"https://codeload.github.com/tailhook/tk-listen/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tailhook%2Ftk-listen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273067153,"owners_count":25039748,"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","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["asynchronous","futures","listen","network","rust","tcp","tokio"],"created_at":"2024-10-13T21:54:48.097Z","updated_at":"2025-09-01T03:09:11.016Z","avatar_url":"https://github.com/tailhook.png","language":"Rust","readme":"Tokio Listen Helpers\n====================\n\n**Status: Beta**\n\n[Documentation](https://docs.rs/tk-listen) |\n[Github](https://github.com/tailhook/tk-listen) |\n[Crate](https://crates.io/crates/tk-listen)\n\n\nA library that allows to listen network sockets with proper resource limits\nand error handling.\n\nBasic challenges:\n\n* Some connection accept errors (like \"connection reset\") must be ignored, some\n  (like \"too many files open\") may consume 100% CPU when ignored. You need\n  to know what to do with them every time\n* Server must accept connections up to a certain limit to avoid DoS attacks\n* Shutting down listener and update the set of addresses listened\n  should be obvious to implement\n\n\nExample\n=======\n\nHere is the basic example:\n\n```rust\n\nlet TIME_TO_WAIT_ON_ERROR = Duration::from_millis(100);\nlet MAX_SIMULTANEOUS_CONNECTIONS = 1000;\n\nlet mut lp = Core::new().unwrap();\nlet listener = TcpListener::bind(\u0026addr, \u0026lp.handle()).unwrap();\nlp.run(\n    listener.incoming()\n    .sleep_on_error(TIME_TO_WAIT_ON_ERROR, \u0026h2)\n    .map(move |(mut socket, _addr)| {\n         // Your future is here:\n         Proto::new(socket)\n         // Errors should not pass silently\n         // common idea is to log them\n         .map_err(|e| error!(\"Protocol error: {}\", e))\n    })\n    .listen(MAX_SIMULTANEOUS_CONNECTIONS)\n).unwrap(); // stream doesn't end in this case\n```\n\nMore in [docs] and [examples]\n\n[docs]: http://docs.rs/tk-listen/\n[examples]: https://github.com/tailhook/tk-listen/tree/master/examples\n\nLicense\n=======\n\nLicensed under either of\n\n* Apache License, Version 2.0,\n  (./LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)\n* MIT license (./LICENSE-MIT or http://opensource.org/licenses/MIT)\n  at your option.\n\nContribution\n------------\n\nUnless you explicitly state otherwise, any contribution intentionally\nsubmitted for inclusion in the work by you, as defined in the Apache-2.0\nlicense, shall be dual licensed as above, without any additional terms or\nconditions.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftailhook%2Ftk-listen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftailhook%2Ftk-listen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftailhook%2Ftk-listen/lists"}