17 lines
234 B
Go
17 lines
234 B
Go
package utils
|
|
|
|
import "net/url"
|
|
|
|
// GetHost
|
|
// @description: 获取指定地址的host
|
|
// @param addr
|
|
// @return string
|
|
func GetHost(addr string) string {
|
|
uu, err := url.Parse(addr)
|
|
if err != nil {
|
|
return ""
|
|
}
|
|
|
|
return uu.Host
|
|
}
|