From 64b4f38b21aee5b3101a9800af2b23f37b0a91eb Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sun, 9 Nov 2025 15:41:51 +0800 Subject: [PATCH] :art: Clean code Signed-off-by: Daniel <845765@qq.com> --- kernel/util/net.go | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/kernel/util/net.go b/kernel/util/net.go index e8c6dc6f7..acd607b80 100644 --- a/kernel/util/net.go +++ b/kernel/util/net.go @@ -33,21 +33,6 @@ import ( "github.com/siyuan-note/logging" ) -func ValidOptionalPort(port string) bool { - if port == "" { - return true - } - if port[0] != ':' { - return false - } - for _, b := range port[1:] { - if b < '0' || b > '9' { - return false - } - } - return true -} - func IsLocalHostname(hostname string) bool { if "localhost" == hostname || strings.HasSuffix(hostname, ".localhost") { return true @@ -67,8 +52,8 @@ func IsLocalHost(host string) bool { } func IsLocalOrigin(origin string) bool { - if url, err := url.Parse(origin); err == nil { - return IsLocalHostname(url.Hostname()) + if u, err := url.Parse(origin); err == nil { + return IsLocalHostname(u.Hostname()) } return false } @@ -180,11 +165,6 @@ func InvalidIDPattern(idArg string, result *gulu.Result) bool { return true } -func IsValidURL(str string) bool { - _, err := url.Parse(str) - return err == nil -} - func initHttpClient() { http.DefaultClient = httpclient.GetCloudFileClient2Min() http.DefaultTransport = httpclient.NewTransport(false)