aboutsummaryrefslogtreecommitdiff
path: root/route.go
diff options
context:
space:
mode:
Diffstat (limited to 'route.go')
-rw-r--r--route.go18
1 files changed, 3 insertions, 15 deletions
diff --git a/route.go b/route.go
index e4de1de..26754ac 100644
--- a/route.go
+++ b/route.go
@@ -4,7 +4,6 @@ import (
"encoding/json"
"fmt"
"net/http"
- "net/url"
"os"
)
@@ -20,12 +19,6 @@ func (r Route) String() string {
return fmt.Sprintf("%v → %v", r.Host, r.Upstream)
}
-func (r Routes) ServeHTTP(w http.ResponseWriter, _ *http.Request) {
- for _, v := range r {
- fmt.Fprintln(w, v)
- }
-}
-
func (r Routes) Save(fname string) error {
fd, err := os.Create(fname)
if err != nil {
@@ -44,13 +37,8 @@ func (r *Routes) Load(fname string) error {
return json.NewDecoder(fd).Decode(r)
}
-func Slug(host string) (string, bool, error) {
- h, err := url.Parse(host)
- if err != nil {
- return "", false, err
- }
- if h.Path == "" {
- h.Path = "/"
+func (r Routes) ServeHTTP(w http.ResponseWriter, _ *http.Request) {
+ for _, v := range r {
+ fmt.Fprintln(w, v)
}
- return h.Host + h.Path, h.Scheme == "https", nil
}