Documentation ¶
Index ¶
- Variables
- func GetAPIKeyCode(platformID int, platformUserId string) string
- func GetAPIKeyName(worldPerspective *int, platformID int, platformUserId string) string
- func GetActiveBan(bans []api.Ban) *api.Ban
- func GetBan(acc *orm.Account) *orm.Ban
- func GetOrInsertUser(tx bun.Tx, platformID int, platformUserID string) (*api.User, error)
- func GrantEphemeralWorldAssignment(tx bun.Tx, userID int64, world int, until time.Time) (err error, userErr error)
- func NormalizedWorldName(worldID int) string
- func SetOrReplacePlatformLink(idb bun.IDB, platformID int, platformUserID string, primary bool, userID int64) (err error)
- type BanService
- type EventEmitter
- func (em *EventEmitter) Emit(user *api.User)
- func (em *EventEmitter) GetStatusListener(id string, platformID *int, worldPerspective int) chan *api.VerificationStatus
- func (em *EventEmitter) GetUserListener(id string, platformID *int) chan *api.User
- func (em *EventEmitter) Process(oldUser *api.User, newUser *api.User)
- func (em *EventEmitter) ShouldEmitAccount(oldAccount *api.Account, newAccount *api.Account) bool
- func (em *EventEmitter) ShouldEmitAccounts(oldAccounts []api.Account, newAccounts []api.Account) bool
- func (em *EventEmitter) ShouldEmitEphemeralAssociations(olds []api.EphemeralAssociation, news []api.EphemeralAssociation) bool
- type LinkedWorlds
- type UserEventListener
- type Verification
- type VerificationStatusListener
- type World
- type Worlds
Constants ¶
This section is empty.
Variables ¶
var (
ErrWorldsNotSynced worldSyncError = errors.New("worlds are not synched")
)
Errors raised.
var PlatformPollListeners map[int]VerificationStatusListener = make(map[int]VerificationStatusListener)
var WorldNames = map[int]World{
1001: {1001, "Anvil Rock"},
1002: {1002, "Borlis Pass"},
1003: {1003, "Yak's Bend"},
1004: {1004, "Henge of Denravi"},
1005: {1005, "Maguuma"},
1006: {1006, "Sorrow's Furnace"},
1007: {1007, "Gate of Madness"},
1008: {1008, "Jade Quarry"},
1009: {1009, "Fort Aspenwood"},
1010: {1010, "Ehmry Bay"},
1011: {1011, "Stormbluff Isle"},
1012: {1012, "Darkhaven"},
1013: {1013, "Sanctum of Rall"},
1014: {1014, "Crystal Desert"},
1015: {1015, "Isle of Janthir"},
1016: {1016, "Sea of Sorrows"},
1017: {1017, "Tarnished Coast"},
1018: {1018, "Northern Shiverpeaks"},
1019: {1019, "Blackgate"},
1020: {1020, "Ferguson's Crossing"},
1021: {1021, "Dragonbrand"},
1022: {1022, "Kaineng"},
1023: {1023, "Devona's Rest"},
1024: {1024, "Eredon Terrace"},
2001: {2001, "Fissure of Woe"},
2002: {2002, "Desolation"},
2003: {2003, "Gandara"},
2004: {2004, "Blacktide"},
2005: {2005, "Ring of Fire"},
2006: {2006, "Underworld"},
2007: {2007, "Far Shiverpeaks"},
2008: {2008, "Whiteside Ridge"},
2009: {2009, "Ruins of Surmia"},
2010: {2010, "Seafarer's Rest"},
2011: {2011, "Vabbi"},
2012: {2012, "Piken Square"},
2013: {2013, "Aurora Glade"},
2014: {2014, "Gunnar's Hold"},
2101: {2101, "Jade Sea [FR]"},
2102: {2102, "Fort Ranik [FR]"},
2103: {2103, "Augury Rock [FR]"},
2104: {2104, "Vizunah Square [FR]"},
2105: {2105, "Arborstone [FR]"},
2201: {2201, "Kodash [DE]"},
2202: {2202, "Riverside [DE]"},
2203: {2203, "Elona Reach [DE]"},
2204: {2204, "Abaddon's Mouth [DE]"},
2205: {2205, "Drakkar Lake [DE]"},
2206: {2206, "Miller's Sound [DE]"},
2207: {2207, "Dzagonur [DE]"},
2301: {2301, "Baruch Bay [SP]"},
}
WorldNames is a hardcoded list of all world id's and its respective world representation object
Functions ¶
func GetAPIKeyCode ¶
GetAPIKeyCode creates a 16 character MD5 hash based on the platformUserId The hash doesn't need to be secure, so don't worry about it being MD5
func GetAPIKeyName ¶
GetAPIKeyName creates a 16 character MD5 hash based on the platformUserId The hash doesn't need to be secure, so don't worry about it being MD5 Additionally it prefixes the apikey prefix, along with the service id, if it is above 0
func GetActiveBan ¶
GetActiveBan returns the longest active ban on an account, if they have any
func GetOrInsertUser ¶
func GrantEphemeralWorldAssignment ¶
func GrantEphemeralWorldAssignment(tx bun.Tx, userID int64, world int, until time.Time) (err error, userErr error)
GrantEphemeralWorldAssignment temporarily mark the account as being from the given world This will grant the user temporary access, if they are set to be a from a world that would normally grant access
func NormalizedWorldName ¶
NormalizedWorldName returns the string representation of the world by its id
Types ¶
type BanService ¶
type BanService struct {
// contains filtered or unexported fields
}
func NewBanService ¶
func NewBanService(em *EventEmitter) *BanService
func (*BanService) BanServiceUser ¶
func (bs *BanService) BanServiceUser(expiration time.Time, reason string, platformID int, platformUserId string) error
BanServiceUser bans a user's gw2 account for the given duration
type EventEmitter ¶
type EventEmitter struct {
// contains filtered or unexported fields
}
func NewEventEmitter ¶
func NewEventEmitter(verification *Verification) *EventEmitter
func (*EventEmitter) Emit ¶
func (em *EventEmitter) Emit(user *api.User)
func (*EventEmitter) GetStatusListener ¶
func (em *EventEmitter) GetStatusListener(id string, platformID *int, worldPerspective int) chan *api.VerificationStatus
func (*EventEmitter) GetUserListener ¶
func (em *EventEmitter) GetUserListener(id string, platformID *int) chan *api.User
func (*EventEmitter) Process ¶
func (em *EventEmitter) Process(oldUser *api.User, newUser *api.User)
func (*EventEmitter) ShouldEmitAccount ¶
func (*EventEmitter) ShouldEmitAccounts ¶
func (*EventEmitter) ShouldEmitEphemeralAssociations ¶
func (em *EventEmitter) ShouldEmitEphemeralAssociations(olds []api.EphemeralAssociation, news []api.EphemeralAssociation) bool
type LinkedWorlds ¶
type LinkedWorlds map[string]api.WorldLinks
type UserEventListener ¶
type Verification ¶
type Verification struct {
// contains filtered or unexported fields
}
func NewVerification ¶
func NewVerification(worlds *Worlds) *Verification
func (*Verification) AccountStatus ¶
AccountStatus checks the verification api.ACCESS status for an account given a world perspective
func (*Verification) AccountWorldStatus ¶
type Worlds ¶
type Worlds struct {
// contains filtered or unexported fields
}
func (*Worlds) GetAllWorldLinks ¶
func (ws *Worlds) GetAllWorldLinks() LinkedWorlds