Skip to content

Commit 615166d

Browse files
authored
Merge pull request #13 from icgood/doc
Fix generated API doc issues
2 parents ed13d16 + aed9fb4 commit 615166d

6 files changed

Lines changed: 25 additions & 25 deletions

File tree

doc/source/proxyprotocol.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@
4747
.. automodule:: proxyprotocol.result
4848
:members:
4949

50+
``proxyprotocol.tlv``
51+
----------------------
52+
53+
.. automodule:: proxyprotocol.tlv
54+
:members:
55+
:undoc-members:
56+
5057
``proxyprotocol.sock``
5158
----------------------
5259

proxyprotocol/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def build(self, source: Address, dest: Address, *, family: AddressFamily,
135135
protocol: The original socket protocol.
136136
ssl: The original socket SSL information.
137137
unique_id: The original connection unique identifier.
138-
proxied: True if the connection should not be considered proxied.
138+
proxied: True if the connection should be considered proxied.
139139
140140
Raises:
141141
:exc:`KeyError`: This PROXY protocol header format does not support

proxyprotocol/sock.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ class SocketInfo:
1818
"""Provides information about the connection, from either the underlying
1919
:mod:`asyncio` transport layer or overridden by the PROXY protocol result.
2020
21-
Undocumented properties will pass through as calls to
22-
:meth:`~asyncio.BaseTransport.get_extra_info` and will raise
23-
:exc:`AttributeError` if there is no value available.
24-
2521
Args:
2622
transport: The :class:`~asyncio.BaseTransport` or
2723
:class:`~asyncio.StreamWriter` for the connection.
@@ -96,23 +92,23 @@ def sockname(self) -> Address:
9692
@property
9793
def sockname_ip(self) -> Union[None, IPv4Address, IPv6Address]:
9894
"""The IP address object from :attr:`.sockname`, for
99-
:attr:`~socket.AF_INET` or :attr:`~socket.AF_INET6` connections.
95+
:data:`~socket.AF_INET` or :data:`~socket.AF_INET6` connections.
10096
10197
"""
10298
return self._get_ip(self.sockname)
10399

104100
@property
105101
def sockname_port(self) -> Optional[int]:
106102
"""The port number from :attr:`.sockname`, for
107-
:attr:`~socket.AF_INET` or :attr:`~socket.AF_INET6` connections.
103+
:data:`~socket.AF_INET` or :data:`~socket.AF_INET6` connections.
108104
109105
"""
110106
return self._get_port(self.sockname)
111107

112108
@property
113109
def sockname_str(self) -> Optional[str]:
114110
"""The :attr:`.sockname` address as a string. For
115-
:attr:`~socket.AF_INET`/:attr:`~socket.AF_INET6` families, this is
111+
:data:`~socket.AF_INET`/:data:`~socket.AF_INET6` families, this is
116112
``ip:port``.
117113
118114
"""
@@ -136,23 +132,23 @@ def peername(self) -> Address:
136132
@property
137133
def peername_ip(self) -> Union[None, IPv4Address, IPv6Address]:
138134
"""The IP address object from :attr:`.peername`, for
139-
:attr:`~socket.AF_INET` or :attr:`~socket.AF_INET6` connections.
135+
:data:`~socket.AF_INET` or :data:`~socket.AF_INET6` connections.
140136
141137
"""
142138
return self._get_ip(self.peername)
143139

144140
@property
145141
def peername_port(self) -> Optional[int]:
146142
"""The port number from :attr:`.peername`, for
147-
:attr:`~socket.AF_INET` or :attr:`~socket.AF_INET6` connections.
143+
:data:`~socket.AF_INET` or :data:`~socket.AF_INET6` connections.
148144
149145
"""
150146
return self._get_port(self.peername)
151147

152148
@property
153149
def peername_str(self) -> Optional[str]:
154150
"""The :attr:`.peername` address as a string. For
155-
:attr:`~socket.AF_INET`/:attr:`~socket.AF_INET6` families, this is
151+
:data:`~socket.AF_INET`/:data:`~socket.AF_INET6` families, this is
156152
``ip:port``.
157153
158154
"""
@@ -254,11 +250,11 @@ def unique_id(self) -> bytes:
254250
def from_localhost(self) -> bool:
255251
"""True for local socket connections, if:
256252
257-
* :attr:`.family` is :attr:`~socket.AF_UNIX`, or
253+
* :attr:`.family` is :data:`~socket.AF_UNIX`, or
258254
* :attr:`.peername_ip` has True
259255
:attr:`~ipaddress.IPv4Address.is_loopback` flag.
260256
261-
To be specific, True for :attr:`~socket.AF_UNIX` connections and True
257+
To be specific, True for :data:`~socket.AF_UNIX` connections and True
262258
for IPv4/IPv6 connections with True
263259
:attr:`~ipaddress.IPv4Address.is_loopback` flags.
264260

proxyprotocol/tlv.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from .typing import PeerCert
1212

1313
__all__ = ['Type', 'SSLClient', 'TLV', 'ProxyProtocolTLV',
14-
'ProxyProtocolSSLTLV']
14+
'ProxyProtocolSSLTLV', 'ProxyProtocolExtTLV']
1515

