mirror of
https://github.com/tobychui/zoraxy.git
synced 2025-08-06 21:28:30 +02:00
v2 init commit
This commit is contained in:
21
src/mod/dynamicproxy/dpcore/utils.go
Normal file
21
src/mod/dynamicproxy/dpcore/utils.go
Normal 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
|
||||
}
|
Reference in New Issue
Block a user