Skip to content

Repository files navigation

proxyprotocol

GoDocBuild Status

This package provides PROXY protocol support for versions 1 and 2.

https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt

Features:

  • Auto detect both V1 and V2
  • Client & Server usage support
  • Listener with optional subnet filtering (for TCP/UDP listeners)

Installation

Installable via go get

go get -u github.com/mastercactapus/proxyprotocol

Usage

// Create any net.Listenerl, err:=net.Listen("tcp", ":0")
l, err:=net.Listen("udp", ":0")
l, err:=net.Listen("unix", "/tmp/example")
l, err:=net.Listen("unixgram", "/tmp/example")
// Wrap it to have RemoteAddr() and LocalAddr() resolved for all new connectionsl=proxyprotocol.NewListener(l, 0)
c, err : =l.Accept()
c.RemoteAddr() // = The PROXY header source addressc.LocalAddr() // = The PROXY header destination address

About

Client & server PROXY protocol support in Go.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages