From f9d6223af524e91a88ec71c14b7db69c605c9aad Mon Sep 17 00:00:00 2001 From: Yegor Sak Date: Sat, 21 Jan 2023 01:40:33 +0000 Subject: [PATCH] Update README.md Deleted docs/controld_config.md --- README.md | 69 ++++++++++++++++++++++++++++++++++++++--- docs/controld_config.md | 15 --------- 2 files changed, 64 insertions(+), 20 deletions(-) delete mode 100644 docs/controld_config.md diff --git a/README.md b/README.md index 96734cb..65fd2f9 100644 --- a/README.md +++ b/README.md @@ -42,23 +42,32 @@ $ go install github.com/Control-D-Inc/ctrld/cmd/ctrld@latest ## Arguments ``` + __ .__ .___ + _____/ |________| | __| _/ +_/ ___\ __\_ __ \ | / __ | +\ \___| | | | \/ |__/ /_/ | + \___ >__| |__| |____/\____ | + \/ dns forwarding proxy \/ + Usage: ctrld [command] Available Commands: - help Help about any command run Run the DNS proxy server + service Manage ctrld service + start Quick start service and configure DNS on default interface + stop Quick stop service and remove DNS from default interface Flags: - -h, --help help for ctrld - -v, --verbose verbose log output - --version version for ctrld + -h, --help help for ctrld + -v, --verbose count verbose log output, "-v" basic logging, "-vv" debug level logging + --version version for ctrld Use "ctrld [command] --help" for more information about a command. ``` ## Usage -To start the server with default configuration, simply run: `ctrld run`. This will create a generic `config.toml` file in the working directory and start the service. +To start the server with default configuration, simply run: `./ctrld run`. This will create a generic `ctrld.toml` file in the **working directory** and start the application in foreground. 1. Start the server ``` $ sudo ./ctrld run @@ -73,6 +82,56 @@ To start the server with default configuration, simply run: `ctrld run`. This wi If `verify.controld.com` resolves, you're successfully using the default Control D upstream. +### Service Mode +To run the application in service mode, simply run: `./ctrld start` as system/root user. This will create a generic `ctrld.toml` file in the **user home** directory, start the system service, and configure the listener on the default interface. Service will start on OS boot. + +In order to stop the service, and restore your DNS to original state, simply run `./ctrld stop`. + +For granular control of the service, run the `service` command. Each sub-command has its own help section so you can see what arguments you can supply. + +``` + Manage ctrld service + + Usage: + ctrld service [command] + + Available Commands: + interfaces Manage network interfaces + restart Restart the ctrld service + start Start the ctrld service + status Show status of the ctrld service + stop Stop the ctrld service + uninstall Uninstall the ctrld service + + Flags: + -h, --help help for service + + Global Flags: + -v, --verbose count verbose log output, "-v" basic logging, "-vv" debug level logging + + Use "ctrld service [command] --help" for more information about a command. +``` + +### Control D Auto Configuration +Application can be started with a specific resolver config, instead of the default one. Simply supply your resolver ID with a `--cd` flag, when using the `run` (foreground) or `start` (service) modes. + +The following command will start the application in foreground mode, using the free "p2" resolver, which blocks Ads & Trackers. + +```shell +./ctrld run --cd p2 +``` + +Alternatively, you can use your own personal Control D Device resolver, and start the application in service mode. Your resolver ID is the part after the slash of your DNS-over-HTTPS resolver. ie. https://dns.controld.com/abcd1234 + +```shell +./ctrld start --cd abcd1234 +``` + +Once you run the above command, the following things will happen: +- You resolver configuration will be fetched from the API, and config file templated with the resolver data +- Application will start as a service, and keep running (even after reboot) until you run the `stop` or `service uninstall` sub-commands +- Your default network interface will be updated to use the listener started by the service +- All OS DNS queries will be sent to the listener ## Configuration ### Example diff --git a/docs/controld_config.md b/docs/controld_config.md deleted file mode 100644 index 20c9c5b..0000000 --- a/docs/controld_config.md +++ /dev/null @@ -1,15 +0,0 @@ -# Control D config - -`ctrld` can build a Control D config and run with the specific resolver data. - -For example: - -```shell -ctrld run --cd p2 -``` - -Above command will fetch the `p2` resolver data from Control D API and use that data for running `ctrld`: - - - The resolver `doh` endpoint will be used as the primary upstream. - - The resolver `exclude` list will be used to create a rule policy which will steer them to the default OS resolver. -```