http_util

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HttpContentType = map[string]string{
	".avi":  "video/avi",
	".mp3":  "audio/mp3",
	".mp4":  "video/mp4",
	".wmv":  "video/x-ms-wmv",
	".asf":  "video/x-ms-asf",
	".rm":   "application/vnd.rn-realmedia",
	".rmvb": "application/vnd.rn-realmedia-vbr",
	".mov":  "video/quicktime",
	".m4v":  "video/mp4",
	".flv":  "video/x-flv",
	".jpg":  "image/jpeg",
	".png":  "image/png",
}

Functions

func CheckServer

func CheckServer(address string, timeout time.Duration) (ok bool, err error)

func CheckServerByInterface

func CheckServerByInterface(interfaceName, address string, timeout time.Duration) (ok bool, err error)

func CheckServerByLocalAddr

func CheckServerByLocalAddr(ipv4LocalAddr *util.Address, address string, timeout time.Duration) (ok bool, err error)

func HttpContentTypeByExt

func HttpContentTypeByExt(filePath string) string

func HttpGetFromIP

func HttpGetFromIP(url, ipv4Addr string) (*http.Response, error)

func HttpResponseBodyToStruct

func HttpResponseBodyToStruct(response *http.Response, resultPtr interface{}) error

func NewFileUploadRequest

func NewFileUploadRequest(url, filedName string, path string, params map[string]string) (*http.Request, error)

Types

type CommonResp

type CommonResp struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data,omitempty"`
}

Jump to

Keyboard shortcuts

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