support '0' listening port, readme update, showcase added

This commit is contained in:
yusing
2024-09-23 04:09:56 +08:00
parent 090b73d287
commit 3b597eea29
9 changed files with 271 additions and 241 deletions

View File

@@ -1,6 +1,10 @@
package utils
import "strings"
import (
"net/url"
"strconv"
"strings"
)
func CommaSeperatedList(s string) []string {
res := strings.Split(s, ",")
@@ -9,3 +13,11 @@ func CommaSeperatedList(s string) []string {
}
return res
}
func ExtractPort(fullURL string) (int, error) {
url, err := url.Parse(fullURL)
if err != nil {
return 0, err
}
return strconv.Atoi(url.Port())
}