Versions in this module Expand all Collapse all v0 v0.6.2 Jan 4, 2021 Changes in this version + type CORSConfig struct + AllowAllOrigins bool + AllowCredentials bool + AllowHeaders []string + AllowMethods []string + AllowOriginFunc func(origin string) bool + AllowOrigins []string + ExposeHeaders []string + MaxAge time.Duration + func (c *CORSConfig) Validate() error + type Client struct + func NewClient(c *ClientConfig) *Client + func (client *Client) Do(c context.Context, req *xhttp.Request, res interface{}, v ...string) (err error) + func (client *Client) DoReturnResp(c context.Context, req *xhttp.Request, res interface{}, v ...string) (resp *xhttp.Response, err error) + func (client *Client) Get(c context.Context, uri, ip string, params url.Values, res interface{}) (err error) + func (client *Client) GetReturnResp(c context.Context, uri, ip string, params url.Values, res interface{}) (resp *xhttp.Response, err error) + func (client *Client) JSON(c context.Context, req *xhttp.Request, res interface{}, v ...string) (err error) + func (client *Client) NewRequest(method, uri, realIP string, params url.Values) (req *xhttp.Request, err error) + func (client *Client) PB(c context.Context, req *xhttp.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 *xhttp.Request, v ...string) (bs []byte, err error) + func (client *Client) RawReturnResp(c context.Context, req *xhttp.Request, v ...string) (resp *xhttp.Response, bs []byte, err error) + func (client *Client) SetConfig(c *ClientConfig) + func (client *Client) SetTransport(t xhttp.RoundTripper) + type ClientConfig struct + Breaker *breaker.Config + Dial xtime.Duration + Host map[string]*ClientConfig + KeepAlive xtime.Duration + Timeout xtime.Duration + URL map[string]*ClientConfig + type Context struct + Error error + Keys map[string]interface{} + Params Params + Request *http.Request + RoutePath string + Writer http.ResponseWriter + func (c *Context) Abort() + func (c *Context) AbortWithStatus(code int) + func (c *Context) Bind(obj interface{}) error + func (c *Context) BindWith(obj interface{}, b binding.Binding) error + func (c *Context) Bytes(code int, contentType string, data ...[]byte) + func (c *Context) Get(key string) (value interface{}, exists bool) + func (c *Context) GetBool(key string) (b bool) + func (c *Context) GetFloat64(key string) (f64 float64) + func (c *Context) GetInt(key string) (i int) + func (c *Context) GetInt64(key string) (i64 int64) + func (c *Context) GetString(key string) (s string) + func (c *Context) GetUint(key string) (ui uint) + func (c *Context) GetUint64(key string) (ui64 uint64) + func (c *Context) IsAborted() bool + func (c *Context) JSON(data interface{}, err error) + func (c *Context) JSONMap(data map[string]interface{}, err error) + func (c *Context) Next() + func (c *Context) Protobuf(data proto.Message, err error) + func (c *Context) Redirect(code int, location string) + func (c *Context) RemoteIP() (remoteIP string) + func (c *Context) Render(code int, r render.Render) + func (c *Context) Set(key string, value interface{}) + func (c *Context) Status(code int) + func (c *Context) String(code int, format string, values ...interface{}) + func (c *Context) XML(data interface{}, err error) + type Engine struct + HandleMethodNotAllowed bool + UnescapePathValues bool + UseRawPath bool + func DefaultServer(conf *ServerConfig) *Engine + func NewServer(conf *ServerConfig) *Engine + func (engine *Engine) Inject(pattern string, handlers ...HandlerFunc) + func (engine *Engine) NoMethod(handlers ...HandlerFunc) + func (engine *Engine) NoRoute(handlers ...HandlerFunc) + func (engine *Engine) Ping(handler HandlerFunc) + func (engine *Engine) Register(handler HandlerFunc) + func (engine *Engine) Router() http.Handler + func (engine *Engine) Run(addr ...string) (err error) + func (engine *Engine) RunServer(server *http.Server, l net.Listener) (err error) + func (engine *Engine) RunTLS(addr, certFile, keyFile string) (err error) + func (engine *Engine) RunUnix(file string) (err error) + func (engine *Engine) ServeHTTP(w http.ResponseWriter, req *http.Request) + func (engine *Engine) Server() *http.Server + func (engine *Engine) SetConfig(conf *ServerConfig) (err error) + func (engine *Engine) SetMethodConfig(path string, mc *MethodConfig) + func (engine *Engine) Shutdown(ctx context.Context) error + func (engine *Engine) Start() error + func (engine *Engine) Use(middleware ...Handler) IRoutes + func (engine *Engine) UseFunc(middleware ...HandlerFunc) IRoutes + type Handler interface + ServeHTTP func(c *Context) + type HandlerFunc func(*Context) + func CORS(allowOriginHosts []string) HandlerFunc + func CSRF(allowHosts []string, allowPattern []string) HandlerFunc + func Criticality(pathCriticality criticalityPkg.Criticality) HandlerFunc + func Logger() HandlerFunc + func Recovery() HandlerFunc + func Trace() HandlerFunc + func (f HandlerFunc) ServeHTTP(c *Context) + type IRouter interface + Group func(string, ...HandlerFunc) *RouterGroup + type IRoutes interface + DELETE func(string, ...HandlerFunc) IRoutes + GET func(string, ...HandlerFunc) IRoutes + HEAD func(string, ...HandlerFunc) IRoutes + Handle func(string, string, ...HandlerFunc) IRoutes + POST func(string, ...HandlerFunc) IRoutes + PUT func(string, ...HandlerFunc) IRoutes + Use func(...Handler) IRoutes + UseFunc func(...HandlerFunc) IRoutes + type MethodConfig struct + Timeout xtime.Duration + type Param struct + Key string + Value string + type Params []Param + func (ps Params) ByName(name string) (va string) + func (ps Params) Get(name string) (string, bool) + type RateLimiter struct + func NewRateLimiter(conf *bbr.Config) (s *RateLimiter) + func (b *RateLimiter) Limit() HandlerFunc + type RouterGroup struct + Handlers []HandlerFunc + func (group *RouterGroup) Any(relativePath string, handlers ...HandlerFunc) IRoutes + func (group *RouterGroup) BasePath() string + func (group *RouterGroup) DELETE(relativePath string, handlers ...HandlerFunc) IRoutes + func (group *RouterGroup) GET(relativePath string, handlers ...HandlerFunc) IRoutes + func (group *RouterGroup) Group(relativePath string, handlers ...HandlerFunc) *RouterGroup + func (group *RouterGroup) HEAD(relativePath string, handlers ...HandlerFunc) IRoutes + func (group *RouterGroup) Handle(httpMethod, relativePath string, handlers ...HandlerFunc) IRoutes + func (group *RouterGroup) OPTIONS(relativePath string, handlers ...HandlerFunc) IRoutes + func (group *RouterGroup) PATCH(relativePath string, handlers ...HandlerFunc) IRoutes + func (group *RouterGroup) POST(relativePath string, handlers ...HandlerFunc) IRoutes + func (group *RouterGroup) PUT(relativePath string, handlers ...HandlerFunc) IRoutes + func (group *RouterGroup) SetMethodConfig(config *MethodConfig) *RouterGroup + func (group *RouterGroup) Use(middleware ...Handler) IRoutes + func (group *RouterGroup) UseFunc(middleware ...HandlerFunc) IRoutes + type ServerConfig struct + Addr string + Network string + ReadTimeout xtime.Duration + Timeout xtime.Duration + WriteTimeout xtime.Duration + type TraceTransport struct + func NewTraceTransport(rt http.RoundTripper, peerService string, internalTags ...trace.Tag) *TraceTransport + func (t *TraceTransport) RoundTrip(req *http.Request) (*http.Response, error)