Documentation ¶
Overview ¶
*------------------------------------------------------------**
- @filename jiny/client.go
- @author jinycoo
- @version 1.0.0
- @date 2019-09-19 10:00
- @desc jiny - api client **------------------------------------------------------------*
*------------------------------------------------------------**
- @filename jiny/csrf.go
- @author jinycoo
- @version 1.0.0
- @date 2019-07-24 10:11
- @desc jiny - csrf header validate **------------------------------------------------------------*
*------------------------------------------------------------**
- @filename jiny/jiny.go
- @author jinycoo
- @version 1.0.0
- @date 2019-07-24 09:41
- @desc jiny - http server **------------------------------------------------------------*
*------------------------------------------------------------**
- @filename auth/jwt.go
- @author jinycoo
- @version 1.0.0
- @date 2019-07-24 14:15
- @desc auth - jwt token **------------------------------------------------------------*
*------------------------------------------------------------**
- @filename jiny/metadata.go
- @author jinycoo
- @version 1.0.0
- @date 2019-09-19 10:14
- @desc jiny - metadata **------------------------------------------------------------*
*------------------------------------------------------------**
- @filename jiny/trace.go
- @author jinycoo
- @version 1.0.0
- @date 2019-09-19 10:09
- @desc jiny - trace **------------------------------------------------------------*
Index ¶
- Constants
- func AccessToken(acc *AccInfo, redura *ctime.Duration) (string, error)
- func AuthJwtGroup(relativePath string) *server.RouterGroup
- func CSRF() server.HandlerFn
- func Group(relativePath string, handlers ...server.HandlerFn) *server.RouterGroup
- func Index(handler server.HandlerFn)
- func Init(cfg *Config)
- func JwtAuth() server.HandlerFn
- func Ping(handler server.HandlerFn)
- func PromMonitor()
- func Routes() server.RoutesInfo
- func Run() (err error)
- func SignValid() server.HandlerFn
- func SignValid1(c *server.Context)
- type AccInfo
- type App
- type Claims
- type Client
- func (client *Client) Do(c context.Context, req *http.Request, res interface{}, v ...string) (err error)
- func (client *Client) Get(c context.Context, uri, ip string, params url.Values, res interface{}) (err error)
- func (client *Client) JSON(c context.Context, req *http.Request, res interface{}, v ...string) (err error)
- func (client *Client) NewRequest(method, uri, realIP string, params url.Values) (req *http.Request, err error)
- func (client *Client) PB(c context.Context, req *http.Request, res proto.Message, v ...string) (err error)
- func (client *Client) Post(c context.Context, uri, ip string, params url.Values, res interface{}) (err error)
- func (client *Client) RESTfulGet(c context.Context, uri, ip string, params url.Values, res interface{}, ...) (err error)
- func (client *Client) RESTfulPost(c context.Context, uri, ip string, params url.Values, res interface{}, ...) (err error)
- func (client *Client) Raw(c context.Context, req *http.Request, v ...string) (bs []byte, err error)
- func (client *Client) SetConfig(c *ClientConfig)
- func (client *Client) SetTransport(t http.RoundTripper)
- type ClientConfig
- type Config
- type JWT
- type Sign
- type TraceTransport
Constants ¶
const ( Authorization = "Authorization" UCKey = "78abffcf33c17bf9f3aef9be2a17284e6d2a1909" UCID = "97d1474d94350970168b6ccb02bda90a585b69d0" SigningKey = "aa9f16c7e942d86bd0738cb7cf61924a" )
Variables ¶
This section is empty.
Functions ¶
func AuthJwtGroup ¶
func AuthJwtGroup(relativePath string) *server.RouterGroup
func Group ¶
func Group(relativePath string, handlers ...server.HandlerFn) *server.RouterGroup
Group creates a new router group. You should add all the routes that have common middlewares or the same path prefix. For example, all the routes that use a common middleware for authorization could be grouped.
func PromMonitor ¶
func PromMonitor()
Types ¶
type Claims ¶
type Claims struct { ID int64 `json:"id"` MID int64 `json:"mid"` Username string `json:"username"` jwt.StandardClaims }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is http client.
func (*Client) Do ¶
func (client *Client) Do(c context.Context, req *http.Request, res interface{}, v ...string) (err error)
Do sends an HTTP request and returns an HTTP json response.
func (*Client) Get ¶
func (client *Client) Get(c context.Context, uri, ip string, params url.Values, res interface{}) (err error)
Get issues a GET to the specified URL.
func (*Client) JSON ¶
func (client *Client) JSON(c context.Context, req *http.Request, res interface{}, v ...string) (err error)
JSON sends an HTTP request and returns an HTTP json response.
func (*Client) NewRequest ¶
func (client *Client) NewRequest(method, uri, realIP string, params url.Values) (req *http.Request, err error)
NewRequest new http request with method, uri, ip, values and headers.
func (*Client) PB ¶
func (client *Client) PB(c context.Context, req *http.Request, res proto.Message, v ...string) (err error)
PB sends an HTTP request and returns an HTTP proto response.
func (*Client) Post ¶
func (client *Client) Post(c context.Context, uri, ip string, params url.Values, res interface{}) (err error)
Post issues a Post to the specified URL.
func (*Client) RESTfulGet ¶
func (client *Client) RESTfulGet(c context.Context, uri, ip string, params url.Values, res interface{}, v ...interface{}) (err error)
RESTfulGet issues a RESTful GET to the specified URL.
func (*Client) RESTfulPost ¶
func (client *Client) RESTfulPost(c context.Context, uri, ip string, params url.Values, res interface{}, v ...interface{}) (err error)
RESTfulPost issues a RESTful Post to the specified URL.
func (*Client) SetConfig ¶
func (client *Client) SetConfig(c *ClientConfig)
SetConfig set client config.
func (*Client) SetTransport ¶
func (client *Client) SetTransport(t http.RoundTripper)
SetTransport set client transport
type ClientConfig ¶
type ClientConfig struct { *App Dial ctime.Duration Timeout ctime.Duration KeepAlive ctime.Duration Breaker *breaker.Config URL map[string]*ClientConfig Host map[string]*ClientConfig }
ClientConfig is http client conf.
type TraceTransport ¶
type TraceTransport struct { // The actual RoundTripper to use for the request. A nil // RoundTripper defaults to http.DefaultTransport. http.RoundTripper // contains filtered or unexported fields }
TraceTransport wraps a RoundTripper. If a request is being traced with Tracer, Transport will inject the current span into the headers, and set HTTP related tags on the span.
func NewTraceTracesport ¶
func NewTraceTracesport(rt http.RoundTripper, peerService string, internalTags ...trace.Tag) *TraceTransport
NewTraceTracesport NewTraceTracesport
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
*------------------------------------------------------------** * @filename debug/pprof.go * @author jinycoo * @version 1.0.0 * @date 2019-07-25 13:10 * @desc debug - pprof 性能优化 **------------------------------------------------------------*
|
*------------------------------------------------------------** * @filename debug/pprof.go * @author jinycoo * @version 1.0.0 * @date 2019-07-25 13:10 * @desc debug - pprof 性能优化 **------------------------------------------------------------* |
*------------------------------------------------------------** * @filename jiny/context.go * @author jinycoo * @version 1.0.0 * @date 2019-07-25 09:56 * @desc jiny - context **------------------------------------------------------------* *------------------------------------------------------------** * @filename jiny/params.go * @author jinycoo * @version 1.0.0 * @date 2019-08-01 13:58 * @desc jiny - params **------------------------------------------------------------* *------------------------------------------------------------** * @filename jiny/jiny.go * @author jinycoo * @version 1.0.0 * @date 2019-07-23 10:47 * @desc jiny - entry framework **------------------------------------------------------------*
|
*------------------------------------------------------------** * @filename jiny/context.go * @author jinycoo * @version 1.0.0 * @date 2019-07-25 09:56 * @desc jiny - context **------------------------------------------------------------* *------------------------------------------------------------** * @filename jiny/params.go * @author jinycoo * @version 1.0.0 * @date 2019-08-01 13:58 * @desc jiny - params **------------------------------------------------------------* *------------------------------------------------------------** * @filename jiny/jiny.go * @author jinycoo * @version 1.0.0 * @date 2019-07-23 10:47 * @desc jiny - entry framework **------------------------------------------------------------* |