dae/common/netutils/url.go
2023-03-14 15:01:55 +08:00

26 lines
366 B
Go

/*
* SPDX-License-Identifier: AGPL-3.0-only
* Copyright (c) 2022-2023, daeuniverse Organization <dae@v2raya.org>
*/
package netutils
import "net/url"
type URL struct {
*url.URL
}
func (u *URL) Port() string {
if port := u.URL.Port(); port != "" {
return port
}
switch u.Scheme {
case "http":
return "80"
case "https":
return "443"
}
return ""
}