Documentation ¶
Index ¶
- Variables
- func AddRote(path string, r Route)
- func BindRote(path string, methods []string, handle func(*routing.Context) error)
- func GetRoute() *routing.Router
- func GetServer() *fasthttp.Server
- func GetUID() string
- func NewUniqueIDAsync()
- func NewUniqueIDBlocked()
- func RegisterGroup(router *routing.Router, group IResourceGrouper)
- func RegsitRouter(router *routing.Router, regRouter IRegistRouter)
- func Run(n net.Listener)
- type BaseGroup
- type BaseResponse
- type BaseServer
- func (bs *BaseServer) Cors(ctx *routing.Context) (err error)
- func (bs *BaseServer) FormInt64(ctx *routing.Context, key string) int64
- func (bs *BaseServer) FormString(ctx *routing.Context, key string) string
- func (bs *BaseServer) GetRouterMap() map[string]Route
- func (bs *BaseServer) GetStatus(ctx *routing.Context) (err error)
- func (bs *BaseServer) HandleRoot(ctx *routing.Context) (err error)
- func (bs *BaseServer) ServerJSON(ctx *routing.Context, v interface{}, status int)
- type Decorator
- type IRegistRouter
- type IResourceGrouper
- type Resource
- type Route
Constants ¶
This section is empty.
Variables ¶
View Source
var ( CorsAllowOrigin = []string{"gaodun.com", "gaodunwangxiao.com"} CorsAllowMethods = "HEAD,GET,POST,PUT,DELETE" CorsAllowCredentials = "true" CorsAllowHead = "Origin, X-Requested-With, Content-Type, Accept, Authtoken, Authentication, X_Requested_With, X-Request-ID" ExposeHeaders = "AccessToken, RefreshToken" )
View Source
var ( // ServiceName 服务名称 ServiceName = "XService" // ServiceVersion 版本 ServiceVersion = "1.0.0.1" // Concurrency Concurrency Concurrency = 100000 // DisableKeepalive DisableKeepalive DisableKeepalive = true //Timeout Timeout Timeout = 60 * time.Second // MaxConnsPerIP MaxConnsPerIP MaxConnsPerIP = 100000 // MaxRequestsPerConn MaxRequestsPerConn MaxRequestsPerConn = 100000 // MaxKeepaliveDuration MaxKeepaliveDuration MaxKeepaliveDuration = 120 * time.Second // MaxRequestBodySize MaxRequestBodySize MaxRequestBodySize = 512 * 1024 * 1024 // ReadBufferSize ReadBufferSize ReadBufferSize = 16 * 1024 // WriteBufferSize WriteBufferSize WriteBufferSize = 16 * 1024 )
View Source
var (
OPTIONS = []byte("OPTIONS")
)
View Source
var XLogger fasthttp.Logger
Logger 日志插件
Functions ¶
func RegisterGroup ¶
func RegisterGroup(router *routing.Router, group IResourceGrouper)
调用此接口将一组API注册到总路由器
func RegsitRouter ¶
func RegsitRouter(router *routing.Router, regRouter IRegistRouter)
Types ¶
type BaseGroup ¶
type BaseGroup struct{}
示例Group
func (BaseGroup) GetResourceMap ¶
实现IResourceGrouper接口
type BaseResponse ¶
type BaseResponse struct { HTTPCode int `json:"http_code,omitempty"` Status int `json:"status"` Info string `json:"info"` Result interface{} `json:"result"` }
BaseResponse 返回参数
type BaseServer ¶
BaseServer 服务基类
func (*BaseServer) FormInt64 ¶
func (bs *BaseServer) FormInt64(ctx *routing.Context, key string) int64
FormInt64 获取int
func (*BaseServer) FormString ¶
func (bs *BaseServer) FormString(ctx *routing.Context, key string) string
FormString 获取字符串
func (*BaseServer) GetRouterMap ¶
func (bs *BaseServer) GetRouterMap() map[string]Route
GetRouterMap 路由表
func (*BaseServer) GetStatus ¶
func (bs *BaseServer) GetStatus(ctx *routing.Context) (err error)
GetStatus 状态页
func (*BaseServer) HandleRoot ¶
func (bs *BaseServer) HandleRoot(ctx *routing.Context) (err error)
HandleRoot 测试页
func (*BaseServer) ServerJSON ¶
func (bs *BaseServer) ServerJSON(ctx *routing.Context, v interface{}, status int)
ServerJSON 服务器返回
type Decorator ¶
Decorator 控制拦截
var Dct Decorator
func (Decorator) GetVerifyList ¶
func (Decorator) SetCorsHeader ¶
func (Decorator) SetVerifyList ¶
type IRegistRouter ¶
IRegistRouter 注册路由接口
type IResourceGrouper ¶
实现此接口的类可以被注册路由 返回 path -> resource 注册表
Source Files ¶
Click to show internal directories.
Click to hide internal directories.