net

package
v2.0.37+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package net provides simple networking helper functions

Index

Constants

View Source
const (
	// TCP is a protocol string constant
	TCP = "tcp"

	// UDP is a protocol string constant
	UDP = "udp"
)

Variables

This section is empty.

Functions

func DisableProxy

func DisableProxy(proxy *url.URL)

DisableProxy unsets the http_proxy env var and sets the http.DefaultTransport to not use a proxy

func DownloadFile

func DownloadFile(url, dst string, perms ...uint32) (result string, err error)

DownloadFile from the given URL to the given destination returning the full path to the resulting downloaded file

func EnableProxy

func EnableProxy(proxy *url.URL)

EnableProxy sets the http_proxy env var and sets the http.DefaultTransport to use a proxy

func Ping

func Ping(proto, addr string, timeout ...int) (err error)

Ping simply checks if the given protocol, address is accessible and listening. An error will be returned if the ping was not successful. optional timeout in seconds defaults to 1

Types

This section is empty.

Jump to

Keyboard shortcuts

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