aboutsummaryrefslogtreecommitdiff
path: root/rpc.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 /rpc.go
parent8548c9747fc0a4deb470fd89a255041eda2b79f1 (diff)
parenta09a47d1f8812e837080d5af9461113109555b23 (diff)
Merge branch 'master' of dim13.org:goxy
Diffstat (limited to 'rpc.go')
-rw-r--r--rpc.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/rpc.go b/rpc.go
index 1f3c877..10c311f 100644
--- a/rpc.go
+++ b/rpc.go
@@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"net/rpc"
+ "net/url"
)
var (
@@ -65,3 +66,14 @@ func (s GoXY) List(_ struct{}, ret *[]string) error {
}
return nil
}
+
+func Slug(host string) (string, bool, error) {
+ h, err := url.Parse(host)
+ if err != nil {
+ return "", false, err
+ }
+ if h.Path == "" {
+ h.Path = "/"
+ }
+ return h.Host + h.Path, h.Scheme == "https", nil
+}