_info.py 929 B

123456789101112131415161718192021222324252627282930313233343536
  1. # -*- test-case-name: twisted.protocols.haproxy.test -*-
  2. # Copyright (c) Twisted Matrix Laboratories.
  3. # See LICENSE for details.
  4. """
  5. IProxyInfo implementation.
  6. """
  7. from zope.interface import implementer
  8. from ._interfaces import IProxyInfo
  9. @implementer(IProxyInfo)
  10. class ProxyInfo(object):
  11. """
  12. A data container for parsed PROXY protocol information.
  13. @ivar header: The raw header bytes extracted from the connection.
  14. @type header: bytes
  15. @ivar source: The connection source address.
  16. @type source: L{twisted.internet.interfaces.IAddress}
  17. @ivar destination: The connection destination address.
  18. @type destination: L{twisted.internet.interfaces.IAddress}
  19. """
  20. __slots__ = (
  21. 'header',
  22. 'source',
  23. 'destination',
  24. )
  25. def __init__(self, header, source, destination):
  26. self.header = header
  27. self.source = source
  28. self.destination = destination