utils

package
v0.0.0-...-df9b43f Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatParagraphs

func FormatParagraphs(in string, width int, indent int) string

func GenerateRandomBytes

func GenerateRandomBytes(n int) ([]byte, error)

GenerateRandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func GenerateRandomString

func GenerateRandomString(s int) (string, error)

GenerateRandomString returns a URL-safe, base64 encoded securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func GetAttribute

func GetAttribute(tag html.Token, name string) string

func GetNetworkConnection

func GetNetworkConnection(onionService string, port int, proxyAddress string, timeout time.Duration) (net.Conn, error)

func IsOnion

func IsOnion(identifier string) bool

func ProxyStatusMessage

func ProxyStatusMessage(status ProxyStatus) string

func RemoveDuplicates

func RemoveDuplicates(xs *[]string)

RemoveDuplicates is a utility function

func WithoutProtocol

func WithoutProtocol(url string) string

func WithoutSubdomains

func WithoutSubdomains(urlhost string) string

Types

type ProxyStatus

type ProxyStatus int
const (
	ProxyStatusOK ProxyStatus = iota
	ProxyStatusWrongType
	ProxyStatusCannotConnect
	ProxyStatusTimeout
)

func CheckTorProxy

func CheckTorProxy(proxyAddress string) ProxyStatus

Detect whether a proxy is connectable and is a Tor proxy

Jump to

Keyboard shortcuts

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