aboutsummaryrefslogtreecommitdiff
path: root/route.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-04-09 16:44:42 +0200
committerDimitri Sokolyuk <demon@dim13.org>2016-04-09 16:44:42 +0200
commitac2b3c495184fc4eca6823c83bbef27551eafe99 (patch)
tree8d7b5fefb21f13571b57ddcc361735a1fc8eea41 /route.go
parent8548c9747fc0a4deb470fd89a255041eda2b79f1 (diff)
parenta09a47d1f8812e837080d5af9461113109555b23 (diff)
Merge branch 'master' of dim13.org:goxy
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
}