diff --git a/src/global/global.go b/src/global/global.go
new file mode 100644
index 0000000..a8b7268
--- /dev/null
+++ b/src/global/global.go
@@ -0,0 +1,31 @@
+package global
+import (
+ . "mailautoconf/structs"
+ "github.com/vaughan0/go-ini"
+ "fmt"
+)
+
+// Global variables
+var ThisSession Session
+var MainConfig Config
+const defaultConfigDir string = "default-config/"
+const configDir string = "config/"
+
+func NewConfig() Config {
+ fmt.Println("Loading Config…")
+ cfg := "default-config/config.default.ini"
+ conf, err := ini.LoadFile(cfg)
+ if err != nil {
+ fmt.Println(err.Error())
+ }
+ fmt.Println(conf)
+ fmt.Println("Loading Services…")
+ srv := "default-config/services.default.ini"
+ serv, err2 := ini.LoadFile(srv)
+ if err2 != nil {
+ fmt.Println(err2.Error())
+ }
+ fmt.Println(serv)
+ newcfg := Config{}
+ return newcfg
+}
diff --git a/src/go.mod b/src/go.mod
new file mode 100644
index 0000000..3bc798b
--- /dev/null
+++ b/src/go.mod
@@ -0,0 +1,7 @@
+module mailautoconf
+
+go 1.16
+
+require (
+ github.com/vaughan0/go-ini v0.0.0-20130923145212-a98ad7ee00ec // indirect
+)
diff --git a/src/go.sum b/src/go.sum
new file mode 100644
index 0000000..bac961c
--- /dev/null
+++ b/src/go.sum
@@ -0,0 +1,2 @@
+github.com/vaughan0/go-ini v0.0.0-20130923145212-a98ad7ee00ec h1:DGmKwyZwEB8dI7tbLt/I/gQuP559o/0FrAkHKlQM/Ks=
+github.com/vaughan0/go-ini v0.0.0-20130923145212-a98ad7ee00ec/go.mod h1:owBmyHYMLkxyrugmfwE/DLJyW8Ro9mkphwuVErQ0iUw=
diff --git a/src/mailautoconf.go b/src/mailautoconf.go
new file mode 100644
index 0000000..787a5e9
--- /dev/null
+++ b/src/mailautoconf.go
@@ -0,0 +1,16 @@
+package main
+
+import (
+ "fmt"
+ "net/http"
+ "log"
+ "mailautoconf/web/handler"
+ . "mailautoconf/global"
+)
+
+func main() {
+ MainConfig = NewConfig()
+ http.HandleFunc("/", handler.WebHandler)
+ fmt.Println("Starting up Web Listener on port 8080")
+ log.Fatal(http.ListenAndServe(":8080", nil))
+}
diff --git a/src/main.go b/src/main.go
deleted file mode 100644
index bcb977f..0000000
--- a/src/main.go
+++ /dev/null
@@ -1,20 +0,0 @@
-package main
-
-import (
- "fmt"
- "net/http"
- "log"
-)
-
-func handler(w http.ResponseWriter, r *http.Request) {
- fmt.Fprintf(w, "Hi there, I love %s!", r.URL.Path[1:])
-}
-
-func main() {
- http.HandleFunc("/", handler)
- log.Fatal(http.ListenAndServe(":8080", nil))
-}
-
-func do_this(){
- fmt.Println("doing this")
-}
diff --git a/src/structs/structs.go b/src/structs/structs.go
new file mode 100644
index 0000000..46db476
--- /dev/null
+++ b/src/structs/structs.go
@@ -0,0 +1,18 @@
+package structs
+// I don't like the name of this package, consider naming it "core" or
+// separating out the structs and core functions
+
+import "net/http"
+
+type Session struct {
+ ResponseWriter http.ResponseWriter
+ Request *http.Request
+ Path string
+ WebContent string
+}
+type Config struct {
+ Services []Service
+}
+type Service struct {
+
+}
diff --git a/src/templates/autoconfig.html b/src/templates/autoconfig.html
new file mode 100644
index 0000000..2ce1ccb
--- /dev/null
+++ b/src/templates/autoconfig.html
@@ -0,0 +1,58 @@
+
+
+ ">
+
+
+
+ %EMAILADDRESS%
+
+ ">
+
+
+
+ get_username($service,$email_address); ?>
+
+
+
+ ">
+
+
+
+ get_username($service,$email_address);?>
+
+
+
+ ">
+ get_username($service,$email_address);?>
+
+
+
+
+ ">
+ get_username($service,$email_address);?>
+
+
+
+
+
+ " />
+ ">
+ get_username($service,$email_address);?>
+ " name="" />
+ " />
+ " name=""/>
+
+
+
+
+
diff --git a/src/templates/autodiscover.html b/src/templates/autodiscover.html
new file mode 100644
index 0000000..3a9342b
--- /dev/null
+++ b/src/templates/autodiscover.html
@@ -0,0 +1,45 @@
+
+
+
+
+
+ email
+ settings
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/web/handler/handler.go b/src/web/handler/handler.go
new file mode 100644
index 0000000..cd5d8ce
--- /dev/null
+++ b/src/web/handler/handler.go
@@ -0,0 +1,32 @@
+package handler
+import (
+ . "mailautoconf/structs"
+ . "mailautoconf/global"
+ "mailautoconf/web/responses"
+ "strings"
+ "net/http"
+ "fmt"
+)
+func WebHandler(w http.ResponseWriter, r *http.Request) {
+ ThisSession = Session{}
+ ThisSession.ResponseWriter = w
+ ThisSession.Request = r
+ ThisSession.Path = strings.ToLower(r.URL.Path[1:])
+
+ switch ThisSession.Path {
+ case "mail/config-v1.1.xml":
+ ThisSession.WebContent = responses.MozAutoconfig()
+ case "autodiscover/autodiscover.xml":
+ ThisSession.WebContent = responses.MsAutoDiscoverXML()
+ case "autodiscover/autodiscover.json":
+ ThisSession.WebContent = responses.MsAutoDiscoverJSON()
+ default:
+ ThisSession.WebContent = responses.DefaultResponse()
+ }
+
+ writeWebOutput()
+}
+
+func writeWebOutput () {
+ fmt.Fprintf(ThisSession.ResponseWriter, ThisSession.WebContent)
+}
diff --git a/src/web/responses/responses.go b/src/web/responses/responses.go
new file mode 100644
index 0000000..8f85c82
--- /dev/null
+++ b/src/web/responses/responses.go
@@ -0,0 +1,14 @@
+package responses
+
+func MozAutoconfig() string {
+ return ""
+}
+func MsAutoDiscoverXML() string {
+ return ""
+}
+func MsAutoDiscoverJSON() string {
+ return ""
+}
+func DefaultResponse() string {
+ return ""
+}