v2 init commit

This commit is contained in:
Toby Chui
2023-05-22 23:05:59 +08:00
parent 5ac0fdde1d
commit c07d5f85df
87 changed files with 273125 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
package dpcore
import (
"net/url"
)
func replaceLocationHost(urlString string, newHost string, useTLS bool) (string, error) {
u, err := url.Parse(urlString)
if err != nil {
return "", err
}
if useTLS {
u.Scheme = "https"
} else {
u.Scheme = "http"
}
u.Host = newHost
return u.String(), nil
}