host-rs

Crates.iohost-rs
lib.rshost-rs
version0.2.3
sourcesrc
created_at2024-06-21 02:49:49.1469
updated_at2024-10-23 09:59:36.555996
descriptionThis is a CLI tool to manage website blocking, unblocking, redirection.
homepagehttps://github.com/BiswajitThakur/host-rs
repositoryhttps://github.com/BiswajitThakur/host-rs
max_upload_size
id1279057
size59,814
Biswajit Thakur (BiswajitThakur)

documentation

README

Host-RS

Blazingly fast CLI tool written in Rust to manage website blocking, unblocking, redirection.

Features

  • Block Website: Add websites to blocklist to prevent access.
  • Unblock Website: Remove websites from the blocklist to allow access.
  • Redirect Website: Redirect traffic from one website to another.
  • Add Host Sources: Add host source (A url that contains a list of hostnames).
  • Update Host Sources: Update host sources.
  • Import hosts: Import hostnames stored in a file and block or unblock them.
  • Export hosts: Export the list of currently blocked or unblocked hosts.

Installation

Ensure you have Rust installed (If you dont want to install Rust, install from precompiled binary).

Linux & macOS

git clone https://github.com/BiswajitThakur/host-rs.git
cd host-rs/
./install.sh

Other

cargo install host-rs

Usage

  • Help
> host-rs --help
This is a CLI tool to manage website blocking, unblocking, redirection.

Usage: host-rs [OPTIONS] [COMMAND]

Commands:
  insert  Add host or url to allow, block, redirect, sources list
  remove  Remove allow, block, redirect host and host sources
  print   Print allow, block, redirect, etc host and host sources
  import  Import host or url from file
  export  Expoer user data (you can import it later)
  update  Update sources or self
  help    Print this message or the help of the given subcommand(s)

Options:
      --allow <ALLOW>...        Add host to allow list & removed from block list
      --block <BLOCK>...        Add to block list & remove from allow list
      --redirect <REDIRECT>...  Add to redirect list & remove from allow and block
      --restore                 delete all host, host sources and restore /etc/hosts file
  -h, --help                    Print help
  -V, --version                 Print version
  • Block Website
host-rs --block <url or hostname1> <url or hostname2> ...
  • Remove Website from Blocklist
host-rs rm --block <url or hostname1> <url or hostname2> ...
# or
# host-rs remove --block <url or hostname1> <url or hostname2> ...
  • Allow Website

use this when, you added hostsources and if it block some website and you don't want to block it.

host-rs --allow <url or hostname1> <url or hostname2> ...
  • Remove Website from Allow List
host-rs rm --allow <url or hostname1> <url or hostname2> ...
  • Redirection

In the following example, <url or hostname2> redirected to <url or hostname1> and <url or hostname4> redirected to <url or hostname3>

host-rs --redirect <url or hostname1> <url or hostname2> <url or hostname3> <url or hostname4> ...
  • Remove from Redirect
host-rs rm --redirect <url or hostname2> <url or hostname4> ...
  • Add Host Sources

You will get verious sources from this repo.

host-rs insert --sources <url of sources>
  • Update Host Sources
host-rs update --sources
  • Remove Host Sources
host-rs remove --sources <url of sources>
  • Uninstall
host-rs remove --self

Contributing

Contributions are welcome! If you find any bugs, want to request a new feature or improve the code feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Commit count: 70

cargo fmt