netutil

package
v1.0.39 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleJSON added in v1.0.37

func HandleJSON(w http.ResponseWriter, r *http.Request, h func(ctx context.Context, r *http.Request) (interface{}, error))

func IsTCPAddrServing

func IsTCPAddrServing(url string, timeout time.Duration) (bool, error)

func ParamErrorf added in v1.0.37

func ParamErrorf(format string, args ...interface{}) error

func ServePort

func ServePort(port int, autoIncrPort bool, watchTimeout time.Duration, watch func(port int), doWithPort func(port int) error) error

suggested watch timeout: 500ms

func ServePortHTTP added in v1.0.37

func ServePortHTTP(server *http.ServeMux, port int, autoIncrPort bool, watchTimeout time.Duration, watch func(port int)) error

func SetCORSHeaders added in v1.0.37

func SetCORSHeaders(w http.ResponseWriter)

allow request from arbitrary host

Types

type HttpStatusErr added in v1.0.37

type HttpStatusErr interface {
	error
	HttpStatusCode() int
}

Jump to

Keyboard shortcuts

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