| Crates.io | muko |
| lib.rs | muko |
| version | 0.1.0 |
| created_at | 2025-10-23 03:40:50.839705+00 |
| updated_at | 2025-10-23 03:40:50.839705+00 |
| description | A command-line utility to manage hosts file entries and quickly toggle between development and production DNS settings |
| homepage | https://github.com/shi-yan/muko |
| repository | https://github.com/shi-yan/muko |
| max_upload_size | |
| id | 1896575 |
| size | 33,895 |
A command-line utility to manage hosts file entries and quickly toggle between development and production DNS settings.
The name muko comes from 向こう側 (mukō-gawa), meaning "the other side" in Japanese. This concept is famously featured in the Silent Hill video game series, where characters shift between the normal world and a dark, otherworldly dimension. Similarly, this tool lets you seamlessly switch between the "other side" of your development environment and the production reality.
As a developer, I often need to test applications locally by redirecting production domains to my local development environment. However, constantly editing the hosts file and commenting/uncommenting lines is tedious and error-prone. Muko solves this by providing a simple way to toggle domains between DEV mode (using custom IPs) and PROD mode (using real DNS) with a single command.
Install directly from the GitHub repository:
cargo install --git=https://github.com/shi-yan/muko.git
Note: This tool modifies /etc/hosts, so you'll need appropriate permissions (typically sudo) when running commands that modify the hosts file.
Simply run muko without any arguments to see all domains managed by muko:
muko
Muko-managed domains:
┌──────┬───────────────────────┬──────────┬───────────┬─────────┐
│ Mode ┆ Domain ┆ Alias ┆ Dev IP ┆ Prod IP │
╞══════╪═══════════════════════╪══════════╪═══════════╪═════════╡
│ DEV ┆ example.myapp.app ┆ myapp ┆ 127.0.0.1 ┆ │
└──────┴───────────────────────┴──────────┴───────────┴─────────┘
This displays a table showing:
Add a new domain entry to your hosts file:
# Add with default IP (127.0.0.1)
sudo muko add example.com
# Add with custom IP
sudo muko add example.com --ip 192.168.1.100
# Add with alias
sudo muko add example.com --ip 127.0.0.1 --alias myapp
After adding a domain, it's automatically set to DEV mode (active).
Uncomment a domain entry to use the custom dev IP:
# Using domain name
sudo muko dev example.com
# Using alias
sudo muko dev myapp
In DEV mode, the domain will resolve to your custom IP address (e.g., 127.0.0.1).
Comment out a domain entry to use the real production IP:
# Using domain name
sudo muko prod example.com
# Using alias
sudo muko prod myapp
Muko-managed domains:
┌──────┬───────────────────────┬──────────┬───────────┬───────────────┐
│ Mode ┆ Domain ┆ Alias ┆ Dev IP ┆ Prod IP │
╞══════╪═══════════════════════╪══════════╪═══════════╪═══════════════╡
│ PROD ┆ example.myapp.app. ┆ myapp ┆ 127.0.0.1 ┆ 140.210.45.28 │
└──────┴───────────────────────┴──────────┴───────────┴───────────────┘
In PROD mode, the domain entry is commented out, so DNS resolution falls back to the real production IP address.
Muko manages hosts file entries by adding a special tag #muko: to each line it creates. This allows the tool to:
Example hosts file entry managed by muko:
127.0.0.1 example.com #muko: myapp
When switched to PROD mode, this becomes:
#127.0.0.1 example.com #muko: myapp
# View current state
muko
# Add a production domain for local development
sudo muko add api.example.com --ip 127.0.0.1 --alias api
# Work on local development
# (api.example.com now points to 127.0.0.1)
# Need to test against production?
sudo muko prod api
# Back to development
sudo muko dev api
# Add multiple services
sudo muko add api.example.com --ip 127.0.0.1 --alias api
sudo muko add web.example.com --ip 127.0.0.1 --alias web
sudo muko add cdn.example.com --ip 127.0.0.1 --alias cdn
# View all at once
muko
# Switch all to prod when needed
sudo muko prod api
sudo muko prod web
sudo muko prod cdn
/etc/hosts (typically requires sudo)