Documentation ¶
Index ¶
- Variables
- func AddParameterToURL(URL string, parameter map[string]string) (string, error)
- func Client(tr *http.Transport, timeout time.Duration) *http.Client
- func ClientSetCookie(request *http.Request, data map[string]string)
- func CloseRsp(response *http.Response)
- func CreateToken(payload map[string]interface{}, key string) (string, error)
- func GetParameterFromURL(URL *url.URL) (url.Values, error)
- func GetRequest2(method string, url string, body io.Reader) (*http.Request, error)
- func GetSkipTlsConfig() *tls.Config
- func GetTlsConfig(caFilePath string) (*tls.Config, error)
- func NewListener(addr string, readTimeout, writeTimeout time.Duration) (net.Listener, error)
- func NewRequest(method string, url string, body []byte) (*http.Request, error)
- func NewUnixListener(path string, readTimeout, writeTimeout time.Duration) (net.Listener, error)
- func ParseToken(tokenStr string, key string) (jwt.MapClaims, error)
- func ServerDelCookie(rw http.ResponseWriter, name string)
- func ServerGetCookie(request *http.Request, key string) (string, error)
- func ServerSetCookie(rw http.ResponseWriter, data map[string]string)
- func SetHeader(req *http.Request, data map[string]string)
- func StartServer(addr string, handler http.Handler, timeout time.Duration) error
- func TLSTransport(tls *tls.Config) *http.Transport
- func Transport() *http.Transport
- type Conn
- type Listener
Constants ¶
This section is empty.
Variables ¶
var ErrorOfEmptyClient = errors.New("client is nil")
Functions ¶
func AddParameterToURL ¶
AddParameterToURL add parameter to URL
func ClientSetCookie ¶
ClientSetCookie client set cookie.
func CreateToken ¶
CreateToken create token
iss: 签发者 sub: 面向的用户 aud: 接收方 exp: 过期时间 nbf: 生效时间 iat: 签发时间 jti: 唯一身份标识
func GetParameterFromURL ¶
GetParameterFromURL get parameter from URL
func GetRequest2 ¶
func GetSkipTlsConfig ¶
func NewListener ¶
func NewRequest ¶
NewRequest create a request
func NewUnixListener ¶
Binds to a UNIX socket. If the file already exists, try to remove it before binding again. This logic is borrowed from Gunicorn (see https://github.com/benoitc/gunicorn/blob/a8963ef1a5a76f3df75ce477b55fe0297e3b617d/gunicorn/sock.py#L106)
func ParseToken ¶
ParseToken analyse token
func ServerDelCookie ¶
func ServerDelCookie(rw http.ResponseWriter, name string)
ServerDelCookie server revoke cookie.
func ServerGetCookie ¶
ServerGetCookie server get cookie value from request by key
func ServerSetCookie ¶
func ServerSetCookie(rw http.ResponseWriter, data map[string]string)
ServerSetCookie server set cookie.
Types ¶
type Conn ¶
type Conn struct { net.Conn ReadTimeout time.Duration WriteTimeout time.Duration // contains filtered or unexported fields }
Conn wraps a net.Conn, and sets a deadline for every read and write operation.
type Listener ¶
Listener wraps a net.Listener, and gives a place to store the timeout parameters. On Accept, it will wrap the net.Conn with our own Conn for us. Original implementation taken from https://gist.github.com/jbardin/9663312 Thanks! <3