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() +}