fowardproxyserverts
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

ForwardProxyServer(IOptions)

  • The propose is to abstract all the hard logic needed to operate a foward proxy network.
  • It recives and store's foward tcp connections, by Jwt Auth and extends the net.Socket to allow the tcp foward connection to be used as a proxyxw

@param Options: IOptions

{ logginLevel: 6, port: 3000, host: 'localhost', keepAliveDelay: 10, keepAliveTimeout: 600, headersTimeout: 5,s jwtAuth: async (jwt: string, upstream: Upstream) => true, upstreamOptions: { keepAliveMaxTime: 60000, maxSocketPoolSize: 3, keepAliveRetryBeforeClose: 2, keepAliveDelay: 10 } };

@method bindRequest(request:net.socket, jwt:string) : Void

. This binds a socket from the upstream refrenced by the Jwt in memory to the request. . This approach remove all the task id load from the server, allowing a better performance and less compute for each network request

@method start() : Void

. This starts the server by listen a defined port (IOptions.port)

@method close() : Void

. This ends a server by removing the listen and all the memory and Upstream connection.

@route Get '/jwt'

. This endpoint is a GET request to the '/jwt' path. It is used to authenticate a user and manage upstream connections based on the provided JWT (JSON Web Token).

. RETURN

  • A Iternalprotcol with the following properties:
  • code: The HTTP like status code of the response.
  • key: A string used to set the upstream on memory

@route Get '/upstream'

. This endpoint is a GET request to the '/upstream' path. This endpoint is a GET request to the '/upstream' path. It is used to store the upsrtream

. RETURN

  • A Iternalprotcol with the following properties:
  • code: The HTTP like status code of the response.
  • next: A boolean value indicating whether the user has more upstream connections to make.

@route Get 'gate/id' : Void

. This endpoint is a GET request to the '/gate/id' path. It is used to authenticate a user and pipe the request connections based on the provided Id (key in memory).

@route Get '/metrics' : prometheus metrics responce

. This exposes an prometheus object and allow better login within the Server instance.

@event 'onConnection', upstream: IUpstream

. When a upstream connects and is Auth and ready to be use, sends the Upstream object

@event 'onClose', upstream: IUpstream

. When a upstream connections array are empty removes from memory, sends the Upstream object

@event 'onGateError', error

. When a request fails to pipe , it returns the error

@public var 'hashedKey'

. Return an minifyed version of the hash key, helpfull with redis Key

Readme

Keywords

none

Package Sidebar

Install

npm i fowardproxyserverts

Weekly Downloads

0

Version

1.0.3

License

ISC

Unpacked Size

86.9 kB

Total Files

25

Last publish

Collaborators

  • mrboris