nodep

package
v1.260627.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PingDelayTimeout int64 = 11000
	PingDelayError   int64 = 10000
)

Variables

This section is empty.

Functions

func CoreHTTPClient

func CoreHTTPClient(timeout time.Duration, proxy string) (*http.Client, error)

func GetFreePorts

func GetFreePorts(count int) ([]int, error)

func MeasureDelay

func MeasureDelay(timeout int, url string, proxy string) (int64, error)

get the delay of some outbound. timeout means how long the http request will be cancelled if no response, in units of seconds. url means the website we use to test speed. "https://www.google.com" is a good choice for most cases. proxy means the local http/socks5 proxy, like "socks5://[::1]:1080". If proxy is empty, it means no proxy.

func PingHTTPRequest

func PingHTTPRequest(c *http.Client, url string, timeout int) (int64, error)

func WriteBytes

func WriteBytes(bytes []byte, path string) error

func WriteText

func WriteText(text string, path string) error

Types

type CallResponse

type CallResponse[T any] struct {
	Success bool   `json:"success"`
	Data    T      `json:"data,omitempty"`
	Err     string `json:"error,omitempty"`
}

func (CallResponse[T]) EncodeToBase64

func (response CallResponse[T]) EncodeToBase64(data T, err error) string

Jump to

Keyboard shortcuts

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