Documentation ¶
Index ¶
- Constants
- Variables
- func CreateUser() interface{}
- func JwtAuth(rsa bool, creator JwtClaimCreator, userCreator UserCreator) ...
- func JwtSign(rsa bool, creator JwtClaimCreator) ...
- func LogUserInfo(user *User) log.ZapFields
- func NewAvatarManagerCtor(option lokas.IGameHandler) avatarManagerCtor
- func NewModuleFromRegistry(s string) (lokas.IModule, error)
- func NewWebSocket(url string, client *WsClient, p protocol.TYPE) (*wsImpl, error)
- func ReadDataFromEtcd(addr string, path string) (*bytes.Buffer, error)
- func RegisterModule(creator Creator)
- func RegisterModulesFromPlugin(path string) error
- func SignToken(creator JwtClaimCreator, user interface{}, a lokas.IProcess, ...) (string, error)
- func UserId(user *User) zap.Field
- func UserRefreshToken(user *User) zap.Field
- func UserToken(user *User) zap.Field
- type AccState
- type ActiveSession
- func (this *ActiveSession) AsyncCall(actorId util.ID, transId uint32, req protocol.ISerializable, ...) error
- func (this *ActiveSession) Call(actorId util.ID, transId uint32, req protocol.ISerializable, ...) error
- func (this *ActiveSession) CloneEntity() *ecs.Entity
- func (this *ActiveSession) GetConn() lokas.IConn
- func (this *ActiveSession) GetId() util.ID
- func (this *ActiveSession) GetProcess() lokas.IProcess
- func (this *ActiveSession) OnClose(conn lokas.IConn)
- func (this *ActiveSession) OnCreate() error
- func (this *ActiveSession) OnDestroy() error
- func (this *ActiveSession) OnMessage(actorId util.ID, transId uint32, msg protocol.ISerializable) error
- func (this *ActiveSession) OnOpen(conn lokas.IConn)
- func (this *ActiveSession) OnRecv(conn lokas.IConn, data []byte)
- func (this *ActiveSession) PongHandler(pong *protocol.Pong)
- func (this *ActiveSession) SendMessage(actorId util.ID, transId uint32, msg protocol.ISerializable) error
- func (this *ActiveSession) SetId(id util.ID)
- func (this *ActiveSession) SetProcess(process lokas.IProcess)
- func (this *ActiveSession) Start() error
- func (this *ActiveSession) Stop() error
- func (this *ActiveSession) Type() string
- func (this *ActiveSession) Update(dt time.Duration, now time.Time)
- func (this *ActiveSession) Write(data []byte) error
- type ActiveSessionOption
- type Actor
- func (this *Actor) Call(actorId util.ID, req protocol.ISerializable) (protocol.ISerializable, error)
- func (this *Actor) GetLeaseId() (clientv3.LeaseID, bool, error)
- func (this *Actor) GetProcess() lokas.IProcess
- func (this *Actor) HandleMsg(actorId util.ID, transId uint32, msg protocol.ISerializable) error
- func (this *Actor) HookReceive(msg *protocol.RouteMessage) *protocol.RouteMessage
- func (this *Actor) Load(conf lokas.IConfig) error
- func (this *Actor) OnMessage(msg *protocol.RouteMessage)
- func (this *Actor) OnStart() error
- func (this *Actor) OnStop() error
- func (this *Actor) PId() util.ProcessId
- func (this *Actor) ReceiveMessage(msg *protocol.RouteMessage)
- func (this *Actor) Send(id util.ProcessId, msg *protocol.RouteMessage) error
- func (this *Actor) SendMessage(actorId util.ID, transId uint32, msg protocol.ISerializable) error
- func (this *Actor) SendReply(actorId util.ID, transId uint32, msg protocol.ISerializable) error
- func (this *Actor) SetProcess(process lokas.IProcess)
- func (this *Actor) SetType(s string)
- func (this *Actor) Start() error
- func (this *Actor) StartMessagePump()
- func (this *Actor) Stop() error
- func (this *Actor) Type() string
- func (this *Actor) Unload() error
- func (this *Actor) Update(dt time.Duration, now time.Time)
- type ActorContainer
- func (this *ActorContainer) AddActor(actor lokas.IActor)
- func (this *ActorContainer) GetActor(id util.ID) lokas.IActor
- func (this *ActorContainer) GetActorIds() []util.ID
- func (this *ActorContainer) GetProcess() lokas.IProcess
- func (this *ActorContainer) Load(conf lokas.IConfig) error
- func (this *ActorContainer) OnStart() error
- func (this *ActorContainer) OnStop() error
- func (this *ActorContainer) RemoveActor(actor lokas.IActor)
- func (this *ActorContainer) RemoveActorById(id util.ID) lokas.IActor
- func (this *ActorContainer) SetProcess(process lokas.IProcess)
- func (this *ActorContainer) Start() error
- func (this *ActorContainer) StartActor(actor lokas.IActor) error
- func (this *ActorContainer) Stop() error
- func (this *ActorContainer) StopActor(actor lokas.IActor)
- func (this *ActorContainer) Type() string
- func (this *ActorContainer) Unload() error
- type ActorRegistry
- type ActorRegistryInfo
- type AdminCommand
- type AdminCommandResult
- type AdminHandShake
- type AppConfig
- func (this *AppConfig) AllSettings() map[string]interface{}
- func (this *AppConfig) Get(key string) interface{}
- func (this *AppConfig) GetBool(key string) bool
- func (this *AppConfig) GetDuration(key string) time.Duration
- func (this *AppConfig) GetFloat64(key string) float64
- func (this *AppConfig) GetFolder() string
- func (this *AppConfig) GetInt(key string) int
- func (this *AppConfig) GetInt32Slice(key string) []int32
- func (this *AppConfig) GetIntSlice(key string) []int
- func (this *AppConfig) GetSizeInBytes(key string) uint
- func (this *AppConfig) GetString(key string) string
- func (this *AppConfig) GetStringMap(key string) map[string]interface{}
- func (this *AppConfig) GetStringMapString(key string) map[string]string
- func (this *AppConfig) GetStringMapStringSlice(key string) map[string][]string
- func (this *AppConfig) GetStringSlice(key string) []string
- func (this *AppConfig) GetTime(key string) time.Time
- func (this *AppConfig) IsSet(key string) bool
- func (this *AppConfig) Load() error
- func (this *AppConfig) LoadFromRemote() error
- func (this *AppConfig) Save() error
- func (this *AppConfig) Set(key string, value interface{})
- func (this *AppConfig) SetFolder(f string)
- func (this *AppConfig) SetRemoteConfig(p string, etcd string)
- func (this *AppConfig) Sub(key string) lokas.IConfig
- type Avatar
- func (this *Avatar) Deserialize(a lokas.IProcess) error
- func (this *Avatar) Initialize(a lokas.IProcess) error
- func (this *Avatar) Load(conf lokas.IConfig) error
- func (this *Avatar) OnStart() error
- func (this *Avatar) OnStop() error
- func (this *Avatar) OnUpdate()
- func (this *Avatar) SendEvent(msg protocol.ISerializable) error
- func (this *Avatar) Serialize(a lokas.IProcess) error
- func (this *Avatar) Start() error
- func (this *Avatar) Stop() error
- func (this *Avatar) Unload() error
- type AvatarManager
- func (this *AvatarManager) CreateAvatar(id util.ID) error
- func (this *AvatarManager) GetAvatar(id util.ID) *Avatar
- func (this *AvatarManager) HandleMsg(actorId util.ID, transId uint32, msg protocol.ISerializable) (protocol.ISerializable, error)
- func (this *AvatarManager) Load(conf lokas.IConfig) error
- func (this *AvatarManager) OnStart() error
- func (this *AvatarManager) OnStop() error
- func (this *AvatarManager) OnUpdate()
- func (this *AvatarManager) RemoveAvatar(id util.ID)
- func (this *AvatarManager) Start() error
- func (this *AvatarManager) Stop() error
- func (this *AvatarManager) Unload() error
- type AvatarMap
- type AvatarSession
- func (this *AvatarSession) ChangeUserName(a lokas.IProcess, name string) error
- func (this *AvatarSession) Deserialize(a lokas.IProcess) error
- func (this *AvatarSession) FetchData(a lokas.IProcess) error
- func (this *AvatarSession) GetGameId() string
- func (this *AvatarSession) GetGateId() util.ID
- func (this *AvatarSession) GetId() util.ID
- func (this *AvatarSession) GetServerId() int32
- func (this *AvatarSession) GetUserId() util.ID
- func (this *AvatarSession) GetUserName() string
- func (this *AvatarSession) Initialize(a lokas.IProcess) error
- func (this *AvatarSession) Serialize(a lokas.IProcess) error
- func (this *AvatarSession) SetGateId(id util.ID)
- func (this *AvatarSession) SetOnGateWayChanged(f func(session *AvatarSession))
- func (this *AvatarSession) SetOnSessionClosed(f func())
- func (this *AvatarSession) StartAvatarSession()
- func (this *AvatarSession) StopAvatarSession()
- type Block
- type Cell
- type CellManager
- type Center
- func (this *Center) Load(conf lokas.IConfig) error
- func (this *Center) OnCreate() error
- func (this *Center) OnDestroy() error
- func (this *Center) OnRegister()
- func (this *Center) OnStart() error
- func (this *Center) OnStop() error
- func (this *Center) Start() error
- func (this *Center) Stop() error
- func (this *Center) Unload() error
- type ClaimUser
- type CommonRegistry
- func (this *CommonRegistry) AddActor(actor *ActorRegistry)
- func (this *CommonRegistry) AddProcess(process *ProcessRegistry)
- func (this *CommonRegistry) AddService(service *ServiceRegistry)
- func (this *CommonRegistry) GetActorIdsByTypeAndServerId(serverId int32, typ string) []util.ID
- func (this *CommonRegistry) GetActorRegistry(id util.ID) *ActorRegistry
- func (this *CommonRegistry) RemoveActor(actorId util.ID)
- func (this *CommonRegistry) RemoveProcess(id util.ProcessId)
- func (this *CommonRegistry) RemoveService(serviceType string, serviceId uint16)
- type ConfigOption
- type ConnType
- type ConsoleEvent
- type Context
- func (this *Context) Get(key string) interface{}
- func (this *Context) GetBool(key string) bool
- func (this *Context) GetFloat32(key string) float32
- func (this *Context) GetFloat64(key string) float64
- func (this *Context) GetIdType(key string) util.ID
- func (this *Context) GetInt(key string) int
- func (this *Context) GetInt32(key string) int32
- func (this *Context) GetInt64(key string) int64
- func (this *Context) GetProcessIdType(key string) util.ProcessId
- func (this *Context) GetString(key string) string
- func (this *Context) Set(key string, value interface{})
- type CreateAvatar
- type Creator
- type DefaultConfig
- func (this *DefaultConfig) GetAllSub() []lokas.IConfig
- func (this *DefaultConfig) GetDb(t string) interface{}
- func (this *DefaultConfig) GetDockerCLI() interface{}
- func (this *DefaultConfig) GetGameId() string
- func (this *DefaultConfig) GetIdType(key string) util.ID
- func (this *DefaultConfig) GetName() string
- func (this *DefaultConfig) GetProcessId() util.ProcessId
- func (this *DefaultConfig) GetProcessIdType(key string) util.ProcessId
- func (this *DefaultConfig) GetServerId() int32
- func (this *DefaultConfig) GetVersion() string
- func (this *DefaultConfig) Load() error
- func (this *DefaultConfig) LoadFromRemote() error
- func (this *DefaultConfig) LoadFromString(s string) error
- func (this *DefaultConfig) LoadInConfig() error
- func (this *DefaultConfig) MergeData(in io.Reader) error
- func (this *DefaultConfig) ServerName() string
- type DockerConfig
- type EtcdConfig
- type GameHandler
- func (this *GameHandler) GetDeserializer() func(avatar lokas.IActor, process lokas.IProcess) error
- func (this *GameHandler) GetInitializer() func(avatar lokas.IActor, process lokas.IProcess) error
- func (this *GameHandler) GetMsgDelegator() ...
- func (this *GameHandler) GetSerializer() func(avatar lokas.IActor, process lokas.IProcess) error
- func (this *GameHandler) GetUpdater() func(avatar lokas.IActor, process lokas.IProcess) error
- type Gate
- func (this *Gate) GetServer() lokas.Server
- func (this *Gate) Load(conf lokas.IConfig) error
- func (this *Gate) LoadCustom(host, port string, protocolType protocol.TYPE, connType ConnType) error
- func (this *Gate) OnCreate() error
- func (this *Gate) OnDestroy() error
- func (this *Gate) OnStart() error
- func (this *Gate) OnStop() error
- func (this *Gate) SessionCreator(conn lokas.IConn) lokas.ISession
- func (this *Gate) Start() error
- func (this *Gate) Stop() error
- func (this *Gate) Unload() error
- type Http
- func (this *Http) CreateHandlerFunc(f rox.Handler) func(http.ResponseWriter, *http.Request)
- func (this *Http) HandleFunc(path string, f rox.Handler) *rox.Route
- func (this *Http) Load(conf lokas.IConfig) error
- func (this *Http) MatchRouter(s string) *rox.Router
- func (this *Http) OnCreate() error
- func (this *Http) OnDestroy() error
- func (this *Http) OnStart() error
- func (this *Http) OnStop() error
- func (this *Http) Path(s string) *rox.Route
- func (this *Http) PathExcept(p string, m ...rox.MiddleWare) *Http
- func (this *Http) PathExcepts(p []string, m ...rox.MiddleWare) *Http
- func (this *Http) PathIn(p []string, m ...rox.MiddleWare) *Http
- func (this *Http) PathOnly(p string, m ...rox.MiddleWare) *Http
- func (this *Http) PathPrefix(s string) *rox.Route
- func (this *Http) PrefixExcept(prefix string, m ...rox.MiddleWare) *Http
- func (this *Http) PrefixExceptStrict(prefix string, m ...rox.MiddleWare) *Http
- func (this *Http) PrefixOnly(prefix string, m ...rox.MiddleWare) *Http
- func (this *Http) PrefixOnlyStrict(prefix string, m ...rox.MiddleWare) *Http
- func (this *Http) Start() error
- func (this *Http) Stop() error
- func (this *Http) Unload() error
- func (this *Http) Use(m ...rox.MiddleWare) *Http
- func (this *Http) When(matcher rox.MiddlewareMatcher, m ...rox.MiddleWare) *Http
- type JwtClaim
- type JwtClaimCreator
- type JwtClaimWithUser
- type KickAvatar
- type LoginHandShake
- type MongoConfig
- type MysqlConfig
- type OssConfig
- type PassiveSession
- func (this *PassiveSession) GetConn() lokas.IConn
- func (this *PassiveSession) Load(conf lokas.IConfig) error
- func (this *PassiveSession) OnClose(conn lokas.IConn)
- func (this *PassiveSession) OnCreate() error
- func (this *PassiveSession) OnDestroy() error
- func (this *PassiveSession) OnMessage(msg *protocol.RouteMessage)
- func (this *PassiveSession) OnOpen(conn lokas.IConn)
- func (this *PassiveSession) OnRecv(conn lokas.IConn, data []byte)
- func (this *PassiveSession) OnStart() error
- func (this *PassiveSession) OnStop() error
- func (this *PassiveSession) Start() error
- func (this *PassiveSession) StartMessagePump()
- func (this *PassiveSession) Stop() error
- func (this *PassiveSession) Unload() error
- type PassiveSessionOption
- type Process
- func (this *Process) Add(mod lokas.IModule) lokas.IModule
- func (this *Process) Config() lokas.IConfig
- func (this *Process) GameId() string
- func (this *Process) GameServerId() string
- func (this *Process) GenId() util.ID
- func (this *Process) Get(name string) lokas.IModule
- func (this *Process) GetDocker() (*dockerclient.TLSClient, error)
- func (this *Process) GetEtcd() *etcdclient.Client
- func (this *Process) GetId() util.ID
- func (this *Process) GetLogger() *log.ComposeLogger
- func (this *Process) GetMongo() *qmgo.Database
- func (this *Process) GetOss() *ossclient.Client
- func (this *Process) GetRedis() *redisclient.Client
- func (this *Process) GlobalMutex(key string, ttl int) (*etcdclient.Mutex, error)
- func (this *Process) Load(config lokas.IProcessConfig) error
- func (this *Process) LoadAllModule(conf lokas.IProcessConfig) error
- func (this *Process) LoadMod(name string, conf lokas.IConfig) error
- func (this *Process) LoadModuleRegistry() error
- func (this *Process) PId() util.ProcessId
- func (this *Process) RegisterModule(creator lokas.IModuleCtor)
- func (this *Process) SaveModuleRegistry() error
- func (this *Process) ServerId() int32
- func (this *Process) Start() error
- func (this *Process) StartAllModule() error
- func (this *Process) Stop() error
- func (this *Process) StopAllModule() error
- func (this *Process) Type() string
- func (this *Process) UnloadMod(name string) error
- func (this *Process) Version() string
- type ProcessActorsInfo
- type ProcessRegistry
- type ProcessRegistryInfo
- type ProcessServiceInfo
- type Proxy
- func (this *Proxy) GetProcess() lokas.IProcess
- func (this *Proxy) Load(conf lokas.IConfig) error
- func (this *Proxy) OnCreate() error
- func (this *Proxy) OnDestroy() error
- func (this *Proxy) OnStart() error
- func (this *Proxy) OnStop() error
- func (this *Proxy) Send(id util.ProcessId, msg *protocol.RouteMessage) error
- func (this *Proxy) SetPort(p string)
- func (this *Proxy) SetProcess(process lokas.IProcess)
- func (this *Proxy) Start() error
- func (this *Proxy) Stop() error
- func (this *Proxy) Type() string
- func (this *Proxy) Unload() error
- type ProxySession
- func (this *ProxySession) GetConn() lokas.IConn
- func (this *ProxySession) GetProcess() lokas.IProcess
- func (this *ProxySession) HandleMessage(f func(msg *protocol.BinaryMessage))
- func (this *ProxySession) OnClose(conn lokas.IConn)
- func (this *ProxySession) OnCreate() error
- func (this *ProxySession) OnDestroy() error
- func (this *ProxySession) OnOpen(conn lokas.IConn)
- func (this *ProxySession) OnRecv(conn lokas.IConn, data []byte)
- func (this *ProxySession) SendMessage(actorId util.ID, transId uint32, msg protocol.ISerializable) error
- func (this *ProxySession) SetProcess(process lokas.IProcess)
- func (this *ProxySession) Start() error
- func (this *ProxySession) Stop() error
- func (this *ProxySession) Type() string
- func (this *ProxySession) Update(dt time.Duration, now time.Time)
- func (this *ProxySession) Write(data []byte) error
- type ProxySessionManager
- func (this *ProxySessionManager) AddSession(id util.ID, session lokas.ISession)
- func (this *ProxySessionManager) Clear()
- func (this *ProxySessionManager) GetRoundSession() (lokas.ISession, bool)
- func (this *ProxySessionManager) GetSession(id util.ID) lokas.ISession
- func (this *ProxySessionManager) GetSessionCount() int
- func (this *ProxySessionManager) Range(f func(id util.ID, session lokas.ISession) bool)
- func (this *ProxySessionManager) RemoveSession(id util.ID)
- func (this *ProxySessionManager) ResetSession(id util.ID, session lokas.ISession)
- type RedisConfig
- type Registry
- func (this *Registry) GetActorIdsByTypeAndServerId(serverId int32, typ string) []util.ID
- func (this *Registry) GetLeaseId() (clientv3.LeaseID, bool, error)
- func (this *Registry) GetProcess() lokas.IProcess
- func (this *Registry) GetProcessIdByActor(actorId util.ID) (util.ProcessId, error)
- func (this *Registry) GetProcessInfo() string
- func (reg *Registry) GetServiceDiscoverMgr() lokas.IServiceDiscoverMgr
- func (reg *Registry) GetServiceRegisterMgr() lokas.IServiceRegisterMgr
- func (this *Registry) Load(conf lokas.IConfig) error
- func (this *Registry) OnCreate() error
- func (this *Registry) OnDestroy() error
- func (this *Registry) OnStart() error
- func (this *Registry) OnStop() error
- func (this *Registry) QueryRemoteActorsByServer(typ string, ServerId int32) []*Actor
- func (this *Registry) QueryRemoteActorsByType(typ string) []*Actor
- func (this *Registry) RegisterActorLocal(actor lokas.IActor) error
- func (this *Registry) RegisterActorRemote(actor lokas.IActor) error
- func (this *Registry) RegisterActors() error
- func (this *Registry) SetProcess(process lokas.IProcess)
- func (this *Registry) Start() error
- func (this *Registry) Stop() error
- func (this *Registry) Type() string
- func (this *Registry) Unload() error
- func (this *Registry) UnregisterActorLocal(actor lokas.IActor) error
- func (this *Registry) UnregisterActorRemote(actor lokas.IActor) error
- type Response
- type Router
- func (this *Router) GetProcess() lokas.IProcess
- func (this *Router) Load(conf lokas.IConfig) error
- func (this *Router) OnStart() error
- func (this *Router) OnStop() error
- func (this *Router) RouteMsg(msg *protocol.RouteMessage)
- func (router *Router) RouteMsgLocal(msg *protocol.RouteMessage) error
- func (this *Router) SetProcess(process lokas.IProcess)
- func (this *Router) Start() error
- func (this *Router) Stop() error
- func (this *Router) Type() string
- func (this *Router) Unload() error
- type ServiceDiscoverMgr
- type ServiceRegister
- type ServiceRegisterMgr
- func (mgr *ServiceRegisterMgr) FindServiceInfo(serviceType string, serviceId uint16) (*lokas.ServiceInfo, bool)
- func (mgr *ServiceRegisterMgr) FindServiceList(serviceType string) ([]*lokas.ServiceInfo, bool)
- func (mgr *ServiceRegisterMgr) Register(info *lokas.ServiceInfo) error
- func (mgr *ServiceRegisterMgr) Stop()
- func (mgr *ServiceRegisterMgr) Unregister(serviceType string, serviceId uint16) error
- func (mgr *ServiceRegisterMgr) UpdateServiceInfo(info *lokas.ServiceInfo) error
- type ServiceRegistry
- type SessionOption
- type TcpClient
- func (this *TcpClient) Call(transId uint32, req interface{}) (interface{}, error)
- func (this *TcpClient) ClearContext(err error)
- func (this *TcpClient) Connect(addr string) *promise.Promise
- func (this *TcpClient) Connected() bool
- func (this *TcpClient) Disconnect(b bool) *promise.Promise
- func (this *TcpClient) GetContext(transId uint32) lokas.IReqContext
- func (this *TcpClient) MessageHandler(msg *protocol.BinaryMessage)
- func (this *TcpClient) Off(cmdId uint16, listener events.Listener)
- func (this *TcpClient) OnClose(conn lokas.IConn)
- func (this *TcpClient) OnMessage(cmdId protocol.BINARY_TAG, listeners ...events.Listener)
- func (this *TcpClient) OnOpen(conn lokas.IConn)
- func (this *TcpClient) OnRecvCmd(cmdId protocol.BINARY_TAG, time time.Duration) *promise.Promise
- func (this *TcpClient) Request(req interface{}) *promise.Promise
- func (this *TcpClient) SendMessage(transId uint32, msg interface{})
- func (this *TcpClient) SetMessageHandler(handler func(msg *protocol.BinaryMessage))
- func (this *TcpClient) SetProtocol(p protocol.TYPE)
- type User
- func (this *User) Deserialize(a lokas.IProcess) error
- func (this *User) GetId() util.ID
- func (this *User) GetServerInfo(s string) (string, int32)
- func (this *User) HasAvatarById(id util.ID) bool
- func (this *User) HasAvatarByServer(gameId string, serverId int32) (bool, util.ID)
- func (this *User) Initialize(a lokas.IProcess) error
- func (this *User) Serialize(a lokas.IProcess) error
- func (this *User) SimpleUser() *User
- type UserCreator
- type WsClient
- func (this *WsClient) AsyncCall(transId uint32, req interface{}) (interface{}, error)
- func (this *WsClient) Call(transId uint32, req interface{}) (interface{}, error)
- func (this *WsClient) ClearContext()
- func (this *WsClient) Close() *promise.Promise
- func (this *WsClient) Connect(addr string) *promise.Promise
- func (this *WsClient) Connected() bool
- func (this *WsClient) Disconnect(force bool) *promise.Promise
- func (this *WsClient) GetContext(transId uint32) lokas.IReqContext
- func (this *WsClient) MessageHandler(msg *protocol.BinaryMessage)
- func (this *WsClient) Off(cmdId uint16, listener events.Listener)
- func (this *WsClient) OnClose(conn *websocket.Conn)
- func (this *WsClient) OnMessage(cmdId protocol.BINARY_TAG, listeners ...events.Listener)
- func (this *WsClient) OnOpen(conn *websocket.Conn)
- func (this *WsClient) OnRecv(conn lokas.IConn, data []byte)
- func (this *WsClient) OnRecvCmd(cmdId protocol.BINARY_TAG, time time.Duration) *promise.Promise
- func (this *WsClient) OnRecvMessage(cmdId protocol.BINARY_TAG, transId uint32, msg interface{})
- func (this *WsClient) Open() *promise.Promise
- func (this *WsClient) Request(req interface{}) *promise.Promise
- func (this *WsClient) Run()
- func (this *WsClient) SendMessage(transId uint32, msg interface{})
- func (this *WsClient) SetMessageHandler(handler func(msg *protocol.BinaryMessage))
- func (this *WsClient) SetProtocol(p protocol.TYPE)
Constants ¶
View Source
const ( TimeOut = time.Second * 15 UpdateTime = time.Second * 15 LeaseDuration int64 = 23 LeaseRenewDuration int64 = 15 )
View Source
const ( MUTEX_AVATAR_SESSION_KEY lokas.Key = "avatar_session_%d" AVATAR_SESSION_KEY lokas.Key = "/avatar_session/%d" )
View Source
const ( TAG_USER = 130 TAG_JWT = 131 TAG_CLAIM_USER = 132 TAG_AVATAR_MAP = 133 TAG_AVATAR = 134 TAG_ADMIN_CMD = 135 TAG_ADMIN_CMD_RESULT = 136 TAG_CREATE_AVATAR = 137 TAG_KICK_AVATAR = 138 TAG_RESPONSE = 140 TAG_CONSOLE_EVENT = 221 )
View Source
const ( HeaderSize = 8 ProtectLongPacketSize = 8 * 1024 * 1024 )
View Source
const (
PingInterval = time.Second * 3
)
View Source
const REFRESH_TOKEN_EXPIRE_TIME = time.Hour * 24 * 30
View Source
const TOKEN_EXPIRE_TIME = time.Minute * 10
Variables ¶
View Source
var CenterCtor = centerCtor{}
View Source
var GateCtor = gateCtor{}
View Source
var HttpCtor = httpCtor{}
View Source
var ProxyCtor = proxyCtor{}
Functions ¶
func CreateUser ¶ added in v0.1.29
func CreateUser() interface{}
func JwtAuth ¶
func JwtAuth(rsa bool, creator JwtClaimCreator, userCreator UserCreator) func(w rox.ResponseWriter, r *http.Request, a lokas.IProcess, next http.Handler)
func JwtSign ¶
func JwtSign(rsa bool, creator JwtClaimCreator) func(w rox.ResponseWriter, r *http.Request, a lokas.IProcess, next http.Handler)
func LogUserInfo ¶ added in v0.1.29
func NewAvatarManagerCtor ¶ added in v0.1.29
func NewAvatarManagerCtor(option lokas.IGameHandler) avatarManagerCtor
func NewModuleFromRegistry ¶
func NewWebSocket ¶ added in v0.1.35
func ReadDataFromEtcd ¶ added in v0.2.24
func RegisterModule ¶
func RegisterModule(creator Creator)
func UserRefreshToken ¶ added in v0.1.29
Types ¶
type ActiveSession ¶ added in v0.0.6
type ActiveSession struct { util.ID Messages chan []byte Conn lokas.IConn Protocol protocol.TYPE OnCloseFunc func(conn lokas.IConn) OnOpenFunc func(conn lokas.IConn) OnVerified func(conn lokas.IConn) MsgHandler func(msg *protocol.BinaryMessage) // contains filtered or unexported fields }
func NewActiveSession ¶ added in v0.0.6
func NewActiveSession(conn lokas.IConn, id util.ID, manager lokas.ISessionManager, opts ...ActiveSessionOption) *ActiveSession
func (*ActiveSession) AsyncCall ¶ added in v0.0.6
func (this *ActiveSession) AsyncCall(actorId util.ID, transId uint32, req protocol.ISerializable, resp protocol.ISerializable) error
func (*ActiveSession) Call ¶ added in v0.0.6
func (this *ActiveSession) Call(actorId util.ID, transId uint32, req protocol.ISerializable, resp protocol.ISerializable) error
func (*ActiveSession) CloneEntity ¶ added in v0.0.6
func (this *ActiveSession) CloneEntity() *ecs.Entity
func (*ActiveSession) GetConn ¶ added in v0.0.6
func (this *ActiveSession) GetConn() lokas.IConn
func (*ActiveSession) GetId ¶ added in v0.0.6
func (this *ActiveSession) GetId() util.ID
func (*ActiveSession) GetProcess ¶ added in v0.0.6
func (this *ActiveSession) GetProcess() lokas.IProcess
func (*ActiveSession) OnClose ¶ added in v0.0.6
func (this *ActiveSession) OnClose(conn lokas.IConn)
func (*ActiveSession) OnCreate ¶ added in v0.0.6
func (this *ActiveSession) OnCreate() error
func (*ActiveSession) OnDestroy ¶ added in v0.0.6
func (this *ActiveSession) OnDestroy() error
func (*ActiveSession) OnMessage ¶ added in v0.0.6
func (this *ActiveSession) OnMessage(actorId util.ID, transId uint32, msg protocol.ISerializable) error
func (*ActiveSession) OnOpen ¶ added in v0.0.6
func (this *ActiveSession) OnOpen(conn lokas.IConn)
func (*ActiveSession) OnRecv ¶ added in v0.0.6
func (this *ActiveSession) OnRecv(conn lokas.IConn, data []byte)
func (*ActiveSession) PongHandler ¶ added in v0.0.6
func (this *ActiveSession) PongHandler(pong *protocol.Pong)
func (*ActiveSession) SendMessage ¶ added in v0.0.6
func (this *ActiveSession) SendMessage(actorId util.ID, transId uint32, msg protocol.ISerializable) error
func (*ActiveSession) SetId ¶ added in v0.0.6
func (this *ActiveSession) SetId(id util.ID)
func (*ActiveSession) SetProcess ¶ added in v0.0.6
func (this *ActiveSession) SetProcess(process lokas.IProcess)
func (*ActiveSession) Start ¶ added in v0.0.6
func (this *ActiveSession) Start() error
func (*ActiveSession) Stop ¶ added in v0.0.6
func (this *ActiveSession) Stop() error
func (*ActiveSession) Type ¶ added in v0.0.6
func (this *ActiveSession) Type() string
func (*ActiveSession) Update ¶ added in v0.0.6
func (this *ActiveSession) Update(dt time.Duration, now time.Time)
func (*ActiveSession) Write ¶ added in v0.0.6
func (this *ActiveSession) Write(data []byte) error
type ActiveSessionOption ¶ added in v0.1.25
type ActiveSessionOption func(*ActiveSession)
type Actor ¶
type Actor struct { lokas.IEntity timer.TimeHandler MsgChan chan *protocol.RouteMessage ReplyChan chan *protocol.RouteMessage ReqContexts map[uint32]lokas.IReqContext Timeout time.Duration CtxMutex sync.Mutex Timer *time.Ticker DoneChan chan struct{} OnUpdateFunc func() MsgHandler func(actorId util.ID, transId uint32, msg protocol.ISerializable) (protocol.ISerializable, error) // contains filtered or unexported fields }
func (*Actor) Call ¶
func (this *Actor) Call(actorId util.ID, req protocol.ISerializable) (protocol.ISerializable, error)
func (*Actor) GetLeaseId ¶
return leaseId,(bool)is registered,error
func (*Actor) GetProcess ¶
func (this *Actor) GetProcess() lokas.IProcess
func (*Actor) HookReceive ¶ added in v0.1.41
func (this *Actor) HookReceive(msg *protocol.RouteMessage) *protocol.RouteMessage
func (*Actor) OnMessage ¶
func (this *Actor) OnMessage(msg *protocol.RouteMessage)
func (*Actor) ReceiveMessage ¶
func (this *Actor) ReceiveMessage(msg *protocol.RouteMessage)
func (*Actor) SendMessage ¶
func (*Actor) SetProcess ¶
func (this *Actor) SetProcess(process lokas.IProcess)
func (*Actor) StartMessagePump ¶
func (this *Actor) StartMessagePump()
type ActorContainer ¶
type ActorContainer struct { Actors map[util.ID]lokas.IActor // contains filtered or unexported fields }
func NewActorContainer ¶
func NewActorContainer(process lokas.IProcess) *ActorContainer
func (*ActorContainer) AddActor ¶
func (this *ActorContainer) AddActor(actor lokas.IActor)
func (*ActorContainer) GetActor ¶
func (this *ActorContainer) GetActor(id util.ID) lokas.IActor
func (*ActorContainer) GetActorIds ¶
func (this *ActorContainer) GetActorIds() []util.ID
func (*ActorContainer) GetProcess ¶
func (this *ActorContainer) GetProcess() lokas.IProcess
func (*ActorContainer) Load ¶
func (this *ActorContainer) Load(conf lokas.IConfig) error
func (*ActorContainer) OnStart ¶
func (this *ActorContainer) OnStart() error
func (*ActorContainer) OnStop ¶
func (this *ActorContainer) OnStop() error
func (*ActorContainer) RemoveActor ¶
func (this *ActorContainer) RemoveActor(actor lokas.IActor)
func (*ActorContainer) RemoveActorById ¶
func (this *ActorContainer) RemoveActorById(id util.ID) lokas.IActor
func (*ActorContainer) SetProcess ¶
func (this *ActorContainer) SetProcess(process lokas.IProcess)
func (*ActorContainer) Start ¶
func (this *ActorContainer) Start() error
func (*ActorContainer) StartActor ¶
func (this *ActorContainer) StartActor(actor lokas.IActor) error
func (*ActorContainer) Stop ¶
func (this *ActorContainer) Stop() error
func (*ActorContainer) StopActor ¶
func (this *ActorContainer) StopActor(actor lokas.IActor)
func (*ActorContainer) Type ¶
func (this *ActorContainer) Type() string
func (*ActorContainer) Unload ¶
func (this *ActorContainer) Unload() error
type ActorRegistry ¶
type ActorRegistry struct { Id util.ID ProcessId util.ProcessId Type string GameId string Version string ServerId int32 //Health lokas.ActorState Ts time.Time }
func NewActorRegistry ¶
func NewActorRegistry(id util.ID) *ActorRegistry
type ActorRegistryInfo ¶
type ActorRegistryInfo struct { Id util.ID Type string ProcessId util.ProcessId GameId string Version string ServerId int32 Ts time.Time }
func CreateActorRegistryInfo ¶
func CreateActorRegistryInfo(actor lokas.IActor) *ActorRegistryInfo
type AdminCommand ¶ added in v0.1.29
func NewAdminCommand ¶ added in v0.1.29
func NewAdminCommand(cmd string, username string, params ...interface{}) *AdminCommand
func (*AdminCommand) GetId ¶ added in v0.1.29
func (this *AdminCommand) GetId() (protocol.BINARY_TAG, error)
func (*AdminCommand) ParamsValue ¶ added in v0.1.29
func (this *AdminCommand) ParamsValue() *cmds.ParamsValue
func (*AdminCommand) Serializable ¶ added in v0.1.29
func (this *AdminCommand) Serializable() protocol.ISerializable
type AdminCommandResult ¶ added in v0.1.29
func NewAdminCommandResult ¶ added in v0.1.29
func NewAdminCommandResult(cmd *AdminCommand, success bool, data []byte) *AdminCommandResult
func (*AdminCommandResult) GetId ¶ added in v0.1.29
func (this *AdminCommandResult) GetId() (protocol.BINARY_TAG, error)
func (*AdminCommandResult) Serializable ¶ added in v0.1.29
func (this *AdminCommandResult) Serializable() protocol.ISerializable
type AdminHandShake ¶ added in v0.1.29
func NewAdminHandShake ¶ added in v0.1.29
func NewAdminHandShake(acc string, pass string) *AdminHandShake
func (*AdminHandShake) Marshal ¶ added in v0.1.29
func (this *AdminHandShake) Marshal() ([]byte, error)
func (*AdminHandShake) Unmarshal ¶ added in v0.1.29
func (this *AdminHandShake) Unmarshal(from []byte) error
type AppConfig ¶
func NewAppConfig ¶
func NewAppConfig(name string, opts ...ConfigOption) *AppConfig
func NewSubAppConfig ¶
func (*AppConfig) AllSettings ¶
func (*AppConfig) GetFloat64 ¶
func (*AppConfig) GetInt32Slice ¶ added in v0.2.4
func (*AppConfig) GetIntSlice ¶
func (*AppConfig) GetSizeInBytes ¶
func (*AppConfig) GetStringMap ¶
func (*AppConfig) GetStringMapString ¶
func (*AppConfig) GetStringMapStringSlice ¶
func (*AppConfig) GetStringSlice ¶
func (*AppConfig) LoadFromRemote ¶
func (*AppConfig) SetRemoteConfig ¶
type Avatar ¶
type Avatar struct { *Actor *AvatarSession Serializer func(avatar lokas.IActor, process lokas.IProcess) error Initializer func(avatar lokas.IActor, process lokas.IProcess) error Deserializer func(avatar lokas.IActor, process lokas.IProcess) error Updater func(avatar lokas.IActor, process lokas.IProcess) error MsgDelegator func(avatar lokas.IActor, actorId util.ID, transId uint32, msg protocol.ISerializable) (protocol.ISerializable, error) // contains filtered or unexported fields }
func NewAvatar ¶
func NewAvatar(id util.ID, handler lokas.IGameHandler, manager *AvatarManager) *Avatar
func (*Avatar) Deserialize ¶
func (*Avatar) Initialize ¶ added in v0.2.6
type AvatarManager ¶
type AvatarManager struct { *Actor Avatars map[util.ID]*Avatar AvatarCnt int32 Option lokas.IGameHandler Ctx context.Context Cancel context.CancelFunc // contains filtered or unexported fields }
func (*AvatarManager) CreateAvatar ¶
func (this *AvatarManager) CreateAvatar(id util.ID) error
func (*AvatarManager) HandleMsg ¶ added in v0.1.29
func (this *AvatarManager) HandleMsg(actorId util.ID, transId uint32, msg protocol.ISerializable) (protocol.ISerializable, error)
func (*AvatarManager) Load ¶
func (this *AvatarManager) Load(conf lokas.IConfig) error
func (*AvatarManager) OnStart ¶
func (this *AvatarManager) OnStart() error
func (*AvatarManager) OnStop ¶
func (this *AvatarManager) OnStop() error
func (*AvatarManager) OnUpdate ¶
func (this *AvatarManager) OnUpdate()
func (*AvatarManager) RemoveAvatar ¶
func (this *AvatarManager) RemoveAvatar(id util.ID)
func (*AvatarManager) Start ¶
func (this *AvatarManager) Start() error
func (*AvatarManager) Stop ¶
func (this *AvatarManager) Stop() error
func (*AvatarManager) Unload ¶
func (this *AvatarManager) Unload() error
type AvatarSession ¶ added in v0.1.29
type AvatarSession struct { Id util.ID UserId util.ID GateId util.ID UserName string GameId string ServerId int32 // contains filtered or unexported fields }
func NewAvatarSession ¶ added in v0.1.29
func NewAvatarSession(id util.ID) *AvatarSession
func (*AvatarSession) ChangeUserName ¶ added in v0.1.35
func (this *AvatarSession) ChangeUserName(a lokas.IProcess, name string) error
func (*AvatarSession) Deserialize ¶ added in v0.1.29
func (this *AvatarSession) Deserialize(a lokas.IProcess) error
func (*AvatarSession) FetchData ¶ added in v0.1.29
func (this *AvatarSession) FetchData(a lokas.IProcess) error
func (*AvatarSession) GetGameId ¶ added in v0.1.29
func (this *AvatarSession) GetGameId() string
func (*AvatarSession) GetGateId ¶ added in v0.1.29
func (this *AvatarSession) GetGateId() util.ID
func (*AvatarSession) GetId ¶ added in v0.1.29
func (this *AvatarSession) GetId() util.ID
func (*AvatarSession) GetServerId ¶ added in v0.1.29
func (this *AvatarSession) GetServerId() int32
func (*AvatarSession) GetUserId ¶ added in v0.1.35
func (this *AvatarSession) GetUserId() util.ID
func (*AvatarSession) GetUserName ¶ added in v0.1.29
func (this *AvatarSession) GetUserName() string
func (*AvatarSession) Initialize ¶ added in v0.2.7
func (this *AvatarSession) Initialize(a lokas.IProcess) error
func (*AvatarSession) Serialize ¶ added in v0.1.29
func (this *AvatarSession) Serialize(a lokas.IProcess) error
func (*AvatarSession) SetGateId ¶ added in v0.1.29
func (this *AvatarSession) SetGateId(id util.ID)
func (*AvatarSession) SetOnGateWayChanged ¶ added in v0.1.29
func (this *AvatarSession) SetOnGateWayChanged(f func(session *AvatarSession))
func (*AvatarSession) SetOnSessionClosed ¶ added in v0.1.29
func (this *AvatarSession) SetOnSessionClosed(f func())
func (*AvatarSession) StartAvatarSession ¶ added in v0.1.29
func (this *AvatarSession) StartAvatarSession()
func (*AvatarSession) StopAvatarSession ¶ added in v0.1.29
func (this *AvatarSession) StopAvatarSession()
type CellManager ¶
type CellManager struct { *Actor ActorContainer Blocks map[int64]Block }
func (*CellManager) Load ¶
func (this *CellManager) Load(conf lokas.IConfig) error
func (*CellManager) OnStart ¶
func (this *CellManager) OnStart() error
func (*CellManager) OnStop ¶
func (this *CellManager) OnStop() error
func (*CellManager) Spawn ¶
func (this *CellManager) Spawn() lokas.IActor
func (*CellManager) Unload ¶
func (this *CellManager) Unload() error
type Center ¶
func (*Center) OnRegister ¶
func (this *Center) OnRegister()
type CommonRegistry ¶
type CommonRegistry struct { Processes map[util.ProcessId]*ProcessRegistry Services map[string]map[uint16]*ServiceRegistry Actors map[util.ID]*ActorRegistry ActorsByType map[string][]util.ID ActorsByServer map[int32][]util.ID Ts time.Time // contains filtered or unexported fields }
func NewCommonRegistry ¶
func NewCommonRegistry() *CommonRegistry
func (*CommonRegistry) AddActor ¶
func (this *CommonRegistry) AddActor(actor *ActorRegistry)
func (*CommonRegistry) AddProcess ¶
func (this *CommonRegistry) AddProcess(process *ProcessRegistry)
func (*CommonRegistry) AddService ¶
func (this *CommonRegistry) AddService(service *ServiceRegistry)
func (*CommonRegistry) GetActorIdsByTypeAndServerId ¶
func (this *CommonRegistry) GetActorIdsByTypeAndServerId(serverId int32, typ string) []util.ID
func (*CommonRegistry) GetActorRegistry ¶
func (this *CommonRegistry) GetActorRegistry(id util.ID) *ActorRegistry
func (*CommonRegistry) RemoveActor ¶
func (this *CommonRegistry) RemoveActor(actorId util.ID)
func (*CommonRegistry) RemoveProcess ¶
func (this *CommonRegistry) RemoveProcess(id util.ProcessId)
func (*CommonRegistry) RemoveService ¶
func (this *CommonRegistry) RemoveService(serviceType string, serviceId uint16)
type ConfigOption ¶
func ConfigFile ¶
func ConfigFile(folder string) ConfigOption
func EtcdFile ¶
func EtcdFile(etcdPath string, addr string) ConfigOption
func MongoFile ¶
func MongoFile(folder string) ConfigOption
type ConsoleEvent ¶ added in v0.1.31
type ConsoleEvent struct {
Text string
}
func NewConsoleEvent ¶ added in v0.1.31
func NewConsoleEvent(text string) *ConsoleEvent
func (*ConsoleEvent) GetId ¶ added in v0.1.31
func (this *ConsoleEvent) GetId() (protocol.BINARY_TAG, error)
func (*ConsoleEvent) Serializable ¶ added in v0.1.31
func (this *ConsoleEvent) Serializable() protocol.ISerializable
type Context ¶
type Context struct {
Content map[string]interface{} `json:"content"`
}
func NewContext ¶
func NewContext() *Context
func (*Context) GetFloat32 ¶ added in v0.1.43
func (*Context) GetFloat64 ¶ added in v0.1.43
type CreateAvatar ¶ added in v0.1.29
type CreateAvatar struct {
Id int64
}
创建角色
func NewCreateAvatar ¶ added in v0.1.29
func NewCreateAvatar(id util.ID) *CreateAvatar
func (*CreateAvatar) GetId ¶ added in v0.1.29
func (this *CreateAvatar) GetId() (protocol.BINARY_TAG, error)
func (*CreateAvatar) Serializable ¶ added in v0.1.29
func (this *CreateAvatar) Serializable() protocol.ISerializable
type DefaultConfig ¶
type DefaultConfig struct { *AppConfig ProcessId util.ProcessId `mapstructure:"pid"` ServerId int32 `mapstructure:"sid"` GameId string `mapstructure:"gid"` Host string `mapstructure:"host"` Port string `mapstructure:"port"` Version string `mapstructure:"version"` SName string `mapstructure:"serverName"` Name string `mapstructure:"name"` Etcd EtcdConfig `mapstructure:"-"` Mongo MongoConfig `mapstructure:"-"` Mysql MysqlConfig `mapstructure:"-"` Redis RedisConfig `mapstructure:"-"` Oss OssConfig `mapstructure:"-"` Mods []lokas.IConfig `mapstructure:"-"` Modules []string `mapstructure:"modules"` DockerCLI DockerConfig `mapstructure:"docker"` }
func NewDefaultConfig ¶
func NewDefaultConfig() *DefaultConfig
func (*DefaultConfig) GetAllSub ¶
func (this *DefaultConfig) GetAllSub() []lokas.IConfig
func (*DefaultConfig) GetDb ¶
func (this *DefaultConfig) GetDb(t string) interface{}
func (*DefaultConfig) GetDockerCLI ¶ added in v0.2.14
func (this *DefaultConfig) GetDockerCLI() interface{}
func (*DefaultConfig) GetGameId ¶
func (this *DefaultConfig) GetGameId() string
func (*DefaultConfig) GetName ¶
func (this *DefaultConfig) GetName() string
func (*DefaultConfig) GetProcessId ¶
func (this *DefaultConfig) GetProcessId() util.ProcessId
func (*DefaultConfig) GetProcessIdType ¶
func (this *DefaultConfig) GetProcessIdType(key string) util.ProcessId
func (*DefaultConfig) GetServerId ¶
func (this *DefaultConfig) GetServerId() int32
func (*DefaultConfig) GetVersion ¶
func (this *DefaultConfig) GetVersion() string
func (*DefaultConfig) Load ¶
func (this *DefaultConfig) Load() error
func (*DefaultConfig) LoadFromRemote ¶
func (this *DefaultConfig) LoadFromRemote() error
func (*DefaultConfig) LoadFromString ¶
func (this *DefaultConfig) LoadFromString(s string) error
func (*DefaultConfig) LoadInConfig ¶ added in v0.2.24
func (this *DefaultConfig) LoadInConfig() error
func (*DefaultConfig) MergeData ¶ added in v0.2.24
func (this *DefaultConfig) MergeData(in io.Reader) error
func (*DefaultConfig) ServerName ¶
func (this *DefaultConfig) ServerName() string
type DockerConfig ¶ added in v0.2.14
type EtcdConfig ¶
type EtcdConfig struct {
EndPoints []string `mapstructure:"endpoints"`
}
type GameHandler ¶ added in v0.1.29
type GameHandler struct { Serializer func(avatar lokas.IActor, process lokas.IProcess) error Initializer func(avatar lokas.IActor, process lokas.IProcess) error Deserializer func(avatar lokas.IActor, process lokas.IProcess) error Updater func(avatar lokas.IActor, process lokas.IProcess) error MsgDelegator func(avatar lokas.IActor, actorId util.ID, transId uint32, msg protocol.ISerializable) (protocol.ISerializable, error) }
func (*GameHandler) GetDeserializer ¶ added in v0.1.29
func (this *GameHandler) GetDeserializer() func(avatar lokas.IActor, process lokas.IProcess) error
func (*GameHandler) GetInitializer ¶ added in v0.2.6
func (this *GameHandler) GetInitializer() func(avatar lokas.IActor, process lokas.IProcess) error
func (*GameHandler) GetMsgDelegator ¶ added in v0.1.29
func (this *GameHandler) GetMsgDelegator() func(avatar lokas.IActor, actorId util.ID, transId uint32, msg protocol.ISerializable) (protocol.ISerializable, error)
func (*GameHandler) GetSerializer ¶ added in v0.1.29
func (this *GameHandler) GetSerializer() func(avatar lokas.IActor, process lokas.IProcess) error
func (*GameHandler) GetUpdater ¶ added in v0.1.29
func (this *GameHandler) GetUpdater() func(avatar lokas.IActor, process lokas.IProcess) error
type Gate ¶
type Gate struct { *Actor lokas.ISessionManager Host string Port string AuthFunc func(data []byte) (interface{}, error) SessionCreatorFunc func(conn lokas.IConn) lokas.ISession Protocol protocol.TYPE Ctx context.Context Cancel context.CancelFunc // contains filtered or unexported fields }
func (*Gate) LoadCustom ¶ added in v0.1.29
func (*Gate) SessionCreator ¶
func (this *Gate) SessionCreator(conn lokas.IConn) lokas.ISession
type Http ¶
func (*Http) CreateHandlerFunc ¶
func (*Http) PathExcept ¶
func (this *Http) PathExcept(p string, m ...rox.MiddleWare) *Http
func (*Http) PathExcepts ¶
func (this *Http) PathExcepts(p []string, m ...rox.MiddleWare) *Http
func (*Http) PrefixExcept ¶
func (this *Http) PrefixExcept(prefix string, m ...rox.MiddleWare) *Http
func (*Http) PrefixExceptStrict ¶
func (this *Http) PrefixExceptStrict(prefix string, m ...rox.MiddleWare) *Http
func (*Http) PrefixOnly ¶
func (this *Http) PrefixOnly(prefix string, m ...rox.MiddleWare) *Http
func (*Http) PrefixOnlyStrict ¶
func (this *Http) PrefixOnlyStrict(prefix string, m ...rox.MiddleWare) *Http
func (*Http) When ¶
func (this *Http) When(matcher rox.MiddlewareMatcher, m ...rox.MiddleWare) *Http
type JwtClaim ¶
func NewJwtClaim ¶
type JwtClaimCreator ¶
type JwtClaimCreator func(user interface{}, expire time.Duration) JwtClaimWithUser
type JwtClaimWithUser ¶
type JwtClaimWithUser interface { jwt.Claims GetUser() interface{} SetUser(user interface{}) }
type KickAvatar ¶ added in v0.1.29
type KickAvatar struct {
Id int64
}
func NewKickAvatar ¶ added in v0.1.29
func NewKickAvatar(id util.ID) *KickAvatar
func (*KickAvatar) GetId ¶ added in v0.1.29
func (this *KickAvatar) GetId() (protocol.BINARY_TAG, error)
func (*KickAvatar) Serializable ¶ added in v0.1.29
func (this *KickAvatar) Serializable() protocol.ISerializable
type LoginHandShake ¶ added in v0.1.29
type LoginHandShake struct { GameId string Version string ServerId int32 UserId util.ID AvatarId util.ID Token string }
func NewLoginHandShake ¶ added in v0.1.29
func (*LoginHandShake) Marshal ¶ added in v0.1.29
func (this *LoginHandShake) Marshal() ([]byte, error)
func (*LoginHandShake) Unmarshal ¶ added in v0.1.29
func (this *LoginHandShake) Unmarshal(from []byte) error
type MongoConfig ¶
type MysqlConfig ¶
type PassiveSession ¶ added in v0.0.6
type PassiveSession struct { *Actor Verified bool Messages chan []byte Conn lokas.IConn Protocol protocol.TYPE OnCloseFunc func(conn lokas.IConn) OnOpenFunc func(conn lokas.IConn) ClientMsgHandler func(msg *protocol.BinaryMessage) AuthFunc func(data []byte) (interface{}, error) // contains filtered or unexported fields }
func NewPassiveSession ¶ added in v0.0.6
func NewPassiveSession(conn lokas.IConn, id util.ID, manager lokas.ISessionManager, opts ...PassiveSessionOption) *PassiveSession
func (*PassiveSession) GetConn ¶ added in v0.0.6
func (this *PassiveSession) GetConn() lokas.IConn
func (*PassiveSession) Load ¶ added in v0.0.6
func (this *PassiveSession) Load(conf lokas.IConfig) error
func (*PassiveSession) OnClose ¶ added in v0.0.6
func (this *PassiveSession) OnClose(conn lokas.IConn)
func (*PassiveSession) OnCreate ¶ added in v0.0.6
func (this *PassiveSession) OnCreate() error
func (*PassiveSession) OnDestroy ¶ added in v0.0.6
func (this *PassiveSession) OnDestroy() error
func (*PassiveSession) OnMessage ¶ added in v0.1.41
func (this *PassiveSession) OnMessage(msg *protocol.RouteMessage)
func (*PassiveSession) OnOpen ¶ added in v0.0.6
func (this *PassiveSession) OnOpen(conn lokas.IConn)
func (*PassiveSession) OnRecv ¶ added in v0.0.6
func (this *PassiveSession) OnRecv(conn lokas.IConn, data []byte)
func (*PassiveSession) OnStart ¶ added in v0.0.6
func (this *PassiveSession) OnStart() error
func (*PassiveSession) OnStop ¶ added in v0.0.6
func (this *PassiveSession) OnStop() error
func (*PassiveSession) Start ¶ added in v0.0.6
func (this *PassiveSession) Start() error
func (*PassiveSession) StartMessagePump ¶ added in v0.0.6
func (this *PassiveSession) StartMessagePump()
func (*PassiveSession) Stop ¶ added in v0.0.6
func (this *PassiveSession) Stop() error
func (*PassiveSession) Unload ¶ added in v0.0.6
func (this *PassiveSession) Unload() error
type PassiveSessionOption ¶ added in v0.1.25
type PassiveSessionOption func(*PassiveSession)
type Process ¶
type Process struct { lokas.IActorContainer lokas.IRegistry lokas.IRouter lokas.IProxy // contains filtered or unexported fields }
func CreateProcess ¶
func CreateProcess() *Process
func (*Process) GameServerId ¶
func (*Process) GetDocker ¶ added in v0.2.14
func (this *Process) GetDocker() (*dockerclient.TLSClient, error)
func (*Process) GetEtcd ¶
func (this *Process) GetEtcd() *etcdclient.Client
func (*Process) GetLogger ¶
func (this *Process) GetLogger() *log.ComposeLogger
func (*Process) GetRedis ¶
func (this *Process) GetRedis() *redisclient.Client
func (*Process) GlobalMutex ¶
func (*Process) LoadAllModule ¶
func (*Process) LoadModuleRegistry ¶
func (*Process) RegisterModule ¶
func (this *Process) RegisterModule(creator lokas.IModuleCtor)
func (*Process) SaveModuleRegistry ¶
func (*Process) StartAllModule ¶
func (*Process) StopAllModule ¶
type ProcessActorsInfo ¶
func CreateProcessActorsInfo ¶
func CreateProcessActorsInfo(process lokas.IProcess) *ProcessActorsInfo
type ProcessRegistry ¶
type ProcessRegistry struct { Id util.ProcessId GameId string Version string ServerId int32 Host string Port string Services map[protocol.BINARY_TAG]*lokas.Service Actors map[util.ID]*ActorRegistry Ts time.Time }
func NewProcessRegistry ¶
func NewProcessRegistry(id util.ProcessId) *ProcessRegistry
type ProcessRegistryInfo ¶
type ProcessRegistryInfo struct { Id util.ProcessId GameId string Version string ServerId int32 Host string Port string Ts time.Time }
func CreateProcessRegistryInfo ¶
func CreateProcessRegistryInfo(process lokas.IProcess) *ProcessRegistryInfo
type ProcessServiceInfo ¶
type ProcessServiceInfo struct { Id util.ProcessId Services map[protocol.BINARY_TAG]int }
type Proxy ¶
type Proxy struct { Host string Port string Sessions *ProxySessionManager // contains filtered or unexported fields }
func (*Proxy) GetProcess ¶ added in v0.1.25
func (this *Proxy) GetProcess() lokas.IProcess
func (*Proxy) SetProcess ¶ added in v0.1.25
func (this *Proxy) SetProcess(process lokas.IProcess)
type ProxySession ¶ added in v0.1.26
type ProxySession struct { *Actor Verified bool Messages chan []byte Conn lokas.IConn Protocol protocol.TYPE OnCloseFunc func(conn lokas.IConn) OnOpenFunc func(conn lokas.IConn) OnVerified func(success bool) MsgHandler func(msg *protocol.BinaryMessage) AuthFunc func(data []byte) error // contains filtered or unexported fields }
func NewProxySession ¶ added in v0.1.26
func NewProxySession(conn lokas.IConn, id util.ID, manager *ProxySessionManager, passive bool, opts ...SessionOption) *ProxySession
func (*ProxySession) GetConn ¶ added in v0.1.26
func (this *ProxySession) GetConn() lokas.IConn
func (*ProxySession) GetProcess ¶ added in v0.1.26
func (this *ProxySession) GetProcess() lokas.IProcess
func (*ProxySession) HandleMessage ¶ added in v0.1.26
func (this *ProxySession) HandleMessage(f func(msg *protocol.BinaryMessage))
func (*ProxySession) OnClose ¶ added in v0.1.26
func (this *ProxySession) OnClose(conn lokas.IConn)
func (*ProxySession) OnCreate ¶ added in v0.1.26
func (this *ProxySession) OnCreate() error
func (*ProxySession) OnDestroy ¶ added in v0.1.26
func (this *ProxySession) OnDestroy() error
func (*ProxySession) OnOpen ¶ added in v0.1.26
func (this *ProxySession) OnOpen(conn lokas.IConn)
func (*ProxySession) OnRecv ¶ added in v0.1.26
func (this *ProxySession) OnRecv(conn lokas.IConn, data []byte)
func (*ProxySession) SendMessage ¶ added in v0.1.26
func (this *ProxySession) SendMessage(actorId util.ID, transId uint32, msg protocol.ISerializable) error
func (*ProxySession) SetProcess ¶ added in v0.1.26
func (this *ProxySession) SetProcess(process lokas.IProcess)
func (*ProxySession) Start ¶ added in v0.1.26
func (this *ProxySession) Start() error
func (*ProxySession) Stop ¶ added in v0.1.26
func (this *ProxySession) Stop() error
func (*ProxySession) Type ¶ added in v0.1.26
func (this *ProxySession) Type() string
func (*ProxySession) Update ¶ added in v0.1.26
func (this *ProxySession) Update(dt time.Duration, now time.Time)
func (*ProxySession) Write ¶ added in v0.1.26
func (this *ProxySession) Write(data []byte) error
type ProxySessionManager ¶ added in v0.1.26
type ProxySessionManager struct {
// contains filtered or unexported fields
}
func NewProxySessionManager ¶ added in v0.1.26
func NewProxySessionManager(safeMode bool) *ProxySessionManager
func (*ProxySessionManager) AddSession ¶ added in v0.1.26
func (this *ProxySessionManager) AddSession(id util.ID, session lokas.ISession)
func (*ProxySessionManager) Clear ¶ added in v0.1.26
func (this *ProxySessionManager) Clear()
func (*ProxySessionManager) GetRoundSession ¶ added in v0.1.26
func (this *ProxySessionManager) GetRoundSession() (lokas.ISession, bool)
func (*ProxySessionManager) GetSession ¶ added in v0.1.26
func (this *ProxySessionManager) GetSession(id util.ID) lokas.ISession
func (*ProxySessionManager) GetSessionCount ¶ added in v0.1.26
func (this *ProxySessionManager) GetSessionCount() int
func (*ProxySessionManager) Range ¶ added in v0.1.26
func (this *ProxySessionManager) Range(f func(id util.ID, session lokas.ISession) bool)
func (*ProxySessionManager) RemoveSession ¶ added in v0.1.26
func (this *ProxySessionManager) RemoveSession(id util.ID)
func (*ProxySessionManager) ResetSession ¶ added in v0.1.26
func (this *ProxySessionManager) ResetSession(id util.ID, session lokas.ISession)
type RedisConfig ¶
type Registry ¶
type Registry struct { LocalRegistry *CommonRegistry //local actor&service registry GlobalRegistry *CommonRegistry //local actor&service registry // contains filtered or unexported fields }
func NewRegistry ¶
func NewRegistry(process lokas.IProcess) *Registry
func (*Registry) GetActorIdsByTypeAndServerId ¶
func (*Registry) GetLeaseId ¶ added in v0.1.25
return leaseId,(bool)is registered,error
func (*Registry) GetProcess ¶
func (this *Registry) GetProcess() lokas.IProcess
func (*Registry) GetProcessIdByActor ¶
func (*Registry) GetProcessInfo ¶ added in v0.1.25
func (*Registry) GetServiceDiscoverMgr ¶ added in v0.2.30
func (reg *Registry) GetServiceDiscoverMgr() lokas.IServiceDiscoverMgr
func (*Registry) GetServiceRegisterMgr ¶ added in v0.2.24
func (reg *Registry) GetServiceRegisterMgr() lokas.IServiceRegisterMgr
func (*Registry) QueryRemoteActorsByServer ¶
func (*Registry) QueryRemoteActorsByType ¶
func (*Registry) RegisterActorLocal ¶
func (*Registry) RegisterActorRemote ¶
func (*Registry) RegisterActors ¶
func (*Registry) SetProcess ¶
func (this *Registry) SetProcess(process lokas.IProcess)
func (*Registry) UnregisterActorLocal ¶
func (*Registry) UnregisterActorRemote ¶
type Response ¶ added in v0.1.29
type Response struct {
OK bool
}
默认回复
func NewResponse ¶ added in v0.1.29
func (*Response) GetId ¶ added in v0.1.29
func (this *Response) GetId() (protocol.BINARY_TAG, error)
func (*Response) Serializable ¶ added in v0.1.29
func (this *Response) Serializable() protocol.ISerializable
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
router读取配置表,同步服务器注册信息 路由信息到本机或调用Proxy建立连接
func (*Router) GetProcess ¶
func (this *Router) GetProcess() lokas.IProcess
func (*Router) RouteMsg ¶
func (this *Router) RouteMsg(msg *protocol.RouteMessage)
func (*Router) RouteMsgLocal ¶ added in v0.2.35
func (router *Router) RouteMsgLocal(msg *protocol.RouteMessage) error
func (*Router) SetProcess ¶
func (this *Router) SetProcess(process lokas.IProcess)
type ServiceDiscoverMgr ¶ added in v0.2.30
type ServiceDiscoverMgr struct {
// contains filtered or unexported fields
}
func NewServiceDiscoverMgr ¶ added in v0.2.30
func NewServiceDiscoverMgr(process lokas.IProcess) *ServiceDiscoverMgr
func (*ServiceDiscoverMgr) FindServiceInfo ¶ added in v0.2.30
func (mgr *ServiceDiscoverMgr) FindServiceInfo(serviceType string, serviceId uint16) (*lokas.ServiceInfo, bool)
func (*ServiceDiscoverMgr) StartDiscover ¶ added in v0.2.30
func (mgr *ServiceDiscoverMgr) StartDiscover() error
func (*ServiceDiscoverMgr) Stop ¶ added in v0.2.30
func (mgr *ServiceDiscoverMgr) Stop()
type ServiceRegister ¶ added in v0.2.21
type ServiceRegister struct {
// contains filtered or unexported fields
}
type ServiceRegisterMgr ¶ added in v0.2.21
type ServiceRegisterMgr struct {
// contains filtered or unexported fields
}
func NewServiceRegisterMgr ¶ added in v0.2.21
func NewServiceRegisterMgr(process lokas.IProcess) *ServiceRegisterMgr
func (*ServiceRegisterMgr) FindServiceInfo ¶ added in v0.2.24
func (mgr *ServiceRegisterMgr) FindServiceInfo(serviceType string, serviceId uint16) (*lokas.ServiceInfo, bool)
func (*ServiceRegisterMgr) FindServiceList ¶ added in v0.2.24
func (mgr *ServiceRegisterMgr) FindServiceList(serviceType string) ([]*lokas.ServiceInfo, bool)
func (*ServiceRegisterMgr) Register ¶ added in v0.2.21
func (mgr *ServiceRegisterMgr) Register(info *lokas.ServiceInfo) error
func (*ServiceRegisterMgr) Stop ¶ added in v0.2.22
func (mgr *ServiceRegisterMgr) Stop()
func (*ServiceRegisterMgr) Unregister ¶ added in v0.2.21
func (mgr *ServiceRegisterMgr) Unregister(serviceType string, serviceId uint16) error
func (*ServiceRegisterMgr) UpdateServiceInfo ¶ added in v0.2.21
func (mgr *ServiceRegisterMgr) UpdateServiceInfo(info *lokas.ServiceInfo) error
type ServiceRegistry ¶
type ServiceRegistry struct { // Id uint32 ServiceType string ServiceId uint16 // GameId string Host string Port uint32 Version string Cnt uint32 ProcessId util.ProcessId CreateAt time.Time }
service
func NewServiceRegistry ¶ added in v0.2.20
func NewServiceRegistry(serviceType string, serviceId uint16) *ServiceRegistry
type SessionOption ¶
type SessionOption func(*ProxySession)
func WithCloseFunc ¶
func WithCloseFunc(closeFunc func(conn lokas.IConn)) SessionOption
func WithMsgHandler ¶ added in v0.1.26
func WithMsgHandler(msgHandler func(msg *protocol.BinaryMessage)) SessionOption
func WithOpenFunc ¶
func WithOpenFunc(closeFunc func(conn lokas.IConn)) SessionOption
type TcpClient ¶ added in v0.0.6
type TcpClient struct { events.EventEmmiter *ActiveSession Closing bool Opening bool ConnType ConnType Protocol protocol.TYPE // contains filtered or unexported fields }
func NewTcpClient ¶ added in v0.0.6
func NewTcpClient() *TcpClient
func (*TcpClient) ClearContext ¶ added in v0.0.6
func (*TcpClient) Disconnect ¶ added in v0.0.6
func (*TcpClient) GetContext ¶ added in v0.0.8
func (*TcpClient) MessageHandler ¶ added in v0.0.6
func (this *TcpClient) MessageHandler(msg *protocol.BinaryMessage)
func (*TcpClient) OnMessage ¶ added in v0.0.6
func (this *TcpClient) OnMessage(cmdId protocol.BINARY_TAG, listeners ...events.Listener)
func (*TcpClient) SendMessage ¶ added in v0.0.6
func (*TcpClient) SetMessageHandler ¶ added in v0.1.35
func (this *TcpClient) SetMessageHandler(handler func(msg *protocol.BinaryMessage))
func (*TcpClient) SetProtocol ¶ added in v0.1.35
type User ¶
type User struct { Id util.ID `bson:"_id"` Role uint32 Avatars map[string]util.ID AgentsParams map[string]string Token string RefreshToken string UserName string Password string }
func (*User) Deserialize ¶ added in v0.1.29
func (*User) GetServerInfo ¶ added in v0.1.29
func (*User) HasAvatarByServer ¶ added in v0.1.29
func (*User) Initialize ¶ added in v0.2.7
func (*User) SimpleUser ¶ added in v0.1.29
type UserCreator ¶
type UserCreator func() interface{}
type WsClient ¶ added in v0.1.35
type WsClient struct { events.EventEmmiter Closing bool Opening bool Protocol protocol.TYPE MsgHandler func(msg *protocol.BinaryMessage) // contains filtered or unexported fields }
func NewWsClient ¶ added in v0.1.35
func NewWsClient() *WsClient
func (*WsClient) ClearContext ¶ added in v0.1.35
func (this *WsClient) ClearContext()
func (*WsClient) Disconnect ¶ added in v0.1.35
func (*WsClient) GetContext ¶ added in v0.1.35
func (*WsClient) MessageHandler ¶ added in v0.1.35
func (this *WsClient) MessageHandler(msg *protocol.BinaryMessage)
func (*WsClient) OnMessage ¶ added in v0.1.35
func (this *WsClient) OnMessage(cmdId protocol.BINARY_TAG, listeners ...events.Listener)
func (*WsClient) OnRecvMessage ¶ added in v0.1.35
func (this *WsClient) OnRecvMessage(cmdId protocol.BINARY_TAG, transId uint32, msg interface{})
func (*WsClient) SendMessage ¶ added in v0.1.35
func (*WsClient) SetMessageHandler ¶ added in v0.1.35
func (this *WsClient) SetMessageHandler(handler func(msg *protocol.BinaryMessage))
func (*WsClient) SetProtocol ¶ added in v0.1.35
Source Files ¶
- active_session.go
- actor.go
- actor_container.go
- admin_handshake.go
- admincmd.go
- avatar.go
- avatar_action.go
- avatar_map.go
- avatar_option.go
- avatar_session.go
- avater_manager.go
- block.go
- cell.go
- cell_manager.go
- center.go
- config.go
- console_event.go
- context.go
- gate.go
- handshake.go
- http.go
- ids.go
- jwt.go
- module.go
- passive_session.go
- process.go
- proxy.go
- proxy_session.go
- proxy_session_manager.go
- registry.go
- registry_common.go
- registry_service_discover.go
- registry_service_register.go
- response.go
- router.go
- tcpclient.go
- user.go
- wsclient.go
Click to show internal directories.
Click to hide internal directories.