2024-07-05 14:41:35 +08:00
|
|
|
package utils
|
|
|
|
|
|
|
|
import "net/url"
|
|
|
|
|
|
|
|
type website struct{}
|
|
|
|
|
|
|
|
func WebSite() website {
|
|
|
|
return website{}
|
|
|
|
}
|
2024-08-09 11:45:32 +08:00
|
|
|
|
|
|
|
// GetHost
|
|
|
|
// @description: 获取主机host
|
|
|
|
// @receiver website
|
|
|
|
// @param addr
|
|
|
|
// @return string
|
2024-07-05 14:41:35 +08:00
|
|
|
func (website) GetHost(addr string) string {
|
|
|
|
uu, err := url.Parse(addr)
|
|
|
|
if err != nil {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
|
|
|
return uu.Host
|
|
|
|
}
|