Skip to main content

Helper script to emulate a local CNAME DNS by writing to /etc/hosts

Project description

===========
Local CNAME
===========

.. image:: https://img.shields.io/pypi/v/local-cname.svg
:target: https://pypi.python.org/pypi/local-cname
:alt: Latest Version

.. image:: https://img.shields.io/pypi/status/local-cname.svg
:target: https://pypi.python.org/pypi/local-cname
:alt: Development Status

.. image:: https://img.shields.io/pypi/pyversions/local-cname.svg
:target: https://pypi.python.org/pypi/local-cname
:alt: Python Versions

.. image:: https://img.shields.io/pypi/l/local-cname.svg
:target: https://github.com/hjacobs/local-cname/blob/master/LICENSE
:alt: License

This is a little helper script to emulate a local CNAME DNS by writing to ``/etc/hosts``.
DNS changes (e.g. to rollout new services) can be tested by overwriting DNS names in the local ``/etc/hosts`` file.
The hosts file only supports IP addresses thus making it cumbersome to emulate a DNS ``CNAME`` without a local DNS server/proxy.
The ``local-cname`` is a very small script to automatically lookup DNS names and write IP addresses to the hosts file.
It is self-contained and restores your local ``/etc/hosts`` file on exit (press CTRL+C).

Installation:

.. code-block:: bash

$ sudo pip install -U local-cnames

Usage:

.. code-block:: bash
$ cat /etc/cnames
google.com=duckduckgo.com

$ sudo local-cnames
# press CTRL+C to cancel and restore your old /etc/hosts

Example:

.. code-block:: bash
$ cat /etc/cnames
google.com=duckduckgo.com

$ sudo local-cnames
$ ping google.com




Project details


Release history Release notifications | RSS feed

This version

0.4

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

local_cnames-0.4-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file local_cnames-0.4-py3-none-any.whl.

File metadata

  • Download URL: local_cnames-0.4-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.2

File hashes

Hashes for local_cnames-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1c1021767c69414e7105895fe75a4d3752784c31633702037872fe723732ac5e
MD5 e125aeff4c8cb4577a00e8f4cd7c7f8c
BLAKE2b-256 e43f56e4f5540e0b0e840bb4bda79d8d8848e7118716cd36269700948b02e9dd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page