From 7e75436f9a7bb544e752b99e1ff9557241b4d332 Mon Sep 17 00:00:00 2001 From: Emil Pandocchi Date: Wed, 9 Jun 2021 13:36:14 +0200 Subject: [PATCH] first commit --- .gitignore | 14 +++ LICENSE | 201 +++++++++++++++++++++++++++++++ README.md | 302 +++++++++++++++++++++++++++++++++++++++++++++++ build.sh | 70 +++++++++++ cmd/add.go | 64 ++++++++++ cmd/backup.go | 61 ++++++++++ cmd/comment.go | 65 ++++++++++ cmd/delete.go | 63 ++++++++++ cmd/export.go | 34 ++++++ cmd/output.go | 186 +++++++++++++++++++++++++++++ cmd/restore.go | 56 +++++++++ cmd/root.go | 84 +++++++++++++ cmd/show.go | 47 ++++++++ cmd/uncomment.go | 65 ++++++++++ go.mod | 8 ++ go.sum | 290 +++++++++++++++++++++++++++++++++++++++++++++ main.go | 9 ++ 17 files changed, 1619 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 build.sh create mode 100644 cmd/add.go create mode 100644 cmd/backup.go create mode 100644 cmd/comment.go create mode 100644 cmd/delete.go create mode 100644 cmd/export.go create mode 100644 cmd/output.go create mode 100644 cmd/restore.go create mode 100644 cmd/root.go create mode 100644 cmd/show.go create mode 100644 cmd/uncomment.go create mode 100644 go.mod create mode 100644 go.sum create mode 100644 main.go diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3cc7989 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +# executable +hosty +./hosty +hosty.exe +./hosty.exe + +# MacOS files +.DS_Store + +# build dir +build/ +./build/ +build/* +./build/* diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md new file mode 100644 index 0000000..94c5d48 --- /dev/null +++ b/README.md @@ -0,0 +1,302 @@ +# Hosty + +## Description + +Hosty is a command-line utility that allows for fast inspection and editing of `/etc/hosts`-like files. It is written in [golang](https://golang.org) and uses [libhosty](https://github.com/areYouLazy/libhosty) as the underlying library to operate on files + +## Table of Content + +* [Main Features](#Main-Features) +* [Installation](#Installation) + * [Precompiled packages](#Precompiled-packages) + * [Build](#Build) +* [Usage](#Usage) +* [Examples](#Examples) +* [Commands and Aliases](#Commands-and-Aliases) + * [show](#show) + * [add](#add) + * [delete](#delete) + * [comment](#comment) + * [uncomment](#uncomment) + * [export](#export) + * [restore](#restore) +* [License](#License) + +## Main Features + +* Fast Add/Delete/Comment/Uncomment entries +* JSON output for easy parsing +* Backup files before editing + +## Installation + +### Precompiled packages + +You can install `hosty` with one of the precompiled packages in the `release` section + +### Build + +Ensure you have go on your system + +```console +> go version +go version go1.16.3 linux/amd64 +``` + +pull the app + +```console +> go get github.com/areYouLazy/hosty +``` + +build and install + +```console +> cd github.com/areYouLazy/hosty +> go build +> go install +``` + +You should now be able to use `hosty`. Remember that `Add/Delete/Comment/Uncomment` commands needs `root` privileges. + +```console +> hosty show localhost +127.0.0.1 localhost +::1 localhost + +> hosty comment 127.0.0.1 +done +``` + +## Usage + +```console +root@localhost$ hosty -h +Hosty is a command-line tool to interact with the /etc/hosts file. +It allows for fast inspect and edit of the file. Main goals of this tool are to be fast, reliable and scriptable. +Hosty uses libhosty to manipulate the file. You can find more about libhosty at https://github.com/areYouLazy/libhosty + +Usage: + hosty [command] + +Available Commands: + add Add file data + comment Comment file data + delete Delete file data + help Help about any command + show Show file data + uncomment Uncomment file data + +Flags: + -f, --file string use a custom /etc/hosts-like file + -h, --help help for hosty + -j, --json output in json format for easy parsing + -q, --quiet suppress every output except for errors + -v, --version version for hosty + +Use "hosty [command] --help" for more information about a command. +``` + +## Examples + +```console +root@localhost$ # show entries with hostname equale to localhost +root@localhost$ hosty show localhost +127.0.0.1 localhost +::1 localhost + +root@localhost$ # show entries with ip equal to 127.0.0.1 +root@localhost$ hosty show 127.0.0.1 +127.0.0.1 localhost + +root@localhost$ # add an entrie with ip 1.2.3.4 and hostname my.custom.dns +root@localhost$ hosty add 1.2.3.4 my.custom.dns +done + +root@localhost$ # show entries with ip equal to 1.2.3.4 +root@localhost$ hosty show 1.2.3.4 +1.2.3.4 my.custom.dns + +root@localhost$ # comment entries with ip equal to 1.2.3.4 +root@localhost$ hosty comment 1.2.3.4 +done + +root@localhost$ # show entries with ip equal to 1.2.3.4 +root@localhost$ hostyc-li show 1.2.3.4 +# 1.2.3.4 my.custom.dns + +root@localhost$ # uncomment entries with ip equal to 1.2.3.4 suppress output +root@localhost$ hosty uncomment 1.2.3.4 --quiet + +root@localhost$ # show entries with ip equal to 1.2.3.4 output in json +root@localhost$ hosty show 1.2.3.4 --json | jq . +{ + "raw": "1.2.3.4 my.custom.dns" +} + +root@localhost$ # add another entry with same ip and different hostname output in json +root@localhost$ hosty add 1.2.3.4 my.custom2.dns --json +{"done":true} + +root@localhost$ # show entries with ip equal to 1.2.3.4 output in json with details +root@localhost$ hosty show 1.2.3.4 --json --details | jq . +{ + "action": "show", + "number": 12, + "type": "address", + "address": "1.2.3.4", + "hostnames": [ + "my.custom.dns", + "my.custom2.dns" + ], + "comment": "", + "is_commented": false, + "raw": "127.0.0.1 my.custom.dns my.custom2.dns" +} + +root@localhost$ # delete entries with ip equal to 1.2.3.4 +root@localhost$ hosty delete 1.2.3.4 +done + +root@localhost$ # show entries with ip equal to 1.2.3.4 +root@localhost$ hosty show 1.2.3.4 +nothing found for ip 1.2.3.4 +``` + +## Commands and Aliases + +Here's a little explanation of every command. + +Every Hosty command supports several aliases, most of which are just truncated version of the command. + +### show + +```console +root@localhost$ hosty show [PARAMETER] +``` + +Show entries based on the given parameter. +Parameter can be both IP or FQDN. + +```console +root@localhost$ # Aliases +root@localhost$ hosty sho localhost +root@localhost$ hosty sh localhost +root@localhost$ hosty s localhost +``` + +### add + +```console +root@localhost$ hosty add [IP] [FQDN] [COMMENT] +``` + +Add an entry to hosts file. +Required parameters are IP and FQDN, optionally you can pass a comment for the line. + +```console +root@localhost$ # Aliases +root@localhost$ hosty ad 1.2.3.4 my.custom.dns "DNS#1" +root@localhost$ hosty a 1.2.3.4 my.custom.dns +``` + +### delete + +```console +root@localhost$ hosty delete [PARAMETER] +``` + +Delete entries from hosts file based on the given parameter. +Parameter can be both IP or FQDN. + +```console +root@localhost$ # Aliases +root@localhost$ hosty delet 1.2.3.4 +root@localhost$ hosty dele 1.2.3.4 +root@localhost$ hosty del 1.2.3.4 +root@localhost$ hosty de 1.2.3.4 +root@localhost$ hosty d 1.2.3.4 +root@localhost$ hosty rem 1.2.3.4 +root@localhost$ hosty rm 1.2.3.4 +``` + +### comment + +```console +root@localhost$ hosty comment [PARAMETER] +``` + +Comment entries on hosts file based on given parameter. +Parameter can be both IP or FQDN. + +```console +root@localhost$ # Aliases +root@localhost$ hosty commen 1.2.3.4 +root@localhost$ hosty comme 1.2.3.4 +root@localhost$ hosty comm 1.2.3.4 +root@localhost$ hosty com 1.2.3.4 +root@localhost$ hosty co 1.2.3.4 +root@localhost$ hosty c 1.2.3.4 +``` + +### uncomment + +```console +root@localhost$ hosty uncomment [PARAMETER] +``` + +Uncomment entries on hosts file based on given parameter. +Parameter can be both IP or FQDN. + +```console +root@localhost$ # Aliases +root@localhost$ hosty uncommen 1.2.3.4 +root@localhost$ hosty uncomme 1.2.3.4 +root@localhost$ hosty uncomm 1.2.3.4 +root@localhost$ hosty uncom 1.2.3.4 +root@localhost$ hosty unco 1.2.3.4 +root@localhost$ hosty unc 1.2.3.4 +root@localhost$ hosty un 1.2.3.4 +root@localhost$ hosty u 1.2.3.4 +``` + +### export + +```console +root@localhost$ hosty export [PARAMETER] +``` + +Export file content to a given location +Parameter must be a writable file + +```console +root@localhost$ # Aliases +root@localhost$ hosty expor /home/sonica/hosts-export.txt +root@localhost$ hosty expo /home/sonica/hosts-export.txt +root@localhost$ hosty exp /home/sonica/hosts-export.txt +root@localhost$ hosty ex /home/sonica/hosts-export.txt +root@localhost$ hosty e /home/sonica/hosts-export.txt +``` + +### restore + +```console +root@localhost$ hosty restore [PARAMETER] +``` + +Restore default hosts file for given OS +If Paramter is omitted, hosty will try to guess the OS and restore the appropriate file + +```console +root@localhost$ # Aliases +root@localhost$ hosty restor darwin +root@localhost$ hosty resto darwin +root@localhost$ hosty rest darwin +root@localhost$ hosty res darwin +root@localhost$ hosty re darwin +root@localhost$ hosty r darwin +``` + +## License + +Released under Apache 2.0 license diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..a4e7c0e --- /dev/null +++ b/build.sh @@ -0,0 +1,70 @@ +#!/bin/bash +# Thanks to https://github.com/bettercap/bettercap/build.sh by @evilsocket + +BUILD_FOLDER=build +VERSION=v$(cat cmd/root.go | grep Version | cut -d '"' -f 2) + +create_exe_archive() { + OUTPUT=$1 + + echo "@ Creating archive $OUTPUT ..." + zip -j "$OUTPUT" hosty.exe ../README.md ../LICENSE > /dev/null + rm -rf hosty.exe +} + +create_archive() { + OUTPUT=$1 + + echo "@ Creating archive $OUTPUT ..." + zip -j "$OUTPUT" hosty ../README.md ../LICENSE > /dev/null + rm -rf hosty +} + +build_linux_amd64() { + echo "@ Building linux/amd64 ..." + GOOS="linux" GOARCH="amd64" go build -o hosty .. +} + +build_windows_amd64() { + echo "@ Building windows/amd64" + GOOS="windows" GOARCH="amd64" go build -o hosty.exe .. +} + +build_darwin_amd64() { + echo "@Building darwin/amd64" + GOOS="darwin" GOARCH="amd64" go build -o hosty .. +} + +# cleanup build environment +rm -rf $BUILD_FOLDER +mkdir $BUILD_FOLDER +cd $BUILD_FOLDER + +# check arguments +if [ -z "$1" ] + then + WHAT=all + else + WHAT="$1" +fi + +printf "@ Building for $WHAT ...\n\n" + +if [[ "$WHAT" == "all" || "$WHAT" == "linux_amd64" ]]; then + build_linux_amd64 && create_archive hosty_linux_amd64_$VERSION.zip + sha256sum ./hosty_linux_amd64_$VERSION.zip > hosty_linux_amd64_$VERSION.sha256 +fi + +if [[ "$WHAT" == "all" || "$WHAT" == "darwin_amd64" ]]; then + build_darwin_amd64 && create_archive hosty_darwin_amd64_$VERSION.zip + sha256sum ./hosty_darwin_amd64_$VERSION.zip > hosty_darwin_amd64_$VERSION.sha256 +fi + +if [[ "$WHAT" == "all" || "$WHAT" == "windows" || "$WHAT" == "win" ]]; then + build_windows_amd64 && create_exe_archive hosty_windows_amd64_$VERSION.zip + sha256sum ./hosty_windows_amd64_$VERSION.zip > hosty_windows_amd64_$VERSION.sha256 +fi + +du -sh * + +cd .. diff --git a/cmd/add.go b/cmd/add.go new file mode 100644 index 0000000..ae70d90 --- /dev/null +++ b/cmd/add.go @@ -0,0 +1,64 @@ +package cmd + +import ( + "errors" + "fmt" + "net" + + "github.com/areYouLazy/libhosty" + "github.com/spf13/cobra" +) + +var ( + addCmd = &cobra.Command{ + Use: "add [ip] [fqdn] [comment]", + Aliases: []string{"a", "ad"}, + Short: "Add file data", + Long: `Add hosts data to file. +[ip] and [fqdn] are required and positional arguments. +[comment] can be omitted`, + Args: func(cmd *cobra.Command, args []string) error { + if len(args) < 2 || len(args) > 3 { + return errors.New("invalid number of arguments") + } + + return nil + }, + ValidArgs: []string{"ip", "fqdn", "comment"}, + Run: func(cmd *cobra.Command, args []string) { + var fqdn, comment string + var hfline *libhosty.HostsFileLine + hfl := make([]*libhosty.HostsFileLine, 0) + var err error + + // get flags + details, _ := cmd.Flags().GetBool("details") + + ip := net.ParseIP(args[0]) + fqdn = string(args[1]) + if len(args) >= 3 { + comment = string(args[2]) + } else { + comment = "" + } + + if ip != nil { + _, hfline, err = hf.AddHostsFileLine(ip.String(), fqdn, comment) + cobra.CheckErr(err) + hfl = append(hfl, hfline) + + if backupFile { + err = Backup() + cobra.CheckErr(err) + } + err = hf.SaveHostsFile() + cobra.CheckErr(err) + + PrintOutput("add", details, hfl) + return + } + + fmt.Printf("invalid ip address %s as argument", args[0]) + }, + } +) diff --git a/cmd/backup.go b/cmd/backup.go new file mode 100644 index 0000000..c6fac4e --- /dev/null +++ b/cmd/backup.go @@ -0,0 +1,61 @@ +package cmd + +import ( + "fmt" + "io" + "os" + "strings" + "time" +) + +func Backup() error { + var backupFilePath string + + // get time as string + timeString := time.Now().Format("20060102150405") + + // format filename + backupFileName := fmt.Sprintf(".%s-hosts.bak", timeString) + + // get path of current file + tmpPath := strings.Split(hf.Config.FilePath, "/") + + // ensure path is absolute or make it relative + if len(tmpPath) > 1 && !strings.HasPrefix(tmpPath[0], "/") { + backupFilePath = strings.Join(tmpPath[:len(tmpPath)-1], "/") + } else { + backupFilePath = "./" + } + + // format full file path + name + backupFile := fmt.Sprintf("%s/%s", backupFilePath, backupFileName) + + // backup file + _, err := copy(hf.Config.FilePath, backupFile) + return err +} + +func copy(src, dst string) (int64, error) { + sourceFileStat, err := os.Stat(src) + if err != nil { + return 0, err + } + + if !sourceFileStat.Mode().IsRegular() { + return 0, fmt.Errorf("%s is not a regular file", src) + } + + source, err := os.Open(src) + if err != nil { + return 0, err + } + defer source.Close() + + destination, err := os.Create(dst) + if err != nil { + return 0, err + } + defer destination.Close() + nBytes, err := io.Copy(destination, source) + return nBytes, err +} diff --git a/cmd/comment.go b/cmd/comment.go new file mode 100644 index 0000000..b359387 --- /dev/null +++ b/cmd/comment.go @@ -0,0 +1,65 @@ +package cmd + +import ( + "fmt" + "net" + + "github.com/areYouLazy/libhosty" + "github.com/spf13/cobra" +) + +var ( + commentCmd = &cobra.Command{ + Use: "comment [ip/fqdn]", + Aliases: []string{"c", "co", "com", "comm", "comme", "commen"}, + Short: "Comment file data", + Long: `Comment hosts data on file. +Query can be done by IP or FQDN`, + Args: cobra.ExactArgs(1), + ValidArgs: []string{"ip/fqdn"}, + Run: func(cmd *cobra.Command, args []string) { + var hfl []*libhosty.HostsFileLine + arg := string(args[0]) + + // get flags + details, _ := cmd.Flags().GetBool("details") + + // try to parse arg as ip + ip := net.ParseIP(arg) + switch ip { + case nil: + hf.CommentHostsFileLinesByHostnameAsRegexp(arg) + + if backupFile { + err := Backup() + cobra.CheckErr(err) + } + err := hf.SaveHostsFile() + cobra.CheckErr(err) + + hfl = hf.GetHostsFileLinesByHostnameAsRegexp(arg) + if len(hfl) <= 0 { + fmt.Printf("nothing found for fqdn %s\n", arg) + return + } + default: + hf.CommentHostsFileLinesByIP(ip) + + if backupFile { + err := Backup() + cobra.CheckErr(err) + } + err := hf.SaveHostsFile() + cobra.CheckErr(err) + + hfl = hf.GetHostsFileLinesByIP(ip) + if len(hfl) <= 0 { + fmt.Printf("nothing found for ip %s\n", arg) + return + } + } + + PrintOutput("comment", details, hfl) + }, + } +) diff --git a/cmd/delete.go b/cmd/delete.go new file mode 100644 index 0000000..7377b62 --- /dev/null +++ b/cmd/delete.go @@ -0,0 +1,63 @@ +package cmd + +import ( + "fmt" + "net" + + "github.com/areYouLazy/libhosty" + "github.com/spf13/cobra" +) + +var ( + deleteCmd = &cobra.Command{ + Use: "delete [ip/fqdn]", + Aliases: []string{"d", "de", "del", "dele", "delet", "rm", "rem"}, + Short: "Delete file data", + Long: `Delete hosts data on file. +Query can be done by IP or FQDN`, + Args: cobra.ExactArgs(1), + ValidArgs: []string{"ip/fqdn"}, + Run: func(cmd *cobra.Command, args []string) { + var hfl []*libhosty.HostsFileLine + arg := string(args[0]) + + // get flags + details, _ := cmd.Flags().GetBool("details") + fqdn, _ := cmd.Flags().GetString("fqdn") + + // try to parse arg as ip + ip := net.ParseIP(arg) + switch ip { + case nil: + // delete needs to get data before acting + // otherwise we'll not have data for detailed output + hfl = hf.GetHostsFileLinesByHostnameAsRegexp(arg) + if len(hfl) <= 0 { + fmt.Printf("nothing found for fqdn %s\n", arg) + return + } + + hf.RemoveHostsFileLinesByHostnameAsRegexp(fqdn) + default: + // delete needs to get data before acting + // otherwise we'll not have data for detailed output + hfl = hf.GetHostsFileLinesByIP(ip) + if len(hfl) <= 0 { + fmt.Printf("nothing found for ip %s\n", arg) + return + } + + hf.RemoveHostsFileLinesByIP(ip) + } + + if backupFile { + err := Backup() + cobra.CheckErr(err) + } + err := hf.SaveHostsFile() + cobra.CheckErr(err) + + PrintOutput("delete", details, hfl) + }, + } +) diff --git a/cmd/export.go b/cmd/export.go new file mode 100644 index 0000000..822ef82 --- /dev/null +++ b/cmd/export.go @@ -0,0 +1,34 @@ +package cmd + +import ( + "errors" + + "github.com/spf13/cobra" +) + +var ( + exportCmd = &cobra.Command{ + Use: "export [location]", + Aliases: []string{"e", "ex", "exp", "expo", "expor"}, + Short: "Export file to a custom location", + Long: `Export hosts file to a custom location`, + Args: func(cmd *cobra.Command, args []string) error { + if len(args) < 1 || len(args) > 2 { + return errors.New("invalid number of arguments") + } + + return nil + }, + ValidArgs: []string{"location"}, + Run: func(cmd *cobra.Command, args []string) { + arg := string(args[0]) + + if backupFile { + err := Backup() + cobra.CheckErr(err) + } + err := hf.SaveHostsFileAs(arg) + cobra.CheckErr(err) + }, + } +) diff --git a/cmd/output.go b/cmd/output.go new file mode 100644 index 0000000..77054c1 --- /dev/null +++ b/cmd/output.go @@ -0,0 +1,186 @@ +package cmd + +import ( + "bytes" + "encoding/json" + "fmt" + "strings" + + "github.com/areYouLazy/libhosty" + "github.com/spf13/cobra" +) + +func PrintOutput(action string, details bool, hfl []*libhosty.HostsFileLine) { + // if quiet return + if quietOutput { + return + } + + // if json and details print detailed json + if jsonOutput && details { + fmt.Printf("%s", DetailedJSONOutput(action, hfl)) + return + } + + // if json and show print json + if jsonOutput && action == "show" { + fmt.Printf("%s", JSONOutput("show", hfl)) + return + } + + // if details print detailed + if details { + fmt.Printf("%s", DetailedOutput(action, hfl)) + return + } + + // if json print json + if jsonOutput { + fmt.Printf("%s", JSONDoneOutput()) + return + } + + if action == "show" { + fmt.Printf("%s", ShowOutput(hfl)) + return + } + + // print something for humans + fmt.Println("done") +} + +type DetailedJSONOutputStruct struct { + Action string `json:"action"` + LineNumber int `json:"number"` + LineType string `json:"type"` + LineAddress string `json:"address"` + LineHostnames []string `json:"hostnames"` + LineComment string `json:"comment"` + LineIsCommented bool `json:"is_commented"` + LineRaw string `json:"raw"` +} + +type JSONOutputStruct struct { + LineRaw string `json:"raw"` +} + +type JSONDone struct { + Done bool `json:"done"` +} + +func DetailedJSONOutput(action string, hfl []*libhosty.HostsFileLine) []byte { + var buffer [][]byte + + for _, v := range hfl { + var stringType string + + switch v.Type { + case 0: + stringType = "unknown" + case 10: + stringType = "empty" + case 20: + stringType = "comment" + case 30: + stringType = "address" + } + + o := DetailedJSONOutputStruct{ + Action: action, + LineNumber: v.Number, + LineType: stringType, + LineAddress: v.Address.String(), + LineHostnames: v.Hostnames, + LineComment: v.Comment, + LineIsCommented: v.IsCommented, + LineRaw: strings.ReplaceAll(v.Raw, "\t", ""), + } + + b, err := json.Marshal(&o) + if err != nil { + cobra.CheckErr(err) + } + + buffer = append(buffer, b) + } + + return bytes.Join(buffer, []byte("\n")) +} + +func DetailedOutput(action string, hfl []*libhosty.HostsFileLine) string { + var buffer []string + + for _, v := range hfl { + var stringType string + var buf []string + + switch v.Type { + case 0: + stringType = "unknown" + case 10: + stringType = "empty" + case 20: + stringType = "comment" + case 30: + stringType = "address" + } + + buf = append( + buf, + fmt.Sprintf("action: %s", action), + fmt.Sprintf("number: %d", v.Number), + fmt.Sprintf("type: %s", stringType), + fmt.Sprintf("address: %s", v.Address), + fmt.Sprintf("hostnames: %s", strings.Join(v.Hostnames, ", ")), + fmt.Sprintf("comment: %s", v.Comment), + fmt.Sprintf("is_commented: %t", v.IsCommented), + fmt.Sprintf("raw: %s", strings.ReplaceAll(v.Raw, "\t", "")), + ) + + buffer = append(buffer, strings.Join(buf, "\n")) + } + + return strings.Join(buffer, "\n\n") +} + +func JSONOutput(action string, hfl []*libhosty.HostsFileLine) []byte { + var buffer [][]byte + + for _, v := range hfl { + o := JSONOutputStruct{ + LineRaw: strings.ReplaceAll(v.Raw, "\t", ""), + } + + b, err := json.Marshal(&o) + if err != nil { + cobra.CheckErr(err) + } + + buffer = append(buffer, b) + } + + return bytes.Join(buffer, []byte("\n")) +} + +func JSONDoneOutput() []byte { + o := JSONDone{ + Done: true, + } + + b, err := json.Marshal(&o) + if err != nil { + cobra.CheckErr(err) + } + + return b +} + +func ShowOutput(hfl []*libhosty.HostsFileLine) string { + var buffer []string + + for idx := range hfl { + buffer = append(buffer, strings.ReplaceAll(hfl[idx].Raw, "\t", "")) + } + + return strings.Join(buffer, "\n") +} diff --git a/cmd/restore.go b/cmd/restore.go new file mode 100644 index 0000000..26a6a48 --- /dev/null +++ b/cmd/restore.go @@ -0,0 +1,56 @@ +package cmd + +import ( + "runtime" + + "github.com/areYouLazy/libhosty" + "github.com/spf13/cobra" +) + +var ( + restoreCmd = &cobra.Command{ + Use: "restore [os]", + Aliases: []string{"r", "re", "res", "rest", "resto", "restor"}, + Short: "Restore default hosts file", + Long: `Restore the default hosts file. +If [os] is mitted, hosty will try to guess your OS and restore the appropriate file`, + ValidArgs: []string{"os"}, + Run: func(cmd *cobra.Command, args []string) { + os := "" + if len(args) > 0 { + os = string(args[0]) + } else { + os = runtime.GOOS + } + + // get flags + details, _ := cmd.Flags().GetBool("details") + + switch os { + case "windows": + hf.RestoreDefaultWindowsHostsFile() + case "win": + hf.RestoreDefaultWindowsHostsFile() + case "darwin": + hf.RestoreDefaultDarwinHostsFile() + default: + hf.RestoreDefaultLinuxHostsFile() + } + + if backupFile { + err := Backup() + cobra.CheckErr(err) + } + err := hf.SaveHostsFile() + cobra.CheckErr(err) + + hfl := make([]*libhosty.HostsFileLine, len(hf.HostsFileLines)) + + for idx := range hf.HostsFileLines { + hfl = append(hfl, &hf.HostsFileLines[idx]) + } + + PrintOutput("restore", details, hfl) + }, + } +) diff --git a/cmd/root.go b/cmd/root.go new file mode 100644 index 0000000..fbe5139 --- /dev/null +++ b/cmd/root.go @@ -0,0 +1,84 @@ +package cmd + +import ( + "github.com/areYouLazy/libhosty" + "github.com/spf13/cobra" +) + +var ( + // expose HostsFile and HostsFileConfig + hc *libhosty.HostsFileConfig + hf *libhosty.HostsFile + + // Used for flags + customFile string + jsonOutput bool + quietOutput bool + backupFile bool + + rootCmd = &cobra.Command{ + Use: "hosty", + Short: "A command-line interface to the /etc/hosts file", + Long: `Hosty is a command-line tool to interact with the /etc/hosts file. +It allows for fast inspect and edit of the file. Main goals of this tool are to be fast, reliable and scriptable. +Hosty uses libhosty to manipulate the file. You can find more about libhosty at https://github.com/areYouLazy/libhosty`, + Version: "1.0.0RC0", + PersistentPreRun: func(cmd *cobra.Command, args []string) { + // init libhosty here because only here we're sure to have + // all flags parsed by cobra + var err error + + if customFile != "" { + hc, err = libhosty.NewHostsFileConfig(customFile) + cobra.CheckErr(err) + + hf, err = libhosty.InitWithConfig(hc) + cobra.CheckErr(err) + } else { + + hf, err = libhosty.Init() + cobra.CheckErr(err) + } + }, + } +) + +// Execute executes the root command +func Execute() error { + return rootCmd.Execute() +} + +func init() { + // parse flags + rootCmd.PersistentFlags().BoolVarP(&jsonOutput, "json", "j", false, "print output in json format for easy parsing") + rootCmd.PersistentFlags().BoolVarP(&quietOutput, "quiet", "q", false, "suppress every output except for errors") + rootCmd.PersistentFlags().StringVarP(&customFile, "file", "f", "", "parse a custom /etc/hosts-like file instead of the system default one") + rootCmd.PersistentFlags().BoolVarP(&backupFile, "backup", "b", false, "backup file before editing. Backup is hidden and named with the format: .YYYYMMDDHHmmss-hosts.bck") + + // hosty show + rootCmd.AddCommand(showCmd) + showCmd.Flags().BoolP("details", "d", false, "show lines details") + + // hosty delete + rootCmd.AddCommand(deleteCmd) + deleteCmd.Flags().BoolP("details", "d", false, "show operation details") + + // hosty add + rootCmd.AddCommand(addCmd) + addCmd.Flags().BoolP("details", "d", false, "show operation details") + + // hosty comment + rootCmd.AddCommand(commentCmd) + commentCmd.Flags().BoolP("details", "d", false, "show operation details") + + // hosty uncomment + rootCmd.AddCommand(uncommentCmd) + uncommentCmd.Flags().BoolP("details", "d", false, "show operation details") + + // hosty export + rootCmd.AddCommand(exportCmd) + + // hosty restore + rootCmd.AddCommand(restoreCmd) + restoreCmd.Flags().BoolP("details", "d", false, "show operation details") +} diff --git a/cmd/show.go b/cmd/show.go new file mode 100644 index 0000000..a689639 --- /dev/null +++ b/cmd/show.go @@ -0,0 +1,47 @@ +package cmd + +import ( + "fmt" + "net" + + "github.com/areYouLazy/libhosty" + "github.com/spf13/cobra" +) + +var ( + showCmd = &cobra.Command{ + Use: "show [ip/fqdn]", + Aliases: []string{"s", "sh", "sho"}, + Short: "Show file data", + Long: `Query hosts file for data. +Query can be done by IP or FQDN`, + Args: cobra.ExactArgs(1), + ValidArgs: []string{"ip/fqdn"}, + Run: func(cmd *cobra.Command, args []string) { + var hfl []*libhosty.HostsFileLine + + // get flags + details, _ := cmd.Flags().GetBool("details") + + // get args + arg := string(args[0]) + + // try to parse arg as ip + ip := net.ParseIP(arg) + switch ip { + case nil: + // search by FQDN + hfl = hf.GetHostsFileLinesByHostnameAsRegexp(arg) + default: + // arg is a valid IP address + hfl = hf.GetHostsFileLinesByIP(ip) + if len(hfl) <= 0 { + fmt.Printf("nothing found for ip %s\n", ip) + return + } + } + + PrintOutput("show", details, hfl) + }, + } +) diff --git a/cmd/uncomment.go b/cmd/uncomment.go new file mode 100644 index 0000000..3b4dc48 --- /dev/null +++ b/cmd/uncomment.go @@ -0,0 +1,65 @@ +package cmd + +import ( + "fmt" + "net" + + "github.com/areYouLazy/libhosty" + "github.com/spf13/cobra" +) + +var ( + uncommentCmd = &cobra.Command{ + Use: "uncomment [ip/fqdn]", + Aliases: []string{"u", "un", "unc", "unco", "uncom", "uncomm", "uncomme", "uncommen"}, + Short: "Uncomment file data", + Long: `Uncomment hosts data on file. +Query can be done by IP or FQDN`, + Args: cobra.ExactArgs(1), + ValidArgs: []string{"ip/fqdn"}, + Run: func(cmd *cobra.Command, args []string) { + var hfl []*libhosty.HostsFileLine + arg := args[0] + + // get flags + details, _ := cmd.Flags().GetBool("details") + + // try to parse arg as ip + ip := net.ParseIP(arg) + switch ip { + case nil: + hf.UncommentHostsFileLinesByHostnameAsRegexp(arg) + + if backupFile { + err := Backup() + cobra.CheckErr(err) + } + err := hf.SaveHostsFile() + cobra.CheckErr(err) + + hfl = hf.GetHostsFileLinesByHostnameAsRegexp(arg) + if len(hfl) <= 0 { + fmt.Printf("nothing found for fqdn %s\n", arg) + return + } + default: + hf.UncommentHostsFileLinesByIP(ip) + + if backupFile { + err := Backup() + cobra.CheckErr(err) + } + err := hf.SaveHostsFile() + cobra.CheckErr(err) + + hfl = hf.GetHostsFileLinesByIP(ip) + if len(hfl) <= 0 { + fmt.Printf("nothing found for ip %s\n", arg) + return + } + } + + PrintOutput("uncomment", details, hfl) + }, + } +) diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..54294c0 --- /dev/null +++ b/go.mod @@ -0,0 +1,8 @@ +module github.com/areYouLazy/hosty + +go 1.16 + +require ( + github.com/areYouLazy/libhosty v0.0.0-20210604131254-e0bfadd0833c + github.com/spf13/cobra v1.1.3 +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..834d888 --- /dev/null +++ b/go.sum @@ -0,0 +1,290 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/areYouLazy/libhosty v0.0.0-20210604130532-d4629c73f71a h1:3Hpaln3wzrUrxTNZHpHJDwk4GnZbFcUFaAnp13s/e7s= +github.com/areYouLazy/libhosty v0.0.0-20210604130532-d4629c73f71a/go.mod h1:dV4ir3feRrTbWdcJ21mt3MeZlASg0sc8db6nimL9GOA= +github.com/areYouLazy/libhosty v0.0.0-20210604131254-e0bfadd0833c h1:oNQGXUlWD2FWa72UVPh4ArHyTpKtABAQZfxYfWWTzcM= +github.com/areYouLazy/libhosty v0.0.0-20210604131254-e0bfadd0833c/go.mod h1:dV4ir3feRrTbWdcJ21mt3MeZlASg0sc8db6nimL9GOA= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v1.1.3 h1:xghbfqPkxzxP3C/f3n5DdpAbdKLj4ZE4BWQI362l53M= +github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= diff --git a/main.go b/main.go new file mode 100644 index 0000000..0973f5c --- /dev/null +++ b/main.go @@ -0,0 +1,9 @@ +package main + +import ( + "github.com/areYouLazy/hosty/cmd" +) + +func main() { + cmd.Execute() +}