Documentation ¶
Index ¶
- Constants
- func ConvertLocalAddr(addr string) string
- func GenToken(playerID int64) string
- func HTTPPost(url string, contentType string, body io.Reader) ([]byte, error)
- func HTTPPostToken(url string, playerID int64, contentType string, body io.Reader) ([]byte, error)
- func NewUUID() uuid.UUID
- type Conf
- type Cookie
- type DBServerInfo
- type MQServerInfo
- type RedisServerInfo
- type ServerType
- type Service
- type StConfig
- type Token
Constants ¶
View Source
const (
// UpdateTokenTime 更新token时间
UpdateTokenTime = (60 * 60 * 24 / 2)
)
Variables ¶
This section is empty.
Functions ¶
func ConvertLocalAddr ¶
ConvertLocalAddr 转换成本地IP 格式 IP:PORT
func HTTPPostToken ¶
HTTPPostToken 发送httpPost请求(不认证服务端证书)
Types ¶
type Conf ¶
type Conf struct { Addr string //服务器监听地址 Name string //服务器名称 Type ServerType //服务器类型 ConnRedis bool //连接redis //默认不连接 RedisServer RedisServerInfo //redis服务器信息 ConnMQ bool //连接MQ // 默认不连接 MQServer MQServerInfo //MQ服务器信息 ConnDB bool //连接数据库 //默认不连接 DBServer DBServerInfo //数据库信息 OrderTestMode bool //支付测试模式开关 打开情况下只支付最小额度 ConsulAddr string //服务注册地址 CertFile string Keyfile string Version string StdConf StConfig }
Conf 服务器配置信息
type DBServerInfo ¶
DBServerInfo 数据库信息
type MQServerInfo ¶
MQServerInfo Mq服务器信息
type RedisServerInfo ¶
RedisServerInfo Redis服务器信息
type ServerType ¶
type ServerType string
ServerType 服务器类型
var ( //AuthServer 认证服 AuthServer ServerType = "auth" //RechargeServer 支付服务器 RechargeServer ServerType = "recharge_xzy" //PushServer 推送服务器 PushServer ServerType = "push" )
type Service ¶
type Service interface { // Init is called before the program/service is started // This method must be non-blocking. Init(s *Conf) error // Start is called after Init. This method must be non-blocking. Start() error // Stop is called in response to syscall.SIGINT, syscall.SIGTERM, or when a // Service is stopped. Stop() error }
Service interface contains Start and Stop methods which are called when the service is started and stopped. The Init method is called before the service is started.
The Start and Init methods must be non-blocking.
Implement this interface and pass it to the Run function to start your program.
type StConfig ¶
type StConfig struct { Name string `json:"Name"` Listen string `json:"Listen"` RPCPort string `json:"RPCPort"` CertFile string `json:"CertFile"` KeyFile string `json:"KeyFile"` RedisServer RedisServerInfo `json:"RedisServer"` MQServer MQServerInfo `json:"MQServer"` DBServer DBServerInfo `json:"DBServer"` ConsulAddr string `json:"ConsulAddr"` AuthAddr string `json:"AuthAddr"` RechargeAddr string `json:"RechargeAddr"` Language string `json:"Language"` }
StConfig 配置文件
Click to show internal directories.
Click to hide internal directories.