From dc682763ff61874eb6043eaac5fa0eba17f7ddec Mon Sep 17 00:00:00 2001
From: Simon Zolin <s.zolin@adguard.com>
Date: Mon, 10 Jun 2019 11:33:19 +0300
Subject: [PATCH] * move ./*.go files into ./home/ directory

---
 Makefile                                              | 2 +-
 clients.go => home/clients.go                         | 2 +-
 clients_test.go => home/clients_test.go               | 2 +-
 config.go => home/config.go                           | 2 +-
 control.go => home/control.go                         | 2 +-
 control_access.go => home/control_access.go           | 2 +-
 control_install.go => home/control_install.go         | 2 +-
 control_test.go => home/control_test.go               | 2 +-
 control_tls.go => home/control_tls.go                 | 2 +-
 control_update.go => home/control_update.go           | 2 +-
 control_update_test.go => home/control_update_test.go | 2 +-
 dhcp.go => home/dhcp.go                               | 2 +-
 dns.go => home/dns.go                                 | 2 +-
 dns_test.go => home/dns_test.go                       | 2 +-
 filter.go => home/filter.go                           | 2 +-
 helpers.go => home/helpers.go                         | 2 +-
 helpers_test.go => home/helpers_test.go               | 2 +-
 app.go => home/home.go                                | 6 +++---
 i18n.go => home/i18n.go                               | 2 +-
 os_unix.go => home/os_unix.go                         | 2 +-
 os_windows.go => home/os_windows.go                   | 2 +-
 service.go => home/service.go                         | 2 +-
 syslog_others.go => home/syslog_others.go             | 2 +-
 syslog_windows.go => home/syslog_windows.go           | 2 +-
 upgrade.go => home/upgrade.go                         | 2 +-
 upgrade_test.go => home/upgrade_test.go               | 2 +-
 main.go                                               | 9 +++++++++
 27 files changed, 37 insertions(+), 28 deletions(-)
 rename clients.go => home/clients.go (99%)
 rename clients_test.go => home/clients_test.go (99%)
 rename config.go => home/config.go (99%)
 rename control.go => home/control.go (99%)
 rename control_access.go => home/control_access.go (99%)
 rename control_install.go => home/control_install.go (99%)
 rename control_test.go => home/control_test.go (99%)
 rename control_tls.go => home/control_tls.go (99%)
 rename control_update.go => home/control_update.go (99%)
 rename control_update_test.go => home/control_update_test.go (99%)
 rename dhcp.go => home/dhcp.go (99%)
 rename dns.go => home/dns.go (99%)
 rename dns_test.go => home/dns_test.go (94%)
 rename filter.go => home/filter.go (99%)
 rename helpers.go => home/helpers.go (99%)
 rename helpers_test.go => home/helpers_test.go (97%)
 rename app.go => home/home.go (99%)
 rename i18n.go => home/i18n.go (99%)
 rename os_unix.go => home/os_unix.go (97%)
 rename os_windows.go => home/os_windows.go (97%)
 rename service.go => home/service.go (99%)
 rename syslog_others.go => home/syslog_others.go (95%)
 rename syslog_windows.go => home/syslog_windows.go (98%)
 rename upgrade.go => home/upgrade.go (99%)
 rename upgrade_test.go => home/upgrade_test.go (99%)
 create mode 100644 main.go

diff --git a/Makefile b/Makefile
index f67510df..b796f06f 100644
--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,7 @@ client/node_modules: client/package.json client/package-lock.json
 $(STATIC): $(JSFILES) client/node_modules
 	npm --prefix client run build-prod
 
-$(TARGET): $(STATIC) *.go dhcpd/*.go dnsfilter/*.go dnsforward/*.go
+$(TARGET): $(STATIC) *.go home/*.go dhcpd/*.go dnsfilter/*.go dnsforward/*.go
 	GOOS=$(NATIVE_GOOS) GOARCH=$(NATIVE_GOARCH) GO111MODULE=off go get -v github.com/gobuffalo/packr/...
 	PATH=$(GOPATH)/bin:$(PATH) packr -z
 	CGO_ENABLED=0 go build -ldflags="-s -w -X main.VersionString=$(GIT_VERSION) -X main.updateChannel=$(CHANNEL)" -asmflags="-trimpath=$(PWD)" -gcflags="-trimpath=$(PWD)"
diff --git a/clients.go b/home/clients.go
similarity index 99%
rename from clients.go
rename to home/clients.go
index 88143737..759027d8 100644
--- a/clients.go
+++ b/home/clients.go
@@ -1,4 +1,4 @@
-package main
+package home
 
 import (
 	"encoding/json"
diff --git a/clients_test.go b/home/clients_test.go
similarity index 99%
rename from clients_test.go
rename to home/clients_test.go
index 1519f45d..a8cb44c2 100644
--- a/clients_test.go
+++ b/home/clients_test.go
@@ -1,4 +1,4 @@
-package main
+package home
 
 import "testing"
 
diff --git a/config.go b/home/config.go
similarity index 99%
rename from config.go
rename to home/config.go
index 78589f04..7d9a509e 100644
--- a/config.go
+++ b/home/config.go
@@ -1,4 +1,4 @@
-package main
+package home
 
 import (
 	"io/ioutil"
diff --git a/control.go b/home/control.go
similarity index 99%
rename from control.go
rename to home/control.go
index 3ab59b3a..62b2ecd6 100644
--- a/control.go
+++ b/home/control.go
@@ -1,4 +1,4 @@
-package main
+package home
 
 import (
 	"bytes"
diff --git a/control_access.go b/home/control_access.go
similarity index 99%
rename from control_access.go
rename to home/control_access.go
index 0c6fd800..0f0cb8bd 100644
--- a/control_access.go
+++ b/home/control_access.go
@@ -1,4 +1,4 @@
-package main
+package home
 
 import (
 	"encoding/json"
diff --git a/control_install.go b/home/control_install.go
similarity index 99%
rename from control_install.go
rename to home/control_install.go
index 7ad7a831..f5758b99 100644
--- a/control_install.go
+++ b/home/control_install.go
@@ -1,4 +1,4 @@
-package main
+package home
 
 import (
 	"context"
diff --git a/control_test.go b/home/control_test.go
similarity index 99%
rename from control_test.go
rename to home/control_test.go
index c04e1a2f..642b5bba 100644
--- a/control_test.go
+++ b/home/control_test.go
@@ -1,4 +1,4 @@
-package main
+package home
 
 import (
 	"testing"
diff --git a/control_tls.go b/home/control_tls.go
similarity index 99%
rename from control_tls.go
rename to home/control_tls.go
index 0546c5f1..cdf62843 100644
--- a/control_tls.go
+++ b/home/control_tls.go
@@ -1,6 +1,6 @@
 // Control: TLS configuring handlers
 
-package main
+package home
 
 import (
 	"context"
diff --git a/control_update.go b/home/control_update.go
similarity index 99%
rename from control_update.go
rename to home/control_update.go
index 6a819a09..70681d28 100644
--- a/control_update.go
+++ b/home/control_update.go
@@ -1,4 +1,4 @@
-package main
+package home
 
 import (
 	"archive/tar"
diff --git a/control_update_test.go b/home/control_update_test.go
similarity index 99%
rename from control_update_test.go
rename to home/control_update_test.go
index 3e142a78..b48f65f3 100644
--- a/control_update_test.go
+++ b/home/control_update_test.go
@@ -1,6 +1,6 @@
 // +build ignore
 
-package main
+package home
 
 import (
 	"os"
diff --git a/dhcp.go b/home/dhcp.go
similarity index 99%
rename from dhcp.go
rename to home/dhcp.go
index 8c966ad6..066e6843 100644
--- a/dhcp.go
+++ b/home/dhcp.go
@@ -1,4 +1,4 @@
-package main
+package home
 
 import (
 	"encoding/json"
diff --git a/dns.go b/home/dns.go
similarity index 99%
rename from dns.go
rename to home/dns.go
index 60f7c4e8..8664fb65 100644
--- a/dns.go
+++ b/home/dns.go
@@ -1,4 +1,4 @@
-package main
+package home
 
 import (
 	"fmt"
diff --git a/dns_test.go b/home/dns_test.go
similarity index 94%
rename from dns_test.go
rename to home/dns_test.go
index 0ea2cfb8..dd6ba8cb 100644
--- a/dns_test.go
+++ b/home/dns_test.go
@@ -1,4 +1,4 @@
-package main
+package home
 
 import (
 	"testing"
diff --git a/filter.go b/home/filter.go
similarity index 99%
rename from filter.go
rename to home/filter.go
index 592a3c31..64da0466 100644
--- a/filter.go
+++ b/home/filter.go
@@ -1,4 +1,4 @@
-package main
+package home
 
 import (
 	"fmt"
diff --git a/helpers.go b/home/helpers.go
similarity index 99%
rename from helpers.go
rename to home/helpers.go
index a32e4745..68fbd7a3 100644
--- a/helpers.go
+++ b/home/helpers.go
@@ -1,4 +1,4 @@
-package main
+package home
 
 import (
 	"bufio"
diff --git a/helpers_test.go b/home/helpers_test.go
similarity index 97%
rename from helpers_test.go
rename to home/helpers_test.go
index e70b2d5f..03243346 100644
--- a/helpers_test.go
+++ b/home/helpers_test.go
@@ -1,4 +1,4 @@
-package main
+package home
 
 import (
 	"testing"
diff --git a/app.go b/home/home.go
similarity index 99%
rename from app.go
rename to home/home.go
index cc181cba..dbd35601 100644
--- a/app.go
+++ b/home/home.go
@@ -1,4 +1,4 @@
-package main
+package home
 
 import (
 	"bufio"
@@ -49,7 +49,7 @@ const (
 )
 
 // main is the entry point
-func main() {
+func Main() {
 	// config can be specified, which reads options from there, but other command line flags have to override config values
 	// therefore, we must do it manually instead of using a lib
 	args := loadOptions()
@@ -174,7 +174,7 @@ func run(args options) {
 	go periodicallyRefreshFilters()
 
 	// Initialize and run the admin Web interface
-	box := packr.NewBox("build/static")
+	box := packr.NewBox("../build/static")
 
 	// if not configured, redirect / to /install.html, otherwise redirect /install.html to /
 	http.Handle("/", postInstallHandler(optionalAuthHandler(gziphandler.GzipHandler(http.FileServer(box)))))
diff --git a/i18n.go b/home/i18n.go
similarity index 99%
rename from i18n.go
rename to home/i18n.go
index 80ebfce3..98953d8c 100644
--- a/i18n.go
+++ b/home/i18n.go
@@ -1,4 +1,4 @@
-package main
+package home
 
 import (
 	"fmt"
diff --git a/os_unix.go b/home/os_unix.go
similarity index 97%
rename from os_unix.go
rename to home/os_unix.go
index 9baa357d..d55aa72f 100644
--- a/os_unix.go
+++ b/home/os_unix.go
@@ -1,6 +1,6 @@
 // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
 
-package main
+package home
 
 import (
 	"os"
diff --git a/os_windows.go b/home/os_windows.go
similarity index 97%
rename from os_windows.go
rename to home/os_windows.go
index e847ccce..f6949d93 100644
--- a/os_windows.go
+++ b/home/os_windows.go
@@ -1,4 +1,4 @@
-package main
+package home
 
 import "golang.org/x/sys/windows"
 
diff --git a/service.go b/home/service.go
similarity index 99%
rename from service.go
rename to home/service.go
index a73da52f..77b76973 100644
--- a/service.go
+++ b/home/service.go
@@ -1,4 +1,4 @@
-package main
+package home
 
 import (
 	"os"
diff --git a/syslog_others.go b/home/syslog_others.go
similarity index 95%
rename from syslog_others.go
rename to home/syslog_others.go
index 1813bb99..8aa0f8b0 100644
--- a/syslog_others.go
+++ b/home/syslog_others.go
@@ -1,6 +1,6 @@
 // +build !windows,!nacl,!plan9
 
-package main
+package home
 
 import (
 	"log"
diff --git a/syslog_windows.go b/home/syslog_windows.go
similarity index 98%
rename from syslog_windows.go
rename to home/syslog_windows.go
index e81b63ee..a80933bb 100644
--- a/syslog_windows.go
+++ b/home/syslog_windows.go
@@ -1,4 +1,4 @@
-package main
+package home
 
 import (
 	"log"
diff --git a/upgrade.go b/home/upgrade.go
similarity index 99%
rename from upgrade.go
rename to home/upgrade.go
index c2de9f68..135fd05c 100644
--- a/upgrade.go
+++ b/home/upgrade.go
@@ -1,4 +1,4 @@
-package main
+package home
 
 import (
 	"fmt"
diff --git a/upgrade_test.go b/home/upgrade_test.go
similarity index 99%
rename from upgrade_test.go
rename to home/upgrade_test.go
index 8980eda9..f884de04 100644
--- a/upgrade_test.go
+++ b/home/upgrade_test.go
@@ -1,4 +1,4 @@
-package main
+package home
 
 import (
 	"fmt"
diff --git a/main.go b/main.go
new file mode 100644
index 00000000..3a9d35b9
--- /dev/null
+++ b/main.go
@@ -0,0 +1,9 @@
+package main
+
+import (
+	"github.com/AdguardTeam/AdGuardHome/home"
+)
+
+func main() {
+	home.Main()
+}