httpsvr

package
v0.1.1-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2023 License: BSD-2-Clause Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SignKey 签名Key
	SignKey = "EE7a1c5bc548e542GBFc340c531657F4"
)

Variables

This section is empty.

Functions

func BlackList

func BlackList(playerid int64) (bool, error)

BlackList 黑名单策略

func GenSign

func GenSign(vals ...string) string

GenSign 生成签名

func GetLocalServer

func GetLocalServer() string

GetLocalServer 获取本地服务器地址

func GetServerID

func GetServerID() string

GetServerID 获得服务器ID

func Listen

func Listen(server *api.Conf, svc api.Service)

Listen 监听HTTP

func Makesign

func Makesign(r *http.Request, path string) string

Makesign 设置请求签名

func Register

func Register(paths map[string]HTTPRecv, check bool)

Register 注册协议

func RegisterContent

func RegisterContent(paths map[string]ContentRecv)

RegisterContent 注册函数

func RegisterHTTPRecvJSON

func RegisterHTTPRecvJSON(paths map[string]HTTPRecv, check bool)

RegisterHTTPRecvJSON 注册协议

func RegisterJSON

func RegisterJSON(paths map[string]JSONRecv)

RegisterJSON 注册函数

func RegisterString

func RegisterString(paths map[string]StringRecv)

RegisterString 注册函数

func Run

func Run(cfg *api.Conf, service api.Service)

Run 启动服务

func Start

func Start(addr string)

Types

type ContentRecv

type ContentRecv func(r *Request) []byte

ContentRecv 接收数据

type HTTPRecv

type HTTPRecv func(r *Request) (gerrors.Error, proto.Message)

HTTPRecv http数据接收

type JSONRecv

type JSONRecv func(r *Request) (int, interface{})

JSONRecv 接收数据

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) AllStringParam

func (r *Request) AllStringParam() string

AllStringParam 获得所有参数字符串

func (*Request) Body

func (r *Request) Body() []byte

Body request body

func (*Request) GetCookie

func (r *Request) GetCookie() *api.Cookie

GetCookie get cookie header

func (*Request) GetHTTPRequest

func (r *Request) GetHTTPRequest() *http.Request

GetHTTPRequest 获取http请求结构体

func (*Request) GetRemoteAddr

func (r *Request) GetRemoteAddr() string

GetRemoteAddr 获得远端地址

func (*Request) GetRequest

func (r *Request) GetRequest() *http.Request

GetRequest 获得http请求

func (*Request) GetVals

func (r *Request) GetVals() url.Values

GetVals 获取http请求结构体

func (*Request) GetXForwardedFor

func (r *Request) GetXForwardedFor() string

GetXForwardedFor 获得远端地址

func (*Request) Int32Param

func (r *Request) Int32Param(key string) (int32, bool)

Int32Param 获得int32参数

func (*Request) Int64Param

func (r *Request) Int64Param(key string) (int64, bool)

Int64Param 获得int64参数

func (*Request) IntParam

func (r *Request) IntParam(key string) (int, bool)

IntParam 获得int参数

func (*Request) SendCode

func (r *Request) SendCode(data []byte)

SendCode qq回调返回

func (*Request) SendNotFind

func (r *Request) SendNotFind()

SendNotFind 发送没有找到

func (*Request) SendSUCCESS

func (r *Request) SendSUCCESS()

SendSUCCESS 发送没有找到

func (*Request) SetCookie

func (r *Request) SetCookie(cookie *api.Cookie)

SetCookie set cookie header

func (*Request) StringParam

func (r *Request) StringParam(key string) (string, bool)

StringParam 获得字符串参数

func (*Request) Token

func (r *Request) Token() *api.Token

Token 获得请求token

func (*Request) VerifyToken

func (r *Request) VerifyToken() bool

VerifyToken 验证token

type StringRecv

type StringRecv func(r *Request) string

StringRecv 接收数据

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL