aboutsummaryrefslogtreecommitdiff
path: root/rpc.go
diff options
context:
space:
mode:
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
+}