From 1f276ec5ae27c947ddced319e7ab8115a37d4e5b Mon Sep 17 00:00:00 2001 From: George Shaw Date: Mon, 23 Oct 2017 14:45:43 -0500 Subject: [PATCH] refactoring/following conventions/fixing packages/fixing architecture --- {public => document_roots/public}/test.html | 0 {private => document_roots/webhost}/test.html | 0 main.go | 14 +++++++------- {general => pkg}/logging/console.go | 2 +- {general => pkg}/logging/file.go | 0 {general => pkg}/networking/ip_address.go | 0 .../routing/content_types.go | 0 {general => pkg}/routing/http_status.go | 0 public_server/public_server.go => public/public.go | 10 +++++----- .../private_server.go => webhost/webhost.go | 10 +++++----- 10 files changed, 18 insertions(+), 18 deletions(-) rename {public => document_roots/public}/test.html (100%) rename {private => document_roots/webhost}/test.html (100%) rename {general => pkg}/logging/console.go (93%) rename {general => pkg}/logging/file.go (100%) rename {general => pkg}/networking/ip_address.go (100%) rename general/routing/contentTypes.go => pkg/routing/content_types.go (100%) rename {general => pkg}/routing/http_status.go (100%) rename public_server/public_server.go => public/public.go (82%) rename private_server/private_server.go => webhost/webhost.go (85%) diff --git a/public/test.html b/document_roots/public/test.html similarity index 100% rename from public/test.html rename to document_roots/public/test.html diff --git a/private/test.html b/document_roots/webhost/test.html similarity index 100% rename from private/test.html rename to document_roots/webhost/test.html diff --git a/main.go b/main.go index cebc595..d2317ce 100644 --- a/main.go +++ b/main.go @@ -4,21 +4,21 @@ import ( "log" "net/http" - "github.com/Ennovar/gPanel/private_server" - "github.com/Ennovar/gPanel/public_server" + "github.com/Ennovar/gPanel/public" + "github.com/Ennovar/gPanel/webhost" ) func main() { - private := private_server.NewPrivateHost() - public := public_server.NewPublicWeb() + webhost := webhost.NewPrivateHost() + public := public.NewPublicWeb() log.Printf("To Exit: CTRL+C") go func() { - log.Print("Listening (private) on localhost:2082, serving out of the private/ directory...") - http.ListenAndServe("localhost:2082", &private) + log.Print("Listening (private) on localhost:2082, serving out of the document_roots/webhost/ directory...") + http.ListenAndServe("localhost:2082", &webhost) }() - log.Print("Listening (public) on localhost:3000, serving out of the public/ directory...") + log.Print("Listening (public) on localhost:3000, serving out of the document_roots/public/ directory...") http.ListenAndServe("localhost:3000", &public) } diff --git a/general/logging/console.go b/pkg/logging/console.go similarity index 93% rename from general/logging/console.go rename to pkg/logging/console.go index 595c73f..c50243c 100644 --- a/general/logging/console.go +++ b/pkg/logging/console.go @@ -5,7 +5,7 @@ import ( "log" "strings" - "github.com/Ennovar/gPanel/general/networking" + "github.com/Ennovar/gPanel/pkg/networking" ) const ( diff --git a/general/logging/file.go b/pkg/logging/file.go similarity index 100% rename from general/logging/file.go rename to pkg/logging/file.go diff --git a/general/networking/ip_address.go b/pkg/networking/ip_address.go similarity index 100% rename from general/networking/ip_address.go rename to pkg/networking/ip_address.go diff --git a/general/routing/contentTypes.go b/pkg/routing/content_types.go similarity index 100% rename from general/routing/contentTypes.go rename to pkg/routing/content_types.go diff --git a/general/routing/http_status.go b/pkg/routing/http_status.go similarity index 100% rename from general/routing/http_status.go rename to pkg/routing/http_status.go diff --git a/public_server/public_server.go b/public/public.go similarity index 82% rename from public_server/public_server.go rename to public/public.go index 9c6e535..362b6d2 100644 --- a/public_server/public_server.go +++ b/public/public.go @@ -1,13 +1,13 @@ -// Package public_server handles the logic of the public facing website -package public_server +// Package public handles the logic of the public facing website +package public import ( "bufio" "net/http" "os" - "github.com/Ennovar/gPanel/general/logging" - "github.com/Ennovar/gPanel/general/routing" + "github.com/Ennovar/gPanel/pkg/logging" + "github.com/Ennovar/gPanel/pkg/routing" ) type PublicWeb struct { @@ -17,7 +17,7 @@ type PublicWeb struct { // NewPublicWeb returns a new PublicWeb type. func NewPublicWeb() PublicWeb { return PublicWeb{ - Directory: "public/", + Directory: "document_roots/public/", } } diff --git a/private_server/private_server.go b/webhost/webhost.go similarity index 85% rename from private_server/private_server.go rename to webhost/webhost.go index 0e9fdd4..3ea13e7 100644 --- a/private_server/private_server.go +++ b/webhost/webhost.go @@ -1,13 +1,13 @@ -// Package private_server handles the logic of the private_server -package private_server +// Package webhost handles the logic of the webhosting panel +package webhost import ( "bufio" "net/http" "os" - "github.com/Ennovar/gPanel/general/logging" - "github.com/Ennovar/gPanel/general/routing" + "github.com/Ennovar/gPanel/pkg/logging" + "github.com/Ennovar/gPanel/pkg/routing" ) type PrivateHost struct { @@ -19,7 +19,7 @@ type PrivateHost struct { func NewPrivateHost() PrivateHost { return PrivateHost{ Auth: 1, - Directory: "private/", + Directory: "document_roots/webhost/", } }