Documentation
¶
Index ¶
- Constants
- func CoreHTTPClient(timeout time.Duration, proxy string) (*http.Client, error)
- func GetFreePorts(count int) ([]int, error)
- func MeasureDelay(timeout int, url string, proxy string) (int64, error)
- func PingHTTPRequest(c *http.Client, url string, timeout int) (int64, error)
- func WriteBytes(bytes []byte, path string) error
- func WriteText(text string, path string) error
- type CallResponse
Constants ¶
View Source
const ( PingDelayTimeout int64 = 11000 PingDelayError int64 = 10000 )
Variables ¶
This section is empty.
Functions ¶
func CoreHTTPClient ¶
func GetFreePorts ¶
func MeasureDelay ¶
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 WriteBytes ¶
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
Click to show internal directories.
Click to hide internal directories.