Versions in this module Expand all Collapse all v0 v0.1.0 Aug 17, 2018 Changes in this version + const ACCOUNT_KEY_FMT + const RANK_KEY_FMT + const SESSION_KEY_FMT + const SUBKEY_KEY_FMT + func AddTokenContext(next http.Handler) http.Handler + func Address(message string, signature string) (string, error) + func Compact(inputs ...interface{}) ([]byte, error) + func Hash(message string) []byte + func IToB(data interface{}) ([]byte, error) + type Code int + const ERROR + const INIT + const MATCH_VERIFIED + const MSG + const SIGNED_TIMESTAMP + const TERMINATE + const UNSUBSCRIBE + type InitMessage struct + Timestamp int64 + type MatchResponse struct + Account common.Address + Rank uint32 + type Message struct + Payload string + func NewError(message string) Message + func NewTerminateMessage(message string) Message + type Meta struct + Code Code + Index uint8 + SubKey *common.Address + type PlayerInfo struct + Account *common.Address + Index uint8 + Rank uint32 + SeedHash []byte + TimestampSig *crypto.Signature + Verified bool + type PubSubManager struct + Channels map[string]chan *Message + func NewPubSubManager(smgr *SessionManager) *PubSubManager + func (mgr *PubSubManager) Publish(channel string, msg Message) error + func (mgr *PubSubManager) Subscribe(key string, channel chan *Message) + func (mgr *PubSubManager) Unsubscribe(key string) + type Service struct + ArcClient *arcadeum.Client + Config *config.MatcherConfig + ENV *config.ENVConfig + func NewService(env *config.ENVConfig, cfg *config.MatcherConfig, ethcfg *config.ETHConfig, ...) *Service + func (s *Service) AddToMatchPool(r *MatchResponse) error + func (s *Service) Authenticate(token *Token) (*MatchResponse, error) + func (s *Service) BuildPlayerInfo(p *MatchResponse) (*PlayerInfo, error) + func (s *Service) Close(message string, p ...*MatchResponse) + func (s *Service) CreateSession(p *MatchResponse) (*Session, error) + func (s *Service) FindMatch(token *Token) + func (s *Service) HandleMatchResponses() + func (s *Service) InitGame(uid UUID, r *MatchResponse) error + func (s *Service) Match(rp *MatchResponse) + func (s *Service) NewKeyedTransactor() *bind.TransactOpts + func (s *Service) OnMessage(msg *Message) error + func (s *Service) OnWithdrawalStarted(event *arcadeum.ArcadeumWithdrawalStarted) + func (s *Service) PublishToSubKey(subKey *common.Address, message Message) error + func (s *Service) Reconnect(token *Token) (bool, error) + func (s *Service) RemoveFromWaitingPool(resps ...*MatchResponse) + func (s *Service) RequestTimestampProof(sess *Session) error + func (s *Service) SendTimestampProof(p *PlayerInfo, timestamp int64) error + func (s *Service) SubscribeToSubKey(subkey *common.Address, messages chan *Message) + func (s *Service) VerifyTimestamp(req *arcadeum.VerifyTimestampRequest, player *PlayerInfo) (bool, error) + func (srv *Service) BeginVerifiedMatch(sess *Session) error + func (srv *Service) BuildMatchVerifiedMessageWithSignature(s *Session) (*arcadeum.MatchVerifiedMessage, error) + func (srv *Service) PrivKey() *ecdsa.PrivateKey + func (srv *Service) Sign(inputs ...interface{}) ([]byte, error) + func (srv *Service) SignElliptic(inputs ...interface{}) (r, s *big.Int, err error) + type Session struct + GameID uint32 + ID UUID + Player1 *PlayerInfo + Player2 *PlayerInfo + Signature *crypto.Signature + Timestamp int64 + func (s *Session) FindOpponent(subKey *common.Address) *PlayerInfo + func (s *Session) FindPlayerByAccount(account common.Address) (*PlayerInfo, error) + func (s *Session) FindPlayerBySubKey(subKey *common.Address) *PlayerInfo + func (s *Session) IsEmpty() bool + func (s *Session) IsVerified() bool + func (s *Session) IsWaiting() bool + func (s *Session) Rank() uint32 + func (s *Session) UUID() string + type SessionManager struct + RedisClient *redis.Client + SessionPool map[UUID]*Session + func NewSessionManager(rediscfg *config.RedisConfig) *SessionManager + func (mgr *SessionManager) AddToMatchPool(sess *Session) error + func (mgr *SessionManager) GetSessionByAccount(key *common.Address) (*Session, error) + func (mgr *SessionManager) GetSessionByID(uid UUID) (*Session, error) + func (mgr *SessionManager) GetSessionBySubKey(key *common.Address) (*Session, error) + func (mgr *SessionManager) ReaddToMatchPool(rank uint32, uid UUID) error + func (mgr *SessionManager) TakeRandomSessionByRank(rank uint32) (UUID, error) + func (mgr *SessionManager) UpdateSession(sess *Session) error + type Status int + const Disqualified + const Lost + const Moving + const Unknown + const Waiting + const Won + type Token struct + GameID uint32 + Seed []byte + SubKey *common.Address + SubKeySignature *crypto.Signature + func Context(r *http.Request) *Token + type UUID string + func (u UUID) IsEmpty() bool