Documentation
¶
Index ¶
- type LoadBalancer
- func (lb *LoadBalancer) NodeAddrsByGeo(domain string, lat, lng float64, overseas, ipv6 bool) (domains, addrs []string)
- func (lb *LoadBalancer) NodeAddrsByRegion(region, domain string, regionWeight float64, overseas, ipv6 bool) (domains, addrs []string)
- func (lb *LoadBalancer) NodeDetails(region string, regionWeight float64) (res []map[string]interface{})
- func (lb *LoadBalancer) Size() int
- func (lb *LoadBalancer) Update(srvs []*model.ServerInfo)
- type ServerBackoff
- type ServerConfig
- type Service
- func (s *Service) Close()
- func (s *Service) Connect(c context.Context, server, serverKey, cookie string, token []byte) (mid int64, key, roomID string, paltform string, accepts []int32, err error)
- func (s *Service) Disconnect(c context.Context, mid int64, key, server string) (has bool, err error)
- func (s *Service) Heartbeat(c context.Context, mid int64, key, server string) (err error)
- func (s *Service) OnlineRoom(c context.Context, business string, rooms []string) (res map[string]int32, err error)
- func (s *Service) OnlineTop(c context.Context, business string, n int) (tops []*model.Top, err error)
- func (s *Service) OnlineTotal(c context.Context) (int64, int64)
- func (s *Service) Ping(c context.Context) (err error)
- func (s *Service) PushAll(c context.Context, op, speed int32, msg, platform string, contentType int32) (err error)
- func (s *Service) PushKeys(c context.Context, op int32, keys []string, msg string, contentType int32) (err error)
- func (s *Service) PushMids(c context.Context, op int32, mids []int64, msg string, contentType int32) (err error)
- func (s *Service) PushRoom(c context.Context, op int32, room, msg string, contentType int32) (err error)
- func (s *Service) Receive(c context.Context, mid int64, proto *model.Proto) (err error)
- func (s *Service) RenewOnline(c context.Context, server string, shard int32, roomCount map[string]int32) (mergedRoomCount map[string]int32, err error)
- func (s *Service) ServerInfos(c context.Context) (res []*model.ServerInfo, err error)
- func (s *Service) ServerList(c context.Context, platform string) *pb.ServerListReply
- func (s *Service) ServerWeight(c context.Context, clientIP string) (interface{}, string, string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LoadBalancer ¶
type LoadBalancer struct {
// contains filtered or unexported fields
}
LoadBalancer load balancer.
func (*LoadBalancer) NodeAddrsByGeo ¶
func (lb *LoadBalancer) NodeAddrsByGeo(domain string, lat, lng float64, overseas, ipv6 bool) (domains, addrs []string)
NodeAddrsByGeo return node addrs by geo.
func (*LoadBalancer) NodeAddrsByRegion ¶
func (lb *LoadBalancer) NodeAddrsByRegion(region, domain string, regionWeight float64, overseas, ipv6 bool) (domains, addrs []string)
NodeAddrsByRegion return node addrs.
func (*LoadBalancer) NodeDetails ¶
func (lb *LoadBalancer) NodeDetails(region string, regionWeight float64) (res []map[string]interface{})
NodeDetails return nodes.
func (*LoadBalancer) Update ¶
func (lb *LoadBalancer) Update(srvs []*model.ServerInfo)
Update update server nodes.
type ServerBackoff ¶
ServerBackoff server backoff config.
type ServerConfig ¶
type ServerConfig struct { Domain string HostDomain string TCPPort int WSPort int WSSPort int HeartbeatMax int Heartbeat xtime.Duration RegionWeight float64 }
ServerConfig server config.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service struct
func (*Service) Connect ¶
func (s *Service) Connect(c context.Context, server, serverKey, cookie string, token []byte) (mid int64, key, roomID string, paltform string, accepts []int32, err error)
Connect connect a conn.
func (*Service) Disconnect ¶
func (s *Service) Disconnect(c context.Context, mid int64, key, server string) (has bool, err error)
Disconnect disconnect a conn.
func (*Service) OnlineRoom ¶
func (s *Service) OnlineRoom(c context.Context, business string, rooms []string) (res map[string]int32, err error)
OnlineRoom get rooms online.
func (*Service) OnlineTop ¶
func (s *Service) OnlineTop(c context.Context, business string, n int) (tops []*model.Top, err error)
OnlineTop get the top online.
func (*Service) OnlineTotal ¶
OnlineTotal get all online.
func (*Service) PushAll ¶
func (s *Service) PushAll(c context.Context, op, speed int32, msg, platform string, contentType int32) (err error)
PushAll push a message to all.
func (*Service) PushKeys ¶
func (s *Service) PushKeys(c context.Context, op int32, keys []string, msg string, contentType int32) (err error)
PushKeys push a message by keys.
func (*Service) PushMids ¶
func (s *Service) PushMids(c context.Context, op int32, mids []int64, msg string, contentType int32) (err error)
PushMids push a message by mid.
func (*Service) PushRoom ¶
func (s *Service) PushRoom(c context.Context, op int32, room, msg string, contentType int32) (err error)
PushRoom push a message by room.
func (*Service) RenewOnline ¶
func (s *Service) RenewOnline(c context.Context, server string, shard int32, roomCount map[string]int32) (mergedRoomCount map[string]int32, err error)
RenewOnline renew a server online.
func (*Service) ServerInfos ¶
ServerInfos get servers info.
func (*Service) ServerList ¶
ServerList get server list.
Click to show internal directories.
Click to hide internal directories.