Documentation ¶
Index ¶
- Constants
- func DownloadFile(remoteUrl string, params url.Values, headers map[string]string, ...) (body []byte, contentType string, err error)
- func GetClientIP(r *http.Request) (ip string)
- func GetClientIps(r *http.Request) (ips []string)
- func GetClientPlatform(r *http.Request) (clientPlatform string)
- func GetClientPublicIP(r *http.Request) (ip string)
- func GetClientSource(r *http.Request) (clientSource string)
- func Request(method string, remoteUrl string, params url.Values, headers map[string]string, ...) (resp *http.Response, err error)
- func RequestJson(v interface{}, method string, remoteUrl string, params url.Values, ...) error
- func SignCheckRequest(secret string, r *http.Request, timeValid time.Duration) (err error)
- func SignRequestParams(secret string, params url.Values) url.Values
- type ApiDataJson
- type ApiDataSelectOption
- type FilteringLogger
- type HttpClient
- func (uh *HttpClient) AddHeader(k string, v string) *HttpClient
- func (uh *HttpClient) BasicAuth(user string, password string) *HttpClient
- func (uh *HttpClient) BuildRemoteUrlAndParams(method string, path string) (remoteUrl string, params url.Values, err error)
- func (uh *HttpClient) ClearEncryptData() *HttpClient
- func (uh *HttpClient) ClearHeader() *HttpClient
- func (uh *HttpClient) ClearParams() *HttpClient
- func (uh *HttpClient) ClearRawBody() *HttpClient
- func (uh *HttpClient) DownloadFile(path string, headers map[string]string) (body []byte, contentType string, err error)
- func (uh *HttpClient) GetAesEncryptor() *utilEnc.AesEncryptor
- func (uh *HttpClient) GetLastRequestParams() url.Values
- func (uh *HttpClient) GetLastRequestUrl() string
- func (uh *HttpClient) GetLastRespStatusCode() int
- func (uh *HttpClient) PostFile(path string, filedName string, file string, headers map[string]string) (resp *http.Response, err error)
- func (uh *HttpClient) PostFileJson(v interface{}, path string, filedName string, file string, ...) error
- func (uh *HttpClient) PostFilePlain(path string, filedName string, file string, headers map[string]string) (body []byte, err error)
- func (uh *HttpClient) Request(method string, path string, additionalHeaders map[string]string) (resp *http.Response, err error)
- func (uh *HttpClient) RequestJson(v interface{}, method string, path string, additionalHeaders map[string]string) (err error)
- func (uh *HttpClient) RequestJsonApi(v interface{}, method string, path string, additionalHeaders map[string]string) (err error)
- func (uh *HttpClient) RequestJsonApiAndDecode(v interface{}, method string, path string, additionalHeaders map[string]string) (err error)
- func (uh *HttpClient) RequestPlain(method string, path string, additionalHeaders map[string]string) (body []byte, err error)
- func (uh *HttpClient) SetBaseUrl(baseUrl string) *HttpClient
- func (uh *HttpClient) SetClientCertPemContent(pemContent []byte, key []byte) *HttpClient
- func (uh *HttpClient) SetClientCertPemPath(path string) *HttpClient
- func (uh *HttpClient) SetLogger(logger *utilLogger.Logger) *HttpClient
- func (uh *HttpClient) SetSslVerify(v bool) *HttpClient
- func (uh *HttpClient) SetTimeout(timeout time.Duration) *HttpClient
- func (uh *HttpClient) SignRequest(secret string, method string, path string, params url.Values, ...) (resp *http.Response, err error)
- func (uh *HttpClient) UseProxySocks5(proxyAddr string, proxyUser string, proxyPassword string) *HttpClient
- func (uh *HttpClient) WithAesEncryptor(secret string, appId string) *HttpClient
- func (uh *HttpClient) WithEncryptData(data map[string]interface{}) *HttpClient
- func (uh *HttpClient) WithJsonData(data interface{}) *HttpClient
- func (uh *HttpClient) WithParams(params url.Values) *HttpClient
- func (uh *HttpClient) WithRawBody(body string) *HttpClient
- type HttpServer
- func (s *HttpServer) Run(logger *utilLogger.Logger, addresses ...*ServerListenAddr) (err error)
- func (s *HttpServer) SetIdleTimeout(t time.Duration) *HttpServer
- func (s *HttpServer) SetMaxHeaderBytes(i int) *HttpServer
- func (s *HttpServer) SetReadHeaderTimeout(t time.Duration) *HttpServer
- func (s *HttpServer) SetReadTimeout(t time.Duration) *HttpServer
- func (s *HttpServer) SetWriteTimeout(t time.Duration) *HttpServer
- func (s *HttpServer) VerifyClientSsl(caFile string) *HttpServer
- type Paginator
- func (p *Paginator) GetCurrentPage() int
- func (p *Paginator) GetPageNums() int
- func (p *Paginator) GetPages() []int
- func (p *Paginator) GetTotal() int64
- func (p *Paginator) HasNext() bool
- func (p *Paginator) HasPages() bool
- func (p *Paginator) HasPrev() bool
- func (p *Paginator) IsActive(page int) bool
- func (p *Paginator) Offset() int
- func (p *Paginator) PageLink(page int) string
- func (p *Paginator) PageLinkFirst() (link string)
- func (p *Paginator) PageLinkLast() (link string)
- func (p *Paginator) PageLinkNext() (link string)
- func (p *Paginator) PageLinkPrev() (link string)
- func (p *Paginator) SetTotal(total interface{})
- type ServerListenAddr
Constants ¶
View Source
const PROXY_TYPE_SOCKS5 = "socks5"
Variables ¶
This section is empty.
Functions ¶
func DownloadFile ¶
func GetClientIP ¶
func GetClientIps ¶
func GetClientPlatform ¶
func GetClientPublicIP ¶
func GetClientSource ¶
func RequestJson ¶
func SignCheckRequest ¶
Types ¶
type ApiDataJson ¶
type ApiDataSelectOption ¶
type FilteringLogger ¶
type FilteringLogger struct {
// contains filtered or unexported fields
}
func NewFilteringWriter ¶
func NewFilteringWriter(logger *utilLogger.Logger, excludeStrings ...string) *FilteringLogger
type HttpClient ¶
type HttpClient struct {
// contains filtered or unexported fields
}
func NewHttpClient ¶
func NewHttpClient(baseUrl string, timeout ...time.Duration) (uh *HttpClient)
func (*HttpClient) AddHeader ¶
func (uh *HttpClient) AddHeader(k string, v string) *HttpClient
func (*HttpClient) BasicAuth ¶
func (uh *HttpClient) BasicAuth(user string, password string) *HttpClient
func (*HttpClient) BuildRemoteUrlAndParams ¶
func (*HttpClient) ClearEncryptData ¶
func (uh *HttpClient) ClearEncryptData() *HttpClient
func (*HttpClient) ClearHeader ¶
func (uh *HttpClient) ClearHeader() *HttpClient
func (*HttpClient) ClearParams ¶
func (uh *HttpClient) ClearParams() *HttpClient
func (*HttpClient) ClearRawBody ¶
func (uh *HttpClient) ClearRawBody() *HttpClient
func (*HttpClient) DownloadFile ¶
func (*HttpClient) GetAesEncryptor ¶
func (uh *HttpClient) GetAesEncryptor() *utilEnc.AesEncryptor
func (*HttpClient) GetLastRequestParams ¶
func (uh *HttpClient) GetLastRequestParams() url.Values
func (*HttpClient) GetLastRequestUrl ¶
func (uh *HttpClient) GetLastRequestUrl() string
func (*HttpClient) GetLastRespStatusCode ¶
func (uh *HttpClient) GetLastRespStatusCode() int
func (*HttpClient) PostFileJson ¶
func (*HttpClient) PostFilePlain ¶
func (*HttpClient) RequestJson ¶
func (*HttpClient) RequestJsonApi ¶
func (*HttpClient) RequestJsonApiAndDecode ¶
func (*HttpClient) RequestPlain ¶
func (*HttpClient) SetBaseUrl ¶
func (uh *HttpClient) SetBaseUrl(baseUrl string) *HttpClient
func (*HttpClient) SetClientCertPemContent ¶
func (uh *HttpClient) SetClientCertPemContent(pemContent []byte, key []byte) *HttpClient
func (*HttpClient) SetClientCertPemPath ¶
func (uh *HttpClient) SetClientCertPemPath(path string) *HttpClient
func (*HttpClient) SetLogger ¶
func (uh *HttpClient) SetLogger(logger *utilLogger.Logger) *HttpClient
func (*HttpClient) SetSslVerify ¶
func (uh *HttpClient) SetSslVerify(v bool) *HttpClient
func (*HttpClient) SetTimeout ¶
func (uh *HttpClient) SetTimeout(timeout time.Duration) *HttpClient
func (*HttpClient) SignRequest ¶
func (*HttpClient) UseProxySocks5 ¶
func (uh *HttpClient) UseProxySocks5(proxyAddr string, proxyUser string, proxyPassword string) *HttpClient
func (*HttpClient) WithAesEncryptor ¶
func (uh *HttpClient) WithAesEncryptor(secret string, appId string) *HttpClient
func (*HttpClient) WithEncryptData ¶
func (uh *HttpClient) WithEncryptData(data map[string]interface{}) *HttpClient
func (*HttpClient) WithJsonData ¶
func (uh *HttpClient) WithJsonData(data interface{}) *HttpClient
func (*HttpClient) WithParams ¶
func (uh *HttpClient) WithParams(params url.Values) *HttpClient
func (*HttpClient) WithRawBody ¶
func (uh *HttpClient) WithRawBody(body string) *HttpClient
type HttpServer ¶
type HttpServer struct {
// contains filtered or unexported fields
}
func NewHttpServe ¶
func NewHttpServe(handler http.Handler, addresses ...*ServerListenAddr) (s *HttpServer)
func (*HttpServer) Run ¶
func (s *HttpServer) Run(logger *utilLogger.Logger, addresses ...*ServerListenAddr) (err error)
func (*HttpServer) SetIdleTimeout ¶
func (s *HttpServer) SetIdleTimeout(t time.Duration) *HttpServer
func (*HttpServer) SetMaxHeaderBytes ¶
func (s *HttpServer) SetMaxHeaderBytes(i int) *HttpServer
func (*HttpServer) SetReadHeaderTimeout ¶
func (s *HttpServer) SetReadHeaderTimeout(t time.Duration) *HttpServer
func (*HttpServer) SetReadTimeout ¶
func (s *HttpServer) SetReadTimeout(t time.Duration) *HttpServer
func (*HttpServer) SetWriteTimeout ¶
func (s *HttpServer) SetWriteTimeout(t time.Duration) *HttpServer
func (*HttpServer) VerifyClientSsl ¶
func (s *HttpServer) VerifyClientSsl(caFile string) *HttpServer
type Paginator ¶
type Paginator struct { Request *http.Request `json:"-"` PerPage int `json:"per_page"` CurrentPage int `json:"current_page"` MaxPages int `json:"-"` Total int64 `json:"total"` PageRange []int `json:"page_range"` PageNums int `json:"page_nums"` }
func NewPaginator ¶
func (*Paginator) GetCurrentPage ¶
func (*Paginator) GetPageNums ¶
func (*Paginator) PageLinkFirst ¶
func (*Paginator) PageLinkLast ¶
func (*Paginator) PageLinkNext ¶
func (*Paginator) PageLinkPrev ¶
type ServerListenAddr ¶
type ServerListenAddr struct { Network string `json:"network,omitempty"` Addr string `json:"addr,omitempty"` Uid int `json:"uid,omitempty"` Gid int `json:"gid,omitempty"` SslServerCertFile string `json:"ssl_server_cert_file,omitempty"` SslServerKeyFile string `json:"ssl_server_key_file,omitempty"` }
Click to show internal directories.
Click to hide internal directories.