Documentation ¶
Index ¶
- Constants
- Variables
- func BlackList(playerid int64) (bool, error)
- func CreateHTTPServer()
- func GenSign(vals ...string) string
- func GetLocalServer() string
- func GetServerID() string
- func GetVersion() int
- func HandlePbReplyTs(paths map[string]PbReplyTs, check bool)
- func Listen(server *api.Conf, svc api.Service)
- func Makesign(r *http.Request, path string) string
- func PostPb(path string, handle PbReply, check bool)
- func Register(paths map[string]PbReply, check bool)
- func RegisterContent(paths map[string]ByteReply)
- func RegisterGetHandle(subPath string, handle Handle)
- func RegisterGetHandleNoUserID(subPath string, handle Handle)
- func RegisterJSON(paths map[string]JsonReply)
- func RegisterPostHandle(subPath string, handle Handle)
- func RegisterPostHandleNoUserID(subPath string, handle Handle)
- func RegisterString(paths map[string]StrReply)
- func Run(cfg *api.Conf, service api.Service)
- func Start(addr string)
- type ByteReply
- type Config
- type Context
- type Handle
- type HttpReply
- type JsonReply
- type PbReply
- type PbReplyTs
- type Request
- func (r *Request) AllStringParam() string
- func (r *Request) Body() []byte
- func (r *Request) GetCookie() *api.Cookie
- func (r *Request) GetHTTPRequest() *http.Request
- func (r *Request) GetRemoteAddr() string
- func (r *Request) GetRequest() *http.Request
- func (r *Request) GetVals() url.Values
- func (r *Request) GetXForwardedFor() string
- func (r *Request) Int32Param(key string) (int32, bool)
- func (r *Request) Int64Param(key string) (int64, bool)
- func (r *Request) IntParam(key string) (int, bool)
- func (r *Request) SendCode(data []byte)
- func (r *Request) SendNotFind()
- func (r *Request) SendSUCCESS()
- func (r *Request) SetCookie(cookie *api.Cookie)
- func (r *Request) StringParam(key string) (string, bool)
- func (r *Request) Token() *api.Token
- func (r *Request) VerifyToken() bool
- type StrReply
Constants ¶
View Source
const (
// SignKey 签名Key
SignKey = "EE7a1c5bc548e542GBFc340c531657F4"
)
Variables ¶
View Source
var ( Conf = Config{ Port: 15001, Test: true, } Flags = []cli.Flag{ &cli.IntFlag{ Name: "HTTP_PORT", Value: 5001, Usage: "-HTTP_PORT 7001", EnvVars: []string{"HTTP_PORT"}, Destination: &Conf.Port, }, &cli.BoolFlag{ Name: "HTTP_TEST", Value: true, Usage: "-HTTP_TEST true", EnvVars: []string{"HTTP_TEST"}, Destination: &Conf.Test, }, } )
View Source
var (
Ctx context.Context
)
Functions ¶
func CreateHTTPServer ¶
func CreateHTTPServer()
func GetLocalServer ¶
func GetLocalServer() string
func GetServerID ¶
func GetServerID() string
func HandlePbReplyTs ¶ added in v0.0.6
func RegisterGetHandle ¶
RegisterGetHandle 注册http get handle
func RegisterGetHandleNoUserID ¶
RegisterGetHandleNoUserID 注册http post handle
func RegisterPostHandle ¶
RegisterPostHandle 注册http post handle
func RegisterPostHandleNoUserID ¶
RegisterPostHandleNoUserID 注册http post handle
Types ¶
type Context ¶
type Context struct { Rds redis.Conn Db *xorm.Engine MqChannel *mqwrap.MqChannel UserID string Query url.Values Params httprouter.Params Body []byte W http.ResponseWriter Ctx context.Context // contains filtered or unexported fields }
func (*Context) GetHTTPRequest ¶
GetHTTPRequest 获取请求信息
type Request ¶
type Request struct { Path string Method string Log *mlog.Logger // contains filtered or unexported fields }
Request 请求结构
func NewRequest ¶
func NewRequest(w http.ResponseWriter, r *http.Request) *Request
NewRequest 创建请求对象
func (*Request) GetHTTPRequest ¶
GetHTTPRequest 获取http请求结构体
func (*Request) GetXForwardedFor ¶
GetXForwardedFor 获得远端地址
func (*Request) Int32Param ¶
Int32Param 获得int32参数
func (*Request) Int64Param ¶
Int64Param 获得int64参数
func (*Request) StringParam ¶
StringParam 获得字符串参数
Click to show internal directories.
Click to hide internal directories.