Documentation ¶
Overview ¶
Package proxyprotocol is adapted from: https://github.com/armon/go-proxyproto
The MIT License (MIT)
Copyright (c) 2014 Armon Dadgar ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Index ¶
- func AddForwardedFor(req *http.Request)
- func AddHeaders(req *http.Request, httpsPorts map[int]bool)
- func StateCleanup(conn net.Conn, connState http.ConnState)
- type Conn
- func (p *Conn) Close() error
- func (p *Conn) LocalAddr() net.Addr
- func (p *Conn) Read(b []byte) (int, error)
- func (p *Conn) RemoteAddr() net.Addr
- func (p *Conn) SetDeadline(t time.Time) error
- func (p *Conn) SetReadDeadline(t time.Time) error
- func (p *Conn) SetWriteDeadline(t time.Time) error
- func (p *Conn) Write(b []byte) (int, error)
- type Listener
- type ProxyProtoInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddForwardedFor ¶ added in v0.14.0
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn is used to wrap an underlying connection which may be speaking the Proxy Protocol. If it is, when Read() is called, the Proxy protocol header will be stripped and added to the context.
func NewConn ¶
NewConn is used to wrap a net.Conn that may be speaking the proxy protocol into a proxyproto.Conn
func (*Conn) Read ¶
Read checks for the proxy protocol header when doing the initial scan. If there is an error parsing the header, it is returned and the socket is closed.
func (*Conn) RemoteAddr ¶
type Listener ¶
Listener is used to wrap an underlying listener, whose connections may be using the HAProxy Proxy Protocol (version 1). If the connection is using the protocol, the RemoteAddr() will return the correct client address.