proxyprotocol: Add PROXY protocol support to reverse_proxy, add HTTP listener wrapper (#5424)

Co-authored-by: WeidiDeng <weidi_deng@icloud.com>
Co-authored-by: Francis Lavoie <lavofr@gmail.com>
This commit is contained in:
Corin Langosch
2023-03-31 23:44:53 +02:00
committed by GitHub
parent 66e571e687
commit b6fe5d4b41
9 changed files with 245 additions and 1 deletions

View File

@ -19,6 +19,7 @@ import (
"fmt"
"net"
"net/http"
"net/netip"
"strconv"
"sync/atomic"
@ -259,3 +260,13 @@ var hosts = caddy.NewUsagePool()
// dialInfoVarKey is the key used for the variable that holds
// the dial info for the upstream connection.
const dialInfoVarKey = "reverse_proxy.dial_info"
// proxyProtocolInfoVarKey is the key used for the variable that holds
// the proxy protocol info for the upstream connection.
const proxyProtocolInfoVarKey = "reverse_proxy.proxy_protocol_info"
// ProxyProtocolInfo contains information needed to write proxy protocol to a
// connection to an upstream host.
type ProxyProtocolInfo struct {
AddrPort netip.AddrPort
}