Skip to content

Commit ff686e5

Browse files
author
speruri
committed
Address remaining review comments
- Improve Accept() method documentation with suggested text - Remove duplicate PP2_TYPE_SSL constant, use inline constant reference - Simplify hasTLVSSL function Signed-off-by: speruri <surya.srikar.peruri@zalando.de>
1 parent b57da4a commit ff686e5

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

proxylistener/proxylistener.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ type tlvExtractorListener struct {
9494
wrapped net.Listener
9595
}
9696

97+
// Accept extracts SSL information from a ProxyHeader if the net.Conn is a proxyproto.Conn
98+
// and stores it in an internal data structure. You can get the information by using
99+
// GetProxyProtoSSL.
97100
func (tl *tlvExtractorListener) Accept() (net.Conn, error) {
98101
conn, err := tl.wrapped.Accept()
99102
if err != nil {
@@ -161,11 +164,10 @@ func (c *tlvCacheCleanupConn) SetWriteDeadline(t time.Time) error {
161164
return c.conn.SetWriteDeadline(t)
162165
}
163166

164-
// hasTLVSSL checks if the TLV list contains SSL information (type 0x20)
167+
// hasTLVSSL checks if the TLV list contains SSL information (type 0x20).
165168
func hasTLVSSL(tlvs []proxyproto.TLV) bool {
166-
const PP2_TYPE_SSL = 0x20
167169
for _, tlv := range tlvs {
168-
if tlv.Type == PP2_TYPE_SSL {
170+
if tlv.Type == 0x20 { // PP2_TYPE_SSL
169171
return true
170172
}
171173
}

0 commit comments

Comments
 (0)