|
@@ -1,5 +1,35 @@
|
|
|
package main
|
|
|
|
|
|
+/*
|
|
|
+ ______
|
|
|
+ |___ /
|
|
|
+ / / ___ _ __ __ ___ ___ _
|
|
|
+ / / / _ \| '__/ _` \ \/ / | | |
|
|
|
+ / /_| (_) | | | (_| |> <| |_| |
|
|
|
+ /_____\___/|_| \__,_/_/\_\\__, |
|
|
|
+ __/ |
|
|
|
+ |___/
|
|
|
+
|
|
|
+Zoraxy - A general purpose HTTP reverse proxy and forwarding tool
|
|
|
+Author: tobychui
|
|
|
+License: AGPLv3
|
|
|
+
|
|
|
+--------------------------------------------
|
|
|
+
|
|
|
+This program is free software: you can redistribute it and/or modify
|
|
|
+it under the terms of the GNU Affero General Public License as published by
|
|
|
+the Free Software Foundation, version 3 of the License or any later version.
|
|
|
+
|
|
|
+This program is distributed in the hope that it will be useful,
|
|
|
+but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
+GNU Affero General Public License for more details.
|
|
|
+
|
|
|
+You should have received a copy of the GNU Affero General Public License
|
|
|
+along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
+
|
|
|
+*/
|
|
|
+
|
|
|
import (
|
|
|
"flag"
|
|
|
"fmt"
|
|
@@ -16,7 +46,7 @@ import (
|
|
|
"imuslab.com/zoraxy/mod/utils"
|
|
|
)
|
|
|
|
|
|
-// Kill signal handler. Do something before the system the core terminate.
|
|
|
+/* SIGTERM handler, do shutdown sequences before closing */
|
|
|
func SetupCloseHandler() {
|
|
|
c := make(chan os.Signal, 2)
|
|
|
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
|
|
@@ -29,8 +59,6 @@ func SetupCloseHandler() {
|
|
|
|
|
|
func ShutdownSeq() {
|
|
|
SystemWideLogger.Println("Shutting down " + SYSTEM_NAME)
|
|
|
- //SystemWideLogger.Println("Closing GeoDB")
|
|
|
- //geodbStore.Close()
|
|
|
SystemWideLogger.Println("Closing Netstats Listener")
|
|
|
netstatBuffers.Close()
|
|
|
SystemWideLogger.Println("Closing Statistic Collector")
|
|
@@ -95,7 +123,7 @@ func main() {
|
|
|
webminPanelMux = http.NewServeMux()
|
|
|
csrfMiddleware = csrf.Protect(
|
|
|
[]byte(nodeUUID),
|
|
|
- csrf.CookieName("zoraxy-csrf"),
|
|
|
+ csrf.CookieName(CSRF_COOKIENAME),
|
|
|
csrf.Secure(false),
|
|
|
csrf.Path("/"),
|
|
|
csrf.SameSite(csrf.SameSiteLaxMode),
|
|
@@ -118,11 +146,10 @@ func main() {
|
|
|
//Start the finalize sequences
|
|
|
finalSequence()
|
|
|
|
|
|
- SystemWideLogger.Println("Zoraxy started. Visit control panel at http://localhost" + *webUIPort)
|
|
|
+ SystemWideLogger.Println(SYSTEM_NAME + " started. Visit control panel at http://localhost" + *webUIPort)
|
|
|
err = http.ListenAndServe(*webUIPort, csrfMiddleware(webminPanelMux))
|
|
|
|
|
|
if err != nil {
|
|
|
log.Fatal(err)
|
|
|
}
|
|
|
-
|
|
|
}
|