ip-ddns/adapter/directadmin/utils.go

27 lines
458 B
Go
Raw Normal View History

2023-11-17 07:20:10 +01:00
package directadmin
import (
"net/url"
"strings"
)
func resolveParams(src string) (map[string][]string, error) {
dst := map[string][]string{}
for _, pair := range strings.Split(src, "&") {
key, val, ok := strings.Cut(pair, "=")
if ok {
if _, ok := dst[key]; !ok {
dst[key] = []string{}
}
unesc, err := url.QueryUnescape(val)
if err != nil {
return nil, err
}
dst[key] = append(dst[key], unesc)
}
}
return dst, nil
}