better pool and changed schema

This commit is contained in:
ston1th 2020-06-03 23:10:22 +02:00
commit 249d7c6844
4 changed files with 82 additions and 21 deletions

View file

@ -13,7 +13,7 @@ const PVEScheme = "pve"
var ErrInvalidPVEURL = errors.New("invalid pve url scheme")
func ParseURL(s string) (node, id string, err error) {
func ParseURL(s string) (pool, id string, err error) {
u, err := url.Parse(s)
if err != nil {
return
@ -25,6 +25,6 @@ func ParseURL(s string) (node, id string, err error) {
return u.Host, strings.TrimPrefix(u.Path, "/"), nil
}
func NewURL(node, id string) string {
return fmt.Sprintf("%s://%s/%s", PVEScheme, node, id)
func NewURL(pool, id string) string {
return fmt.Sprintf("%s://%s/%s", PVEScheme, pool, id)
}