utils

package
v0.0.0-...-86283f3 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GoogleResolver = &net.Resolver{
	PreferGo: true,
	Dial: func(ctx context.Context, network, address string) (net.Conn, error) {
		d := net.Dialer{
			Timeout: 10 * time.Second,
		}
		return d.DialContext(ctx, network, "8.8.8.8:53")
	},
}

Functions

func BreakBaseURL

func BreakBaseURL(rawurl string) (scheme, ipaddr, port string, err error)

func ContainsDotDot

func ContainsDotDot(v string) bool

func EqualDomain

func EqualDomain(d1, d2 string) bool

func ExtractRootDomain

func ExtractRootDomain(domain string) (string, error)

ExtractRootDomain extracts the EffectiveTLDPlusOne, see https://godoc.org/golang.org/x/net/publicsuffix#EffectiveTLDPlusOne for more explanations

func ForceIPHTTPClient

func ForceIPHTTPClient(ip, port string) *http.Client

func ForceIPWebsocketDialer

func ForceIPWebsocketDialer(ip, port string) *websocket.Dialer

func FormatHelloServerName

func FormatHelloServerName(servername string) (string, error)

func IsSlashRune

func IsSlashRune(r rune) bool

func Redirect2HTTPS

func Redirect2HTTPS(w http.ResponseWriter, req *http.Request)

func SplitHostPort

func SplitHostPort(hostport string) (string, string)

func SplitSlash

func SplitSlash(url string) []string

func StripPort

func StripPort(hostport string) string

StripPort also removes IPV6 addresses square brackets

func StripSchemePort

func StripSchemePort(uri string) string

StripPort also removes IPV6 addresses square brackets

func UploadEmbedFolderMultipart

func UploadEmbedFolderMultipart(client *http.Client, url, method string, relfilepaths []string, files []fs.File, fields ...string) (*http.Response, error)

func UploadFileMultipart

func UploadFileMultipart(client *http.Client, url string, path string) (*http.Response, error)

func UploadFolderMultipart

func UploadFolderMultipart(client *http.Client, url, method string, folder string, fields ...string) (*http.Response, error)

func VerifyTXT

func VerifyTXT(domain, token string) (bool, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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