24 lines
325 B
Go
24 lines
325 B
Go
package utils
|
|
|
|
import "net/url"
|
|
|
|
type website struct{}
|
|
|
|
func WebSite() website {
|
|
return website{}
|
|
}
|
|
|
|
// GetHost
|
|
// @description: 获取主机host
|
|
// @receiver website
|
|
// @param addr
|
|
// @return string
|
|
func (website) GetHost(addr string) string {
|
|
uu, err := url.Parse(addr)
|
|
if err != nil {
|
|
return ""
|
|
}
|
|
|
|
return uu.Host
|
|
}
|