added proxyprotocol parser

This commit is contained in:
ston1th 2021-10-20 20:25:02 +02:00
commit 4bf887e75f

View file

@ -25,6 +25,18 @@ const (
ProxyProtocolV2 = "v2"
)
func ParseProxyProtocol(s string) (pp ProxyProtocol, err error) {
switch s {
case "v1":
pp = ProxyProtocolV1
case "v2":
pp = ProxyProtocolV2
default:
err = errors.New("invalid proxyprotocol version")
}
return
}
type LoadBalancer struct {
Name string `json:"name,omitempty"`
IP string `json:"ip,omitempty"`