{"id":18640531,"url":"https://github.com/rexagod/ehpi-dev","last_synced_at":"2025-10-22T10:51:03.362Z","repository":{"id":117709679,"uuid":"330644023","full_name":"rexagod/ehpi-dev","owner":"rexagod","description":"EHPI project repository for ASDP course.","archived":false,"fork":false,"pushed_at":"2021-01-18T11:44:30.000Z","size":100,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-17T15:39:00.831Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rexagod.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":"2021-01-18T11:24:12.000Z","updated_at":"2021-01-18T11:44:34.000Z","dependencies_parsed_at":"2023-10-04T14:36:57.351Z","dependency_job_id":null,"html_url":"https://github.com/rexagod/ehpi-dev","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rexagod/ehpi-dev","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rexagod%2Fehpi-dev","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rexagod%2Fehpi-dev/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rexagod%2Fehpi-dev/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rexagod%2Fehpi-dev/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rexagod","download_url":"https://codeload.github.com/rexagod/ehpi-dev/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rexagod%2Fehpi-dev/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280424212,"owners_count":26328462,"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-10-22T02:00:06.515Z","response_time":63,"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":[],"created_at":"2024-11-07T05:54:50.737Z","updated_at":"2025-10-22T10:51:03.357Z","avatar_url":"https://github.com/rexagod.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ehpi - Enhanced Proxy Protocol Implementation\n\n![testing](./assets/test.png)\n\n**`ehpi` supports both forward and reverse proxying types.**\n\n### Forward Proxy Flow\n\n![forward-proxy-flow](./assets/fpf.svg)\n\n### Reverse Proxy Flow\n\n![reverse-proxy-flow](./assets/rpf.svg)\n\n**HTML-rendered documentation can be found [here](https://rexagod.github.io/ehpi/).**\n\n## API\n\n\n\u003c!-- Generated by documentation.js. Update this documentation by updating the source code. --\u003e\n\n#### Table of Contents\n\n-   [index](#index)\n-   [zlib](#zlib)\n-   [http](#http)\n-   [net](#net)\n-   [url](#url)\n-   [Cache](#cache)\n-   [ehpiConsole](#ehpiconsole)\n-   [ehpi](#ehpi)\n    -   [Parameters](#parameters)\n    -   [port](#port)\n    -   [port](#port-1)\n    -   [onServerError](#onservererror)\n    -   [onBeforeRequest](#onbeforerequest)\n    -   [onBeforeResponse](#onbeforeresponse)\n    -   [onRequestError](#onrequesterror)\n    -   [start](#start)\n    -   [requestHandler](#requesthandler)\n        -   [Parameters](#parameters-1)\n    -   [connectHandler](#connecthandler)\n        -   [Parameters](#parameters-2)\n-   [requestRemote](#requestremote)\n    -   [Parameters](#parameters-3)\n-   [ontargeterror](#ontargeterror)\n    -   [Parameters](#parameters-4)\n-   [connectRemote](#connectremote)\n    -   [Parameters](#parameters-5)\n-   [\\_synReply](#_synreply)\n    -   [Parameters](#parameters-6)\n\n### index\n\nehpi - Enhanced HTTP Proxy Implementation module.\n\n### zlib\n\nUsed for Gzip stream compression of the response.\n\n### http\n\nUsed to access internal HTTP APIs.\n\n### net\n\nUsed to access internal Socket APIs.\n\n### url\n\nUsed to parse host information.\n\n### Cache\n\nUsed for caching response stream from the target.\n\n### ehpiConsole\n\nEnable debug logging by passing `DEBUG=ehpi`.\n\n### ehpi\n\nConstructs an ehpi instance.\n\n#### Parameters\n\n-   `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The configuration options for the proxy server.\n\n#### port\n\nServer's port number.\n\n#### onServerError\n\nServer's internal error event handler.\n\n#### onBeforeRequest\n\nServer's before request event handler.\n\n#### onBeforeResponse\n\nServer's before response event handler.\n\n#### onRequestError\n\nServer's request error event handler.\n\n#### start\n\nStarts the Proxy Server.\n\n#### requestHandler\n\nServer's global request handler.\n\n##### Parameters\n\n-   `req` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The request stream object literal.\n-   `res` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The response stream object literal.\n\n#### connectHandler\n\nHandles SYN operation back to socket after connection is established, else throws.\n\n##### Parameters\n\n-   `req` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The request stream object literal.\n-   `socket` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The socket used for SYN operation.\n\n### requestRemote\n\nInitiates request from the Proxy server for the requested resource.\n\n#### Parameters\n\n-   `requestOptions` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The host, port, path, method, and header values.\n-   `req` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The request stream object literal.\n-   `res` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The response stream object literal.\n-   `proxy` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The instantiated ehpi instance.\n\n### ontargeterror\n\nAcknowledges Tunnel errors and attempts to gracefully close the socket, else throw.\n\n#### Parameters\n\n-   `e` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The error object literal.\n\n### connectRemote\n\nAttempts to connect to target URI and establish a tunnel.\n\n#### Parameters\n\n-   `requestOptions` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The host, port, path, method, and header values.\n-   `socket` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The socket used for SYN operation.\n\n### \\_synReply\n\nUtility function that writes input to socket.\n\n#### Parameters\n\n-   `socket` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The socket used for SYN operation.\n-   `code` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** The HTTP status code.\n-   `reason` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The event that resulted in this SYN operation.\n-   `headers` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The HTTP headers.\n-   `cb` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The error handler callback.\n\n## Flowchart\n\n![flowchart](./assets/ehpi.svg)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frexagod%2Fehpi-dev","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frexagod%2Fehpi-dev","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frexagod%2Fehpi-dev/lists"}