moznion's tech blog

moznion's technical memo

Published proxy-protocol-js

(Japanese article is here: https://moznion.hatenadiary.com/entry/2019/04/30/131509 )

I had published a library that is named proxy-protocol-js.

github.com

www.npmjs.com

This library recognizes the PROXY protocol and has responsibilities for building and parsing the protocol for JavaScript and TypeScript (for details of PROXY protocol, please refer to the following the spec: https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt ).

This library's strengths are the following:

  • Supports V1 (text protocol) and V2 (binary protocol)
  • Supports multipurpose functions
    • To build a protocol payload
    • To parse a protocol payload
    • To identify the protocol version according to a protocol payload
  • Better performance than existing implementations
  • Supports TypeScript (i.e. this library is written in TypeScript)
  • No extra dependencies

Enjoy!