damanraaj / ehpi

Enhanced Proxy Protocol Implementation (E.H.P.I.)

Home Page:https://rexagod.github.io/ehpi/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ehpi - Enhanced Proxy Protocol Implementation

testing

ehpi supports both forward and reverse proxying types.

Forward Proxy Flow

forward-proxy-flow

Reverse Proxy Flow

reverse-proxy-flow

HTML-rendered documentation can be found here.

API

Table of Contents

index

ehpi - Enhanced HTTP Proxy Implementation module.

zlib

Used for Gzip stream compression of the response.

http

Used to access internal HTTP APIs.

net

Used to access internal Socket APIs.

url

Used to parse host information.

Cache

Used for caching response stream from the target.

ehpiConsole

Enable debug logging by passing DEBUG=ehpi.

ehpi

Constructs an ehpi instance.

Parameters

  • options Object The configuration options for the proxy server.

port

Server's port number.

onServerError

Server's internal error event handler.

onBeforeRequest

Server's before request event handler.

onBeforeResponse

Server's before response event handler.

onRequestError

Server's request error event handler.

start

Starts the Proxy Server.

requestHandler

Server's global request handler.

Parameters
  • req Object The request stream object literal.
  • res Object The response stream object literal.

connectHandler

Handles SYN operation back to socket after connection is established, else throws.

Parameters
  • req Object The request stream object literal.
  • socket Object The socket used for SYN operation.

requestRemote

Initiates request from the Proxy server for the requested resource.

Parameters

  • requestOptions Object The host, port, path, method, and header values.
  • req Object The request stream object literal.
  • res Object The response stream object literal.
  • proxy Object The instantiated ehpi instance.

ontargeterror

Acknowledges Tunnel errors and attempts to gracefully close the socket, else throw.

Parameters

  • e Object The error object literal.

connectRemote

Attempts to connect to target URI and establish a tunnel.

Parameters

  • requestOptions Object The host, port, path, method, and header values.
  • socket Object The socket used for SYN operation.

_synReply

Utility function that writes input to socket.

Parameters

  • socket Object The socket used for SYN operation.
  • code number The HTTP status code.
  • reason string The event that resulted in this SYN operation.
  • headers Object The HTTP headers.
  • cb Object The error handler callback.

Flowchart

flowchart

About

Enhanced Proxy Protocol Implementation (E.H.P.I.)

https://rexagod.github.io/ehpi/

License:GNU General Public License v3.0


Languages

Language:JavaScript 98.2%Language:Shell 1.8%