1616

1717
class Type(IntEnum):
@@ -209,12 +209,7 @@ def netns(self) -> Optional[str]:
209209

210210
@property
211211
def ext(self) -> ProxyProtocolExtTLV:
212-
"""The ``PP2_TYPE_NOOP`` value, possibly parsed as an extension TLV.
213-
214-
See Also:
215-
:class:`ProxyProtocolExtTLV`
216-
217-
"""
212+
"""The ``PP2_TYPE_NOOP`` value, possibly parsed as an extension TLV."""
218213
val = self.get(Type.PP2_TYPE_NOOP)
219214
if val is not None:
220215
return ProxyProtocolExtTLV(val)
@@ -381,6 +376,8 @@ class ProxyProtocolExtTLV(TLV):
381376
382377
"""
383378

379+
#: The ``PP2_TYPE_NOOP`` value must begin with this byte sequence to be
380+
#: parsed as a :class:`ProxyProtocolExtTLV`.
384381
MAGIC_PREFIX: ClassVar[bytes] = b'\x88\x1b\x79\xc1\xce\x96\x85\xb0'
385382

386383
_secret_bits_fmt = Struct('!H')
@@ -416,7 +413,7 @@ def _pack(self) -> bytes:
416413
@property
417414
def compression(self) -> Optional[str]:
418415
"""The ``PP2_SUBTYPE_EXT_COMPRESSION`` value. This is used by the
419-
:attr:`~proxyprotocol.sock.SockInfo.compression` value.
416+
:attr:`~proxyprotocol.sock.SocketInfo.compression` value.
420417
421418
"""
422419
val = self.get(Type.PP2_SUBTYPE_EXT_COMPRESSION)
@@ -427,7 +424,7 @@ def compression(self) -> Optional[str]:
427424
@property
428425
def secret_bits(self) -> Optional[int]:
429426
"""The ``PP2_SUBTYPE_EXT_SECRET_BITS`` value. This is used to populate
430-
the third member of the: attr: `~proxyprotocol.sock.SockInfo.cipher`
427+
the third member of the: attr:`~proxyprotocol.sock.SocketInfo.cipher`
431428
tuple.
432429
433430
"""
@@ -440,7 +437,7 @@ def secret_bits(self) -> Optional[int]:
440437
@property
441438
def peercert(self) -> Optional[PeerCert]:
442439
"""The ``PP2_SUBTYPE_EXT_PEERCERT`` value. This is used by the
443-
:attr:`~proxyprotocol.sock.SockInfo.peercert` value.
440+
:attr:`~proxyprotocol.sock.SocketInfo.peercert` value.
444441
445442
"""
446443
val = self.get(Type.PP2_SUBTYPE_EXT_PEERCERT)

proxyprotocol/v2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def build_header(self, data_len: int, *,
164164
data_len: The length of the data (addresses + TLV).
165165
family: The original socket family.
166166
protocol: The original socket protocol.
167-
proxied: True if the connection should not be considered proxied.
167+
proxied: True if the connection should be considered proxied.
168168
169169
"""
170170
byte_12 = 0x20 + self._commands_r['proxy' if proxied else 'local']

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
license = f.read()
2929

3030
setup(name='proxy-protocol',
31-
version='0.5.3',
31+
version='0.5.4',
3232
author='Ian Good',
3333
author_email='[email protected]',
3434
description='PROXY protocol library with asyncio server implementation',

0 commit comments

Comments
 (0)