httplib

package
v0.0.0-...-fea5f46 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DigestAuth

func DigestAuth(ip string, port int, authURL string, method string, userName, userPwd string) (string, error)

func DigestAuth1

func DigestAuth1(ip string, port int, authURL string, body []byte, method string, userName, userPwd string) ([]byte, error)

Types

type AuthHandle

type AuthHandle func(request *http.Request) (interface{}, error)

AuthHandle AuthHandle

type CallBackHandle

type CallBackHandle func(response *Response, request *Request)

CallBackHandle CallBackHandle

type HTTPServer

type HTTPServer struct {
	AllowOrigin []string
	// contains filtered or unexported fields
}

HTTPServer HTTPServer

func (*HTTPServer) AddCORS

func (h *HTTPServer) AddCORS(urls ...string)

AddCORS AddCORS

func (*HTTPServer) RegisterFS

func (h *HTTPServer) RegisterFS(virtualPath string, embedPath string, f fs.FS)

RegisterVirtualPath RegisterVirtualPath

func (*HTTPServer) RegisterHandle

func (h *HTTPServer) RegisterHandle(url string, callBackHandle CallBackHandle)

RegisterHandle RegisterHandle

func (*HTTPServer) RegisterHandleAuth

func (h *HTTPServer) RegisterHandleAuth(url string, callBackHandle CallBackHandle)

RegisterHandleAuth RegisterHandleAuth

func (*HTTPServer) RegisterVirtualPath

func (h *HTTPServer) RegisterVirtualPath(virtualPath, localPath string)

RegisterVirtualPath RegisterVirtualPath

func (*HTTPServer) RegisterVirtualPathAuth

func (h *HTTPServer) RegisterVirtualPathAuth(virtualPath, localPath string)

RegisterVirtualPath RegisterVirtualPath

func (*HTTPServer) RegisterWebSocket

func (h *HTTPServer) RegisterWebSocket(url string, handle websocket.Handler)

RegisterWebSocket RegisterWebSocket

func (*HTTPServer) ServeHTTP

func (h *HTTPServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP ServeHTTP

func (*HTTPServer) SetAuthHandle

func (h *HTTPServer) SetAuthHandle(authHandle AuthHandle)

func (*HTTPServer) StartServer

func (h *HTTPServer) StartServer(port int) error

StartServer StartServer

func (*HTTPServer) StartServerTLS

func (h *HTTPServer) StartServerTLS(port int, certFile string, keyFile string) error

StartServer StartServer

func (*HTTPServer) StopServer

func (h *HTTPServer) StopServer()

type Handle

type Handle struct {
	NeedLogin      bool
	AuthInfo       interface{}
	Handler        http.Handler
	CallBackHandle CallBackHandle
	Path           string
	MatchStart     bool
}

type HttpProxy

type HttpProxy struct {
	// contains filtered or unexported fields
}

func (*HttpProxy) DeleteMessage

func (h *HttpProxy) DeleteMessage(url string, params url.Values) ([]byte, error)

GetMessage GetMessage

func (*HttpProxy) DownloadFile

func (h *HttpProxy) DownloadFile(remoteFilename, localFilename string) error

func (*HttpProxy) ForwardRequest

func (h *HttpProxy) ForwardRequest(responseRaw *Response, requestRaw *Request) error

Transport Transport

func (*HttpProxy) GetBaseUrl

func (h *HttpProxy) GetBaseUrl() string

func (*HttpProxy) GetMessage

func (h *HttpProxy) GetMessage(url string, params url.Values) ([]byte, error)

GetMessage GetMessage

func (*HttpProxy) GetMessageWidthTimeout

func (h *HttpProxy) GetMessageWidthTimeout(url string, params url.Values, timeout time.Duration) ([]byte, error)

GetMessage GetMessage

func (*HttpProxy) PostMessage

func (h *HttpProxy) PostMessage(requestURL string, content interface{}) ([]byte, error)

PostMessage PostMessage

func (*HttpProxy) PostMessages

func (h *HttpProxy) PostMessages(requestURL string, content interface{}, timeout time.Duration) ([]byte, error)

PostMessage PostMessage

func (*HttpProxy) PutMessage

func (h *HttpProxy) PutMessage(url string, content interface{}) ([]byte, error)

func (*HttpProxy) SetAuthorization

func (h *HttpProxy) SetAuthorization(key string)

func (*HttpProxy) SetBaseUrl

func (h *HttpProxy) SetBaseUrl(url string)

SetBaseUrl http://localhost:80

func (*HttpProxy) SetHeader

func (h *HttpProxy) SetHeader(key, value string)

func (*HttpProxy) UploadFile

func (h *HttpProxy) UploadFile(url string, fileName string, datas []byte) error

type Request

type Request struct {
	*http.Request
	AuthInfo interface{}
}

Request Request

func (*Request) GetBodyBuffer

func (r *Request) GetBodyBuffer() []byte

GetBodyBuffer GetBodyBuffer

func (*Request) GetFormBool

func (r *Request) GetFormBool(key string) bool

GetFormInt GetFormInt

func (*Request) GetFormInt

func (r *Request) GetFormInt(key string) int

GetFormInt GetFormInt

func (*Request) GetFormIntSlice

func (r *Request) GetFormIntSlice(key string) []int

GetFormIntSlice GetFormIntSlice

func (*Request) GetFormJsonIntSlice

func (r *Request) GetFormJsonIntSlice(key string) ([]int, error)

GetFormIntSlice GetFormIntSlice

func (*Request) GetFormString

func (r *Request) GetFormString(key string) string

GetFormString GetFormString

func (*Request) GetFormStringSlice

func (r *Request) GetFormStringSlice(key string) []string

GetFormStringSlice GetFormStringSlice

func (*Request) GetJSONValue

func (r *Request) GetJSONValue(entity interface{}) error

GetJSONValue GetJSONValue

func (*Request) GetToken

func (r *Request) GetToken() string

type Response

type Response struct {
	http.ResponseWriter
}

Response Response

func (*Response) ResponseResult

func (r *Response) ResponseResult(content interface{}, err error)

ResponseResult ResponseResult

Jump to

Keyboard shortcuts

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