{"id":37030214,"url":"https://github.com/ericmpapa/khtunnel","last_synced_at":"2026-01-14T03:40:51.659Z","repository":{"id":57733141,"uuid":"417411946","full_name":"ericmpapa/khtunnel","owner":"ericmpapa","description":"a simple library which tunnels TCP communication in HTTP","archived":false,"fork":false,"pushed_at":"2021-10-17T21:59:28.000Z","size":87,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-07-27T15:47:31.492Z","etag":null,"topics":["http","kotlin","network","tcp","tunneling"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/ericmpapa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-15T07:45:38.000Z","updated_at":"2021-10-27T21:56:01.000Z","dependencies_parsed_at":"2022-09-26T22:11:16.677Z","dependency_job_id":null,"html_url":"https://github.com/ericmpapa/khtunnel","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/ericmpapa/khtunnel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericmpapa%2Fkhtunnel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericmpapa%2Fkhtunnel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericmpapa%2Fkhtunnel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericmpapa%2Fkhtunnel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ericmpapa","download_url":"https://codeload.github.com/ericmpapa/khtunnel/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericmpapa%2Fkhtunnel/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408854,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"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":["http","kotlin","network","tcp","tunneling"],"created_at":"2026-01-14T03:40:50.822Z","updated_at":"2026-01-14T03:40:51.644Z","avatar_url":"https://github.com/ericmpapa.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# khtunnel\n**khtunnel** is a simple library which is used to tunnel a tcp communication in http.\nThis library can be used to build any application which needs to use TCP to HTTP tunneling for, for example, bypassing a firewall.\n## Example\nThe basic usage of khtunnel is for relaying, using HTTP, a TCP communication between 2 endpoints.  \nThus the basic architecture of the communication is **TCP source -\u003e HTTP tunnel client -\u003e HTTP tunnel server -\u003e TCP destination**.  \n### HTTP TUNNEL CLIENT\n```kotlin\n/* HTTP tunnel Client */\nThread{\n    val listeningPort = 10111\n    val outgoingPort = 10112 // HTTP tunnel server listening port\n    val outgoingAddress = \"127.0.0.1\" // HTTP tunnel server address\n    val serverSocket = ServerSocket(listeningPort)\n    while(true){\n        val inSocket = serverSocket.accept()\n        val outSocket = Socket(outgoingAddress,outgoingPort)\n        /* HTTP tunnel client channel */\n        Thread(TcpToHttpTunnelHandler(inSocket,outSocket)).start() // listens to incoming communications from TCP source in raw TCP and encapsulates the message in HTTP before relaying it to the HTTP tunnel server.\n        Thread(HttpToTcpTunnelHandler(outSocket,inSocket)).start() // listens to incoming communications in HTTP from HTTP tunnel server and relays the payload (http body) as a raw tcp message.\n    }\n}.start()\n```\n### HTTP TUNNEL SERVER\n```kotlin\n/* HTTP tunnel Server */\nThread{\n    val listeningPort = 10112\n    val outgoingPort = 10113 // TCP destination listening port\n    val outgoingAddress = \"127.0.0.1\" // TCP destination address\n    val serverSocket = ServerSocket(listeningPort)\n    while(true){\n        val inSocket = serverSocket.accept()\n        val outSocket = Socket(outgoingAddress,outgoingPort)\n        /* HTTP tunnel server channel (it's the reverse of the client) */\n        Thread(HttpToTcpTunnelHandler(inSocket,outSocket)).start() // listens to incoming communications in HTTP and relays the payload (http body) as a raw tcp message to the TCP destination.\n        Thread(TcpToHttpTunnelHandler(outSocket,inSocket)).start() // listens to incoming communications from HTTP tunnel client in raw TCP and encapsulates the message in HTTP before relaying it.\n    }\n}.start()\n```\n\n## How to build  \nsimply run:  \n```bash\n./gradlew build\n```\n## Gradle installation from maven central  \nKotlin DSL    \n```kotlin\nimplmentation(\"io.github.ericmpapa:khtunnel:1.0\")\n```\nGroovy DSL  \n```groovy\nimplementation \"io.github.ericmpapa:khtunnel:1.0\"\n```\n\n## Documentation\n\n[Check some use cases](https://github.com/ericmpapa/khtunnel/wiki)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericmpapa%2Fkhtunnel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fericmpapa%2Fkhtunnel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericmpapa%2Fkhtunnel/lists"}