added proxyprotocol parser
This commit is contained in:
parent
70fd3f71e5
commit
4bf887e75f
1 changed files with 12 additions and 0 deletions
|
|
@ -25,6 +25,18 @@ const (
|
||||||
ProxyProtocolV2 = "v2"
|
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 {
|
type LoadBalancer struct {
|
||||||
Name string `json:"name,omitempty"`
|
Name string `json:"name,omitempty"`
|
||||||
IP string `json:"ip,omitempty"`
|
IP string `json:"ip,omitempty"`
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue