{"id":13337954,"url":"https://github.com/Stazer/beluga","last_synced_at":"2025-03-11T08:32:01.667Z","repository":{"id":78048275,"uuid":"89493886","full_name":"Stazer/beluga","owner":"Stazer","description":null,"archived":false,"fork":false,"pushed_at":"2017-05-29T12:54:00.000Z","size":97,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-23T20:11:22.988Z","etag":null,"topics":["asio","asynchronous","boost","cpp","http","https","library","proxy","server","tcp","tls","udp"],"latest_commit_sha":null,"homepage":"","language":"C++","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/Stazer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-26T14:58:50.000Z","updated_at":"2021-04-16T08:37:37.000Z","dependencies_parsed_at":"2023-03-04T16:15:32.476Z","dependency_job_id":null,"html_url":"https://github.com/Stazer/beluga","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stazer%2Fbeluga","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stazer%2Fbeluga/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stazer%2Fbeluga/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stazer%2Fbeluga/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Stazer","download_url":"https://codeload.github.com/Stazer/beluga/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243000813,"owners_count":20219747,"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":["asio","asynchronous","boost","cpp","http","https","library","proxy","server","tcp","tls","udp"],"created_at":"2024-07-29T19:15:16.436Z","updated_at":"2025-03-11T08:32:01.623Z","avatar_url":"https://github.com/Stazer.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# beluga\n## Examples\n### Basic usage of tcp_server\n    boost::asio::io_service io_service;\n    auto server = beluga::tcp_server::create(io_service, boost::asio::ip::tcp::endpoint(boost::asio::ip::address::from_string(\"127.0.0.1\"), 8080));\n    \n\tserver-\u003eon_accept.connect\n\t    ([](beluga::tcp_server::accept_event\u0026 event)\n\t    {\n\t    \tauto client = beluga::tcp_client::create(event.get_socket());\n\t    });\n\n\tserver-\u003eaccept();\n\tio_service.run();\n\n### Redirect all incomming http requests to 138.201.77.50:80 and print request headers\n\tboost::asio::io_service io_service;\n\tauto server = beluga::tcp_server::create(io_service, boost::asio::ip::tcp::endpoint(boost::asio::ip::address::from_string(\"127.0.0.1\"), 8080));\n\t\n\tserver-\u003eon_accept.connect\n\t    ([] (beluga::tcp_server::accept_event\u0026 event)\n\t     {\n\t\t auto client = beluga::http_client::create(event.get_socket());\n\t\t auto server = beluga::tcp_client::create(client-\u003eget_socket().get_io_service());\n\n\t\t beluga::tcp_tunnel\u003c\u003e::create(client, server);\n\t\t \n\t\t client-\u003eon_request.connect\n\t\t     ([server] (beluga::http_client::request_event\u0026 event)\n\t\t      {\n\t\t\t  for(auto i:event.get_request().get_headers())\n\t\t\t      std::cout \u003c\u003c i.first \u003c\u003c \": \" \u003c\u003c i.second \u003c\u003c std::endl ;\n\t\t\t  \n\t\t\t  server-\u003econnect(boost::asio::ip::tcp::endpoint(boost::asio::ip::address::from_string(\"138.201.77.50\"), 80));\n\t\t      });\n\t\t \n\t\t client-\u003ereceive();\n\t     });\n\t\n\tserver-\u003eaccept();\n\tio_service.run();\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FStazer%2Fbeluga","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FStazer%2Fbeluga","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FStazer%2Fbeluga/lists"}