utils

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2023 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64ToUint8

func Base64ToUint8(encoded string) ([]uint8, error)

func ConvertStringSliceToIntSlice

func ConvertStringSliceToIntSlice(stringSlice []string) ([]int, error)

func GenerateKeyPair

func GenerateKeyPair() (string, string, error)

From sing-box return privateKey, publicKey and error

func GetEnvSocksAddr

func GetEnvSocksAddr() string

func Ints2Base64

func Ints2Base64(ints []int) (string, error)

Types

type HTTPClient

type HTTPClient interface {
	RestrictedTLS()
	ModernTLS()
	PinnedTLS12()
	PinnedSHA256(sumHex string)
	TrySocks5(socksAddr string)
	KeepAlive()
	NewRequest() HTTPRequest
	Close()
}

func NewHttpClient

func NewHttpClient() HTTPClient

type HTTPRequest

type HTTPRequest interface {
	SetURL(link string) error
	SetMethod(method string)
	SetHeader(key string, value string)
	SetContent(content []byte)
	SetContentString(content string)
	SetUserAgent(userAgent string)
	Execute() (HTTPResponse, error)
}

type HTTPResponse

type HTTPResponse interface {
	GetHeader(string) string
	GetContent() ([]byte, error)
	GetContentString() (string, error)
	WriteTo(path string) error
}

Jump to

Keyboard shortcuts

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