Documentation ¶
Overview ¶
Package zkillredisqo provides a lightweight library for interfacing with zKillboard's RedisQ service for receiving killmails in realtime. The library allows for applications to wait for new kills using a channel. Errors are handed off to the calling app via a separate error channel.
Index ¶
Constants ¶
const ( // Version of zkillredisqo library Version = "1.0.2" // DefaultUserAgent defines a user agent to use for HTTP requests if separate one is specified by the user DefaultUserAgent = "zkillredisqo v" + Version + " - github.com/morpheusxaut/zkillredisqo" // ZKillRedisQURL defines the URL of zKillboard's RedisQ service ZKillRedisQURL = "https://redisq.zkillboard.com/listen.php" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Kill ¶
type Kill struct {
KillPackage `json:"package"`
}
Kill represents a kill as available on zKillboard
func (*Kill) IsNullKill ¶
IsNullKill checks whether a kill is an empty "null" kill
type KillMail ¶
type KillMail struct { ID int `json:"killID"` Time KillMailTime `json:"killTime"` SolarSystem KillMailCommonAttributes `json:"solarSystem"` Attackers []KillMailAttacker `json:"attackers"` AttackerCount int `json:"attackerCount"` Victim KillMailVictim `json:"victim"` War struct { ID int `json:"id"` HRef string `json:"href"` } `json:"war"` }
KillMail stores the actual information about an EVE killmail
type KillMailAttacker ¶
type KillMailAttacker struct { Character KillMailCommonAttributes `json:"character"` Corporation KillMailCommonAttributes `json:"corporation"` Alliance KillMailCommonAttributes `json:"alliance"` Faction KillMailCommonAttributes `json:"faction"` Ship KillMailCommonAttributes `json:"shipType"` Weapon KillMailCommonAttributes `json:"weaponType"` DamageDone int `json:"damageDone"` FinalBlow bool `json:"finalBlow"` SecurityStatus float64 `json:"securityStatus"` }
KillMailAttacker represents information about a single attacking party
type KillMailCommonAttributes ¶
type KillMailCommonAttributes struct { ID int `json:"id"` Name string `json:"name"` HRef string `json:"href"` Icon struct { HRef string `json:"href"` } `json:"icon"` }
KillMailCommonAttributes represents information being reused for multiple parts of a killmail such as corporations, characters or ship types
type KillMailItem ¶
type KillMailItem struct { Item KillMailCommonAttributes `json:"itemType"` QuantityDropped int `json:"quantityDropped"` QuantityDestroyed int `json:"quantityDestroyed"` Flag int `json:"flag"` Singleton int `json:"singleton"` }
KillMailItem represents information about a single item included in a kill, either dropped or destroyed
type KillMailTime ¶
KillMailTime is used to allow for proper time parsing from JSON
func (*KillMailTime) UnmarshalJSON ¶
func (t *KillMailTime) UnmarshalJSON(buf []byte) error
UnmarshalJSON tries to parse a timestamp provided by RedisQ to a Go time type
type KillMailVictim ¶
type KillMailVictim struct { Character KillMailCommonAttributes `json:"character"` Corporation KillMailCommonAttributes `json:"corporation"` Alliance KillMailCommonAttributes `json:"alliance"` Faction KillMailCommonAttributes `json:"faction"` Ship KillMailCommonAttributes `json:"shipType"` DamageTaken int `json:"damageTaken"` Items []KillMailItem `json:"items"` Position struct { X float64 `json:"x"` Y float64 `json:"y"` Z float64 `json:"z"` } }
KillMailVictim represents information about the victim of a kill
type KillPackage ¶
type KillPackage struct { ID int `json:"killID"` KillMail KillMail `json:"killmail"` ZKillboard ZKillboardAttributes `json:"zkb"` }
KillPackage represents the "package" layer kills are wrap in by RedisQ
type Poller ¶
type Poller struct { // Kills will receive all parsed kills as they are received from zKillboard Kills chan *Kill // Errors will receive any error encountered while retrieving or parsing kills Errors chan error // contains filtered or unexported fields }
Poller allows for polling of Kills from zKillboard's RedisQ service
func (*Poller) SetTimeToWait ¶
SetTimeToWait adjusts the timeToWait value passed to RedisQ
func (*Poller) SetUserAgent ¶
SetUserAgent allows for a custom user agent to be configured
func (*Poller) Stop ¶
func (p *Poller) Stop()
Stop notifies the poller to stop its loop after the next iteration
func (*Poller) StopAndWait ¶
func (p *Poller) StopAndWait()
StopAndWait notifies the poller to stop and waits for all requests to finish
type ZKillboardAttributes ¶
type ZKillboardAttributes struct { TotalValue float64 `json:"totalValue"` Points int `json:"points"` LocationID int `json:"locationID"` Hash string `json:"hash"` HRef string `json:"href"` }
ZKillboardAttributes stores additional information regarding the kill, provided by zKillboard