Documentation ¶
Index ¶
- Variables
- func Execute()
- func GetAttacks(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func HealthCheck(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func StopAttack(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- type Attack
- type AttackManager
- func (a *AttackManager) Add(atk *Attack) (*Attack, error)
- func (a *AttackManager) GetCurrentRunningAttackCount() int
- func (a *AttackManager) Initialize()
- func (a *AttackManager) List() []*Attack
- func (a *AttackManager) Lookup(t string) (bool, error)
- func (a *AttackManager) Remove(t string) (bool, *Attack)
- func (a *AttackManager) RemoveByID(id int) (bool, *Attack)
- func (a *AttackManager) Run()
- type AttackResponse
- type Catfacts
- type Configuration
- type HealthCheckResponse
- type ServerConfiguration
- type StatusResponse
- type TwilioConfiguration
Constants ¶
This section is empty.
Variables ¶
var AppName = "Super Catfacts Service"
AppName is the common human legible name for this service
Functions ¶
func GetAttacks ¶
func GetAttacks(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
GetAttacks returns a JSON representation of all currently running attacks
func HealthCheck ¶
func HealthCheck(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
HealthCheck returns a simple ping-like response
func StopAttack ¶
func StopAttack(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
StopAttack cancels a running attack after looking it up by its unique ID
Types ¶
type Attack ¶
type Attack struct { ID int `json:id` Target string `json:target` StartTime time.Time `json:starttime` MsgCount int `json:msgcount` }
Attack represents a currently running prank against a target phone number
type AttackManager ¶
type AttackManager struct {
// contains filtered or unexported fields
}
AttackManager is a client for starting, stopping and tracking attacks
func (*AttackManager) Add ¶
func (a *AttackManager) Add(atk *Attack) (*Attack, error)
Add commences a new attack
func (*AttackManager) GetCurrentRunningAttackCount ¶
func (a *AttackManager) GetCurrentRunningAttackCount() int
GetCurrentRunningAttackCount returns the number of attacks in progress
func (*AttackManager) List ¶
func (a *AttackManager) List() []*Attack
List dumps all current attacks
func (*AttackManager) Lookup ¶
func (a *AttackManager) Lookup(t string) (bool, error)
Lookup attempts to fetch one attack by target
func (*AttackManager) Remove ¶
func (a *AttackManager) Remove(t string) (bool, *Attack)
Remove terminates an existing attack
func (*AttackManager) RemoveByID ¶
func (a *AttackManager) RemoveByID(id int) (bool, *Attack)
RemoveByID stops an in progress attack
func (*AttackManager) Run ¶
func (a *AttackManager) Run()
Run commences the attack processing subroutine
type AttackResponse ¶
type AttackResponse struct { ID int `json:id` Target string `json:target` StartTime time.Time `json:starttime` MsgCount int `json:msgcount` }
AttackResponse is a pared down representation of an attack suitable for JSON serialization, etc
type Catfacts ¶
type Catfacts struct {
Facts []string
}
Catfacts is a slice holding fun facts about cats
type Configuration ¶
type Configuration struct { Server ServerConfiguration Twilio TwilioConfiguration }
Configuration is the struct that your config.yml file gets marshalled to
var Config Configuration
Config is the central configuration object
type HealthCheckResponse ¶
HealthCheckResponse is returned as a sanity check when checking your service is up
type ServerConfiguration ¶
type ServerConfiguration struct { FQDN string CatfactsUser string CatfactsPassword string Port string Admins []string }
ServerConfiguration contains all the info needed to administer your Catfacts service
type StatusResponse ¶
StatusResponse encodes information about currently running attacks and their targets