Merge pull request #19 from blunket/master

slight refactors and such
This commit is contained in:
George Shaw 2017-10-23 14:21:45 -05:00 committed by GitHub
commit 647bd0bc91
2 changed files with 15 additions and 17 deletions

View file

@ -10,21 +10,20 @@ import (
"github.com/Ennovar/gPanel/general/routing"
)
type privateHost struct {
type PrivateHost struct {
Auth int
Directory string
}
func NewPrivateHost() privateHost {
priv := privateHost{}
priv.Auth = 1 // Handle Auth
priv.Directory = "private/"
return priv
// NewPrivateHost returns a new PrivateHost type.
func NewPrivateHost() PrivateHost {
return PrivateHost{
Auth: 1,
Directory: "private/",
}
}
func (priv *privateHost) ServeHTTP(w http.ResponseWriter, req *http.Request) {
func (priv *PrivateHost) ServeHTTP(w http.ResponseWriter, req *http.Request) {
path := req.URL.Path[1:]
path = (priv.Directory + path)

View file

@ -10,19 +10,18 @@ import (
"github.com/Ennovar/gPanel/general/routing"
)
type publicWeb struct {
type PublicWeb struct {
Directory string
}
func NewPublicWeb() publicWeb {
pub := publicWeb{}
pub.Directory = "public/"
return pub
// NewPublicWeb returns a new PublicWeb type.
func NewPublicWeb() PublicWeb {
return PublicWeb{
Directory: "public/",
}
}
func (pub *publicWeb) ServeHTTP(w http.ResponseWriter, req *http.Request) {
func (pub *PublicWeb) ServeHTTP(w http.ResponseWriter, req *http.Request) {
path := req.URL.Path[1:]
path = (pub.Directory + path)