# mini_buildd.net module

Network abstraction

Doctest Examples:

    # Client: Twisted syntax
    >>> ClientEndpoint("tcp:host=example.com:port=1234", protocol="http").geturl()
    'http://example.com:1234'
    >>> ClientEndpoint("tls:host=example.com:port=1234", protocol="http").geturl()
    'https://example.com:1234'

    # Client: URL syntax
    >>> ce = ClientEndpoint("http://example.com:1234/")
    >>> ce.description
    'tcp:host=example.com:port=1234'
    >>> ClientEndpoint("https://example.com:1234").description
    'tls:host=example.com:port=1234'
    >>> ClientEndpoint("https://example.com:1234").geturl(with_user=True, path="api", query={"a": "b", "c": "d"})
    'https://example.com:1234/api?a=b&c=d'
    >>> ClientEndpoint("https://foo@example.com:1234").geturl(with_user=False, path="api", query={"a": "b", "c": "d"})
    'https://example.com:1234/api?a=b&c=d'
    >>> ClientEndpoint("https://bar@example.com:1234").geturl(with_user=True, path="api", query={"a": "b", "c": "d"})
    'https://bar@example.com:1234/api?a=b&c=d'

class mini_buildd.net.TwistedEndpoint(description)

  Bases: `object`

  SUPPORTED_TYPES = ['ssl', 'tls', 'tcp6', 'tcp', 'unix']
  is_ssl()

class mini_buildd.net.Endpoint(description, protocol)

  Bases: `TwistedEndpoint`

  netloc(with_user=True, user=None)
  get_user()
  set_user(user)
  hopo()
  scheme()
  geturl(with_user=False, user=None, path='', query=None, relative=False)

class mini_buildd.net.ServerEndpoint(description, protocol)

  Bases: `Endpoint`

  Twisted-style Network Server Endpoint

  See: https://twistedmatrix.com/documents/current/core/howto/endpoints.html#servers

  Notation Examples:

      'tcp6:port=8066'                                     : Unencrypted, bind on all interfaces.
      'ssl:port=8066:privateKey=KEY_PATH:certKey=CERT_PATH': Encrypted, bind on all interfaces.
      'tcp6:interface=localhost:port=8066'                 : Unencrypted, bind on localhost only.

  get_certificate()

class mini_buildd.net.ClientEndpoint(description, protocol='http')

  Bases: `Endpoint`

  Twisted-style Network Client Endpoint

  See: https://twistedmatrix.com/documents/current/core/howto/endpoints.html#clients

  Notation Examples:

      'tcp:host=localhost:port=8066': Connect to localhost, unencrypted.
      'tls:host=localhost:port=8066': Connect to localhost, encrypted.
      'http://localhost:8066'       : Extra URL-style syntax (prefer twisted-style in saved configs, though).
      'localhost:8066'              : Compatibility host:port syntax (don't use -- might eventually go away).

  get_certificate()
  login(password)
  logout()
  logged_in()
  urlopen(url, timeout=None)
  http_connect()

mini_buildd.net.detect_apt_cacher_ng(url='http://localhost:3142')

  Little heuristic helper for the “local archives” wizard