util

package
v0.0.0-...-0bee270 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 5, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dedup

func Dedup(original []string) []string

字符串切片去重

func ExtractHostname

func ExtractHostname(rawUrl string) (string, error)

ExtractHostname() extracts the hostname from a URL

func FilterNewLines

func FilterNewLines(s string) string

func FilterSubdomains

func FilterSubdomains(hostname string) (*regexp.Regexp, error)

FIXME: 目前要求输入的 hostname 必须为二级子域名 比如,输入 www.example.com 可以匹配 123.example.com 和 123.xxx.example.com 等下级子域名 但输入 123.xxx.example.com 或 example.com 都无法匹配 www.example.com

func FixURL

func FixURL(base *url.URL, path string) string

func GetExtension

func GetExtension(rawUrl string) string
Example
fmt.Println(GetExtension("http://www.example.com/path/test.jsp"))
fmt.Println(GetExtension("http://www.example.com/path/test.php"))
Output:

.jsp
.php

func IsAbsoluteURL

func IsAbsoluteURL(rawUrl string) bool

func IsScriptOrJSON

func IsScriptOrJSON(link string) bool

func IsSwaggerSchema

func IsSwaggerSchema(resp *colly.Response) bool

func StripQueryParams

func StripQueryParams(u *url.URL) string

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL