cmd

package
v0.0.0-...-94cfe0a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AppName = "Super Catfacts Service"

AppName is the common human legible name for this service

Functions

func Execute

func Execute()

Execute - application entrypoint

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) Initialize

func (a *AttackManager) Initialize()

Initialize loads Catfacts

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

type HealthCheckResponse struct {
	Heartbeat      time.Time `json:heartbeat`
	RunningAttacks int
}

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

type StatusResponse struct {
	AttackCount int
	Targets     []string
}

StatusResponse encodes information about currently running attacks and their targets

type TwilioConfiguration

type TwilioConfiguration struct {
	Number             string
	APIKey             string
	SID                string
	MsgIntervalSeconds int
}

TwilioConfiguration contains all the Twilio account info needed to run attacks

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL