Documentation ¶
Index ¶
- Constants
- func AddToChatMemberList(agent TelegramID, chat TelegramID) error
- func ChatToTeam(chat int64) (TeamID, OperationID, error)
- func Connect(ctx context.Context, uri string) error
- func Disconnect()
- func DrawInsert(ctx context.Context, o *Operation, gid GoogleID) error
- func DrawUpdate(ctx context.Context, o *Operation, gid GoogleID) error
- func FirebaseBroadcastList() ([]string, error)
- func GenerateSafeName() (string, error)
- func IngressName(g messaging.GoogleID) string
- func IsChatMember(agent TelegramID, chat TelegramID) bool
- func LoadRevokedJWT() *util.Safemap
- func LocationClean()
- func NewMarkerType(old MarkerType) string
- func RemoveFirebaseToken(token string) error
- func RemoveFromChatMemberList(agent TelegramID, chat TelegramID) error
- func RocksToDB(a *RocksAgent) error
- func StoreRevokedJWT(r *util.Safemap)
- func VTeamExists(vteam int64, vrole uint8, gid GoogleID) (bool, error)
- func VToDB(a *VAgent) error
- type AdOperation
- type AdTeam
- type Agent
- type AgentID
- type AgentLocation
- type Attribute
- type AttributeID
- type DefensiveKey
- type DefensiveKeyList
- type GoogleID
- func (gid GoogleID) AgentInTeam(team TeamID) (bool, error)
- func (gid GoogleID) ClearCommunityName() error
- func (gid GoogleID) Delete() error
- func (gid GoogleID) FirebaseLocationTokens() ([]TeamToken, error)
- func (gid GoogleID) FirstLogin() error
- func (gid GoogleID) GetAgent() (*Agent, error)
- func (gid GoogleID) GetAgentLocations() ([]AgentLocation, error)
- func (gid GoogleID) GetFirebaseTokens() ([]string, error)
- func (gid GoogleID) GetPicture() string
- func (gid GoogleID) GetVAPIkey() (string, error)
- func (gid GoogleID) Gid() (GoogleID, error)
- func (gid GoogleID) IngressName() (string, error)
- func (gid GoogleID) InsertDefensiveKey(dk DefensiveKey) error
- func (gid GoogleID) IntelSmurf() bool
- func (gid GoogleID) ListDefensiveKeys() (DefensiveKeyList, error)
- func (gid GoogleID) Lock(reason string) error
- func (gid GoogleID) NewTeam(name string) (TeamID, error)
- func (gid GoogleID) OwnsTeam(teamID TeamID) (bool, error)
- func (gid GoogleID) RISC() bool
- func (gid GoogleID) RemoveAllFirebaseTokens() error
- func (gid GoogleID) RemoveTelegramID() error
- func (gid GoogleID) SetCommunityName(name string) error
- func (gid GoogleID) SetIntelData(name, faction string) error
- func (gid GoogleID) SetLocation(lat, lon string) error
- func (gid GoogleID) SetTeamState(teamID TeamID, state bool) error
- func (gid GoogleID) SetTelegramID(tgid TelegramID, name string) error
- func (gid GoogleID) SetVAPIkey(key string) error
- func (gid GoogleID) SetWDLoad(teamID TeamID, state bool) error
- func (gid GoogleID) SetWDShare(teamID TeamID, state bool) error
- func (gid GoogleID) StoreFirebaseToken(token string) error
- func (gid GoogleID) String() string
- func (gid GoogleID) TeamListEnabled() []TeamID
- func (gid GoogleID) TelegramID() (TelegramID, error)
- func (gid GoogleID) TelegramName() (string, error)
- func (gid GoogleID) Unlock(reason string) error
- func (gid GoogleID) UpdatePicture(picurl string) error
- func (gid GoogleID) Valid() bool
- type IntelFaction
- type KeyOnHand
- type Link
- type LinkID
- type Marker
- type MarkerID
- type MarkerType
- type OneTimeToken
- type OpPermRole
- type OpPermission
- type OpStat
- type Operation
- func (o *Operation) AssignedOnlyAccess(gid GoogleID) bool
- func (o *Operation) Delete(gid GoogleID) error
- func (o *Operation) GetLink(linkID LinkID) (*Link, error)
- func (o *Operation) GetMarker(markerID MarkerID) (*Marker, error)
- func (o *Operation) GetTask(taskID TaskID) (*Task, error)
- func (o *Operation) GetTaskByStepNumber(step int16) (UnspecifiedTask, error)
- func (o *Operation) KeyOnHand(gid GoogleID, portalID PortalID, count int32, capsule string) error
- func (o *Operation) LinkOrder(order string) error
- func (o *Operation) MarkerOrder(order string) error
- func (o *Operation) Populate(gid GoogleID) error
- func (o *Operation) PopulateTeams() error
- func (o *Operation) PortalDetails(portalID PortalID, gid GoogleID) (*Portal, error)
- func (o *Operation) ReadAccess(gid GoogleID) (bool, []Zone)
- func (o *Operation) SetInfo(info string, gid GoogleID) error
- func (o *Operation) Touch() (string, error)
- func (o *Operation) WriteAccess(gid GoogleID) bool
- type OperationID
- func (opID OperationID) AddPerm(gid GoogleID, teamID TeamID, perm string, zone Zone) error
- func (opID OperationID) Chown(gid GoogleID, to string) error
- func (opID OperationID) DelPerm(gid GoogleID, teamID TeamID, perm OpPermRole, zone Zone) error
- func (opID OperationID) IsDeletedOp() bool
- func (opID OperationID) IsOwner(gid GoogleID) bool
- func (opID OperationID) PortalComment(portalID PortalID, comment string) error
- func (opID OperationID) PortalHardness(portalID PortalID, hardness string) error
- func (opID OperationID) Rename(gid GoogleID, name string) error
- func (opID OperationID) Stat() (*OpStat, error)
- func (opID OperationID) Teams() ([]TeamID, error)
- func (opID OperationID) Valid() bool
- type Portal
- type PortalID
- type RocksAgent
- type Task
- func (t *Task) Acknowledge() error
- func (t *Task) AddDepend(task TaskID) error
- func (t *Task) Claim(gid GoogleID) error
- func (t *Task) ClearAssignments(tx *sql.Tx) error
- func (t *Task) Complete() error
- func (t *Task) DelDepend(task TaskID) error
- func (t *Task) GetAssignments(tx *sql.Tx) ([]GoogleID, error)
- func (t *Task) GetOrder() int16
- func (t *Task) Incomplete() error
- func (t *Task) IsAssignedTo(gid GoogleID) bool
- func (t *Task) Reject(gid GoogleID) error
- func (t *Task) SetAssignments(gs []GoogleID, tx *sql.Tx) error
- func (t *Task) SetComment(comment string) error
- func (t *Task) SetDelta(delta int) error
- func (t *Task) SetDepends(d []TaskID, tx *sql.Tx) error
- func (t *Task) SetOrder(order int16) error
- func (t *Task) SetZone(z Zone) error
- type TaskID
- type TeamData
- type TeamID
- func (teamID TeamID) AddAgent(in AgentID) error
- func (teamID TeamID) Chown(to AgentID) error
- func (teamID TeamID) Delete() error
- func (teamID TeamID) DeleteJoinToken() error
- func (teamID TeamID) FetchFBTokens() ([]string, error)
- func (teamID TeamID) FetchTeam() (*TeamData, error)
- func (teamID TeamID) GenerateJoinToken() (string, error)
- func (teamID TeamID) JoinToken(gid GoogleID, key string) error
- func (teamID TeamID) LinkToTelegramChat(chat TelegramID, opID OperationID) error
- func (teamID TeamID) Name() (string, error)
- func (teamID TeamID) Operations() ([]OpPermission, error)
- func (teamID TeamID) Owner() (GoogleID, error)
- func (teamID TeamID) RemoveAgent(in AgentID) error
- func (teamID TeamID) Rename(name string) error
- func (teamID TeamID) RocksCommunity() (string, error)
- func (teamID TeamID) RocksKey() (string, error)
- func (teamID TeamID) SetComment(gid GoogleID, comment string) error
- func (teamID TeamID) SetRocks(key, community string) error
- func (teamID TeamID) String() string
- func (teamID TeamID) TelegramChat() (int64, error)
- func (teamID TeamID) UnlinkFromTelegramChat() error
- func (teamID TeamID) VConfigure(vteam int64, role uint8) error
- func (teamID TeamID) VTeam() (int64, uint8, error)
- func (teamID TeamID) Valid() bool
- type TeamMember
- type TeamToken
- type TelegramID
- func (tgid TelegramID) Delete() error
- func (tgid TelegramID) Gid() (GoogleID, error)
- func (tgid TelegramID) GidV() (GoogleID, bool, error)
- func (tgid TelegramID) InitAgent(name string, ott OneTimeToken) error
- func (tgid TelegramID) SetName(name string) error
- func (tgid TelegramID) String() string
- func (tgid TelegramID) UnverifyAgent() error
- func (tgid TelegramID) VerifyAgent(authtoken string) error
- type UnspecifiedTask
- type VAgent
- type Zone
- type ZoneListElement
Constants ¶
const ( ErrAgentNotFound = "agent not registered with this wasabee server" ErrEmptyAgent = "empty agent request" ErrGetLinkUnpopulated = "attempt to use GetLink on unpopulated *Operation" ErrGetMarkerUnpopulated = "attempt to use GetMarker on unpopulated *Operation" ErrInvalidOTT = "invalid OneTimeToken" ErrKeyUnableToRemove = "unable to remove key count for portal" ErrKeyUnableToRecord = "unable to record keys, ensure the op on the server is up-to-date" ErrLinkNotFound = "link not found" ErrMarkerNotFound = "markernot found" ErrOpNotFound = "operation not found" ErrMultipleIntelname = "multiple intelname matches found, not using intelname results" ErrMultipleRocks = "multiple rocks matches found, not using rocks results" ErrMultipleV = "multiple V matches found, not using V results" ErrNameGenFailed = "name generation failed" ErrNotOnTeamAddPerm = "you must be on a team to add it as a permission" ErrNotOpOwner = "not owner of op" ErrPortalNotFound = "portal not found" ErrTaskNotFound = "task not found" ErrUnknownGID = "unknown GoogleID" ErrUnknownPermType = "unknown permission type" ErrUnknownUser = "unknown user" )
These error values are error strings visible to users, they need to be migrated to the translation system
Variables ¶
This section is empty.
Functions ¶
func AddToChatMemberList ¶
func AddToChatMemberList(agent TelegramID, chat TelegramID) error
AddToChatMemberList notes a telegramID has been seen in a given telegram chat
func ChatToTeam ¶
func ChatToTeam(chat int64) (TeamID, OperationID, error)
ChatToTeam takes a chatID and returns a linked teamID
func Connect ¶
Connect tries to establish a connection to a MySQL/MariaDB database under the given URI and initializes the tables if they don"t exist yet.
func Disconnect ¶
func Disconnect()
Disconnect closes the database connection called only at server shutdown
func DrawInsert ¶
DrawInsert parses a raw op sent from the IITC plugin and stores it in the database use ONLY for initial op creation All assignment data and key count data is assumed to be correct
func DrawUpdate ¶
DrawUpdate is called to UPDATE an existing draw Links & Markers are added/removed as necessary -- assignments are properly updated as necessary (including notifications on change) Key count data is left untouched (unless the portal is no longer listed in the portals list). Database is locked per-op, each update runs in an all-or-nothing transaction
func FirebaseBroadcastList ¶
FirebaseBroadcastList returns all known firebase tokens for messaging all agents Firebase Multicast messages are limited to 500 tokens each, the caller must break the list up if necessary.
func GenerateSafeName ¶
GenerateSafeName generates a slug (like GenerateName()) that doesn't exist in the database yet.
func IsChatMember ¶
func IsChatMember(agent TelegramID, chat TelegramID) bool
IsChatMember reports if a given telegramID has been seen in a given telegram chat
func LocationClean ¶
func LocationClean()
LocationClean is called from the background process to remove out-dated agent locations
func NewMarkerType ¶
func NewMarkerType(old MarkerType) string
NewMarkerType is used to change from the old to the new marker type names
func RemoveFirebaseToken ¶
RemoveFirebaseToken removes a given token from the database
func RemoveFromChatMemberList ¶
func RemoveFromChatMemberList(agent TelegramID, chat TelegramID) error
RemoveFromChatMemberList removes the agent from the list for the telegram chat
func VTeamExists ¶
VTeamExists checks if a v-team/role pair exists for a specific googleID
Types ¶
type AdOperation ¶
type AdOperation struct { ID OperationID Name string IsOwner bool Color string TeamID TeamID Modified string LastEditID string }
AdOperation is a sub-struct of Agent
type AdTeam ¶
type AdTeam struct { ID TeamID Name string `json:"Name,omitempty"` RocksComm string `json:"RocksComm,omitempty"` RocksKey string `json:"RocksKey,omitempty"` JoinLinkToken string `json:"JoinLinkToken,omitempty"` LoadWD string Owner GoogleID VTeam int64 `json:"VTeam,omitempty"` VTeamRole uint8 `json:"VTeamRole,omitempty"` }
AdTeam is a sub-struct of Agent
type Agent ¶
type Agent struct { GoogleID GoogleID `json:"GoogleID"` Name string `json:"name,omitempty"` VName string `json:"vname,omitempty"` RocksName string `json:"rocksname,omitempty"` IntelName string `json:"intelname,omitempty"` CommunityName string `json:"communityname,omitempty"` Level uint8 `json:"level,omitempty"` // from v OneTimeToken OneTimeToken `json:"lockey,omitempty"` // historical name, is this used by any clients? VVerified bool `json:"Vverified,omitempty"` VBlacklisted bool `json:"blacklisted,omitempty"` EnlID string `json:"enlid,omitempty"` // clients use this to draw URLs to V profiles RocksVerified bool `json:"rocks,omitempty"` RISC bool `json:"RISC,omitempty"` ProfileImage string `json:"pic,omitempty"` Teams []AdTeam Ops []AdOperation Telegram struct { ID int64 `json:"ID,omitempty"` Name string `json:"name,omitempty"` Verified bool `json:"Verified,omitempty"` Authtoken string `json:"Authtoken,omitempty"` } IntelFaction string `json:"intelfaction,omitempty"` QueryToken string `json:"querytoken,omitempty"` VAPIkey string `json:"vapi,omitempty"` JWT string `json:"jwt,omitempty"` }
Agent is the complete agent struct, used for the /me page.
type AgentLocation ¶
type AgentLocation struct { Gid GoogleID `json:"gid"` Lat float64 `json:"lat"` Lon float64 `json:"lng"` Date string `json:"date"` }
AgentLocation is the lite version used for the team location pull
type Attribute ¶
type Attribute struct { ID AttributeID `json:"ID"` Name string `json:"name"` Value string `json:"value"` }
Attribute is per-marker-type data
type DefensiveKey ¶
type DefensiveKey struct { GID GoogleID `json:"GID"` PortalID PortalID `json:"PortalID"` CapID string `json:"CapID"` Count int32 `json:"Count"` Name string `json:"Name"` Lat string `json:"Lat"` Lon string `json:"Lng"` }
DefensiveKey is a sub-struct of DefensiveKeyList
type DefensiveKeyList ¶
type DefensiveKeyList struct { DefensiveKeys []DefensiveKey Fetched string }
DefensiveKeyList is the list of all defensive keys
type GoogleID ¶
type GoogleID string
GoogleID is the primary location for interfacing with the agent type
func AppleIDtoGID ¶
AppleIDtoGID returns a GoogleID for a given AppleID for now this is very dumb and doesn't try to do anything other than ensure the database doesn't throw an error if we want to manually map
func CommunityNameToGID ¶
CommunityNameToGID takes a community name and returns a GoogleID
func GetGIDFromEnlID ¶
GetGIDFromEnlID looks up an agent's GoogleID by V EnlID
func SearchAgentName ¶
SearchAgentName gets a GoogleID from an Agent's name, searching local name, V name (if known), Rocks name (if known) and telegram name (if known) returns "" on no match
func ToGid ¶
ToGid takes a string and returns a Gid for it -- for reasonable values of a string; it must look like a GoogleID otherwise it defaults to agent name
func (GoogleID) AgentInTeam ¶
AgentInTeam checks to see if a agent is in a team and enabled.
func (GoogleID) ClearCommunityName ¶
ClearCommunityName removes an agent's community name verification
func (GoogleID) FirebaseLocationTokens ¶
FirebaserLocationTokens returns a list all tokens for the agents on the teams with which this agent is sharing location instead of sending to the team topics, we do the fanout manually -- to avoid hitting the (small) fanout quota
func (GoogleID) FirstLogin ¶
FirstLogin sets the required database records for a new agent
func (GoogleID) GetAgentLocations ¶
func (gid GoogleID) GetAgentLocations() ([]AgentLocation, error)
GetAgentLocations is a fast-path to get all available agent locations
func (GoogleID) GetFirebaseTokens ¶
GetFirebaseTokens gets an agents FirebaseToken from the database
func (GoogleID) GetPicture ¶
GetPicture returns the agent's Google Picture URL
func (GoogleID) GetVAPIkey ¶
GetVAPIkey (gid GoogleID) loads an agents's V API key (this should be unusual); "" is "not set"
func (GoogleID) IngressName ¶
IngressName returns an agent's name for a given GoogleID. returns err == sql.ErrNoRows if there is no such agent.
func (GoogleID) InsertDefensiveKey ¶
func (gid GoogleID) InsertDefensiveKey(dk DefensiveKey) error
InsertDefensiveKey adds a new key to the list
func (GoogleID) IntelSmurf ¶
IntelSmurf checks to see if the agent has self-proclaimed to be a smurf (unset is OK)
func (GoogleID) ListDefensiveKeys ¶
func (gid GoogleID) ListDefensiveKeys() (DefensiveKeyList, error)
ListDefensiveKeys gets all keys an agent is authorized to know about.
func (GoogleID) NewTeam ¶
NewTeam initializes a new team and returns a teamID the creating gid is added and enabled on that team by default
func (GoogleID) RemoveAllFirebaseTokens ¶
RemoveAllFirebaseTokens removes all tokens for a given agent
func (GoogleID) RemoveTelegramID ¶
RemoveTelegramID clears any telegram configuration for a given agent
func (GoogleID) SetCommunityName ¶
SetCommunityName sets the name the agent is known as on the Niantic Community -- this is the most trustworthy source of agent identity
func (GoogleID) SetIntelData ¶
SetIntelData sets the untrusted data from IITC - do not depend on these values for authorization but if someone says they are a smurf, who are we to deny their self-identity?
func (GoogleID) SetLocation ¶
SetLocation updates the database to reflect a agent's current location
func (GoogleID) SetTeamState ¶
SetTeamState updates the agent's shareLoc the team
func (GoogleID) SetTelegramID ¶
func (gid GoogleID) SetTelegramID(tgid TelegramID, name string) error
SetTelegramID adds a verified agent's telegram ID
func (GoogleID) SetVAPIkey ¶
SetVAPIkey stores an agent's V API key (this should be unusual)
func (GoogleID) SetWDLoad ¶
SetWDLoad updates the agent's desire to load WD keys from other agents on this team
func (GoogleID) SetWDShare ¶
SetWDShare updates the agent's willingness to share WD keys with other agents on this team
func (GoogleID) StoreFirebaseToken ¶
StoreFirebaseToken adds a token in the database for an agent. gid is not unique, an agent may have any number of tokens (e.g. multiple devices/browsers). Pruning of dead tokens takes place in the senders upon error.
func (GoogleID) TeamListEnabled ¶
TeamListEnabled is used for getting a list of agent's enabled teams
func (GoogleID) TelegramID ¶
func (gid GoogleID) TelegramID() (TelegramID, error)
TelegramID returns a telegram ID number for a gid
func (GoogleID) TelegramName ¶
TelegramName returns a telegram friendly name for a gid
func (GoogleID) UpdatePicture ¶
UpdatePicture sets/updates the agent's google picture URL
type IntelFaction ¶
type IntelFaction int8
IntelFaction is stored as an in in the database
func FactionFromString ¶
func FactionFromString(in string) IntelFaction
FactionFromString takes a string and returns the int
func (IntelFaction) String ¶
func (f IntelFaction) String() string
String returns the string representation of an IntelFaction
type KeyOnHand ¶
type KeyOnHand struct { ID PortalID `json:"portalId"` Gid GoogleID `json:"gid"` Onhand int32 `json:"onhand"` Capsule string `json:"capsule"` }
KeyOnHand describes the already in possession for the op
type Link ¶
type Link struct { ID LinkID `json:"ID"` From PortalID `json:"fromPortalId"` To PortalID `json:"toPortalId"` Desc string `json:"description"` // deprecated, use Comment from Task AssignedTo GoogleID `json:"assignedTo"` // deprecated, use Assignments from Task ThrowOrder int16 `json:"throwOrderPos"` // deprecated, use Order from Task Completed bool `json:"completed"` // deprecated, use State from Task Color string `json:"color"` MuCaptured int `json:"mu"` Task }
Link is the basic link data structure
type Marker ¶
type Marker struct { ID MarkerID `json:"ID"` PortalID PortalID `json:"portalId"` Type MarkerType `json:"type"` AssignedTo GoogleID `json:"assignedTo,omitempty"` // deprecated, use Assignments from Task Attributes []Attribute `json:"attributes,omitempty"` Task }
Marker is defined by the Wasabee IITC plugin.
type MarkerType ¶
type MarkerType string
MarkerType will be an enum once we figure out the full list
func (MarkerType) String ¶
func (m MarkerType) String() string
String returns the string version of a PortalID
type OneTimeToken ¶
type OneTimeToken string
OneTimeToken - used to authenticate users in IITC when GAPI doesn't work for them
func (OneTimeToken) Gid ¶
func (ott OneTimeToken) Gid() (GoogleID, error)
Gid converts a location share key to a agent's gid
func (OneTimeToken) Increment ¶
func (ott OneTimeToken) Increment() (GoogleID, error)
Increment "uses" the OTT and returns a googleID, replacing the agent's OTT in the databse
type OpPermRole ¶
type OpPermRole string
OpPermRole is just a convenience class for the permission string
func (OpPermRole) Valid ¶
func (perm OpPermRole) Valid() bool
Valid checks to make sure the OpPermRole is one of the valid options
type OpPermission ¶
type OpPermission struct { OpID OperationID `json:"opid"` TeamID TeamID `json:"teamid"` Role OpPermRole `json:"role"` Zone Zone `json:"zone"` }
OpPermission is the form of permission
type OpStat ¶
type OpStat struct { ID OperationID `json:"ID"` Name string `json:"name"` Gid GoogleID `json:"creator"` Modified string `json:"modified"` // time.RFC1123 format LastEditID string `json:"lasteditid"` }
OpStat is a minimal struct to determine if the op has been updated
type Operation ¶
type Operation struct { ID OperationID `json:"ID"` // 40-char string Name string `json:"name"` // freeform Gid GoogleID `json:"creator"` // IITC plugin sends agent name on first upload, we convert to GID Color string `json:"color"` // now free-form OpPortals []Portal `json:"opportals"` Anchors []PortalID `json:"anchors"` // We should let the clients build this themselves Links []Link `json:"links"` // Blockers []Link `json:"blockers"` // ignored by Wasabee-Server -- do not store this Markers []Marker `json:"markers"` Teams []OpPermission `json:"teamlist"` Modified string `json:"modified"` // time.RFC1123 format LastEditID string `json:"lasteditid"` // 40-char string, generated by Touch() ReferenceTime string `json:"referencetime"` // time.RFC1123 format Comment string `json:"comment"` Keys []KeyOnHand `json:"keysonhand"` Fetched string `json:"fetched"` // time.RFC1123 format Zones []ZoneListElement `json:"zones"` }
Operation is defined by the Wasabee IITC plugin. It is the top level item in the JSON file.
func (*Operation) AssignedOnlyAccess ¶
AssignedOnlyAccess verifies if an agent has AO access to an op
func (*Operation) GetTaskByStepNumber ¶
func (o *Operation) GetTaskByStepNumber(step int16) (UnspecifiedTask, error)
GetTaskByStepNumber returns a task based on it's operation position if multiple tasks share one step number, the results are non-deterministic
func (*Operation) MarkerOrder ¶
MarkerOrder changes the order of the tasks for an operation
func (*Operation) Populate ¶
Populate takes a pointer to an Operation and fills it in; o.ID must be set checks to see that either the gid created the operation or the gid is on the team assigned to the operation
func (*Operation) PopulateTeams ¶
PopulateTeams loads the permissions from the database into the op data
func (*Operation) PortalDetails ¶
PortalDetails returns information about the portal does access checking (cached)
func (*Operation) ReadAccess ¶
ReadAccess determines if an agent has read acces to an op, if zone limitations are present, return those as well
func (*Operation) WriteAccess ¶
WriteAccess determines if an agent has write access to an op
type OperationID ¶
type OperationID string
OperationID wrapper to ensure type safety
func (OperationID) Chown ¶
func (opID OperationID) Chown(gid GoogleID, to string) error
Chown changes an operation's owner
func (OperationID) DelPerm ¶
func (opID OperationID) DelPerm(gid GoogleID, teamID TeamID, perm OpPermRole, zone Zone) error
DelPerm removes a permission from an op
func (OperationID) IsDeletedOp ¶
func (opID OperationID) IsDeletedOp() bool
IsDeletedOp reports back if a particular op has been deleted
func (OperationID) IsOwner ¶
func (opID OperationID) IsOwner(gid GoogleID) bool
IsOwner returns a bool value determining if the operation is owned by the specified googleID
func (OperationID) PortalComment ¶
func (opID OperationID) PortalComment(portalID PortalID, comment string) error
PortalComment updates the comment on a portal
func (OperationID) PortalHardness ¶
func (opID OperationID) PortalHardness(portalID PortalID, hardness string) error
PortalHardness updates the comment on a portal
func (OperationID) Rename ¶
func (opID OperationID) Rename(gid GoogleID, name string) error
Rename changes an op's name
func (OperationID) Stat ¶
func (opID OperationID) Stat() (*OpStat, error)
Stat returns useful info on an operation
func (OperationID) Teams ¶
func (opID OperationID) Teams() ([]TeamID, error)
Teams returns a list of every team with access to this operation
func (OperationID) Valid ¶
func (opID OperationID) Valid() bool
type Portal ¶
type Portal struct { ID PortalID `json:"id"` Name string `json:"name"` Lat string `json:"lat"` // passing these as strings saves me parsing them Lon string `json:"lng"` Comment string `json:"comment"` Hardness string `json:"hardness"` // string for now, enum in the future // contains filtered or unexported fields }
Portal is defined by the Wasabee IITC plugin.
type RocksAgent ¶
type RocksAgent struct { Gid GoogleID `json:"gid"` TGId int64 `json:"tgid"` Agent string `json:"agentid"` Verified bool `json:"verified"` Smurf bool `json:"smurf"` }
RocksAgent is defined by enlightened.rocks
func RocksFromDB ¶
func RocksFromDB(gid GoogleID) (*RocksAgent, time.Time, error)
RocksFromDB returns a rocks agent from the database
type Task ¶
type Task struct { ID TaskID `json:"task"` Assignments []GoogleID `json:"assignments"` DependsOn []TaskID `json:"dependsOn"` Zone Zone `json:"zone"` DeltaMinutes int32 `json:"deltaminutes"` State string `json:"state"` Comment string `json:"comment"` Order int16 `json:"order"` // contains filtered or unexported fields }
Task is the imported things for markers and links
func (*Task) Acknowledge ¶
Acknowledge marks a task as acknowledged
func (*Task) ClearAssignments ¶
ClearAssignments removes any assignments for this task from the database
func (*Task) GetAssignments ¶
GetAssignments gets all assignments for a task
func (*Task) Incomplete ¶
Incomplete marks a task as not completed
func (*Task) IsAssignedTo ¶
IsAssignedTo checks to see if a task is assigned to a particular agent
func (*Task) SetAssignments ¶
SetAssignments assigns a task to an agent using a given transaction, if the transaction is nil, one is created for this block
func (*Task) SetComment ¶
SetComment sets the comment on a task
func (*Task) SetDepends ¶
SetDepends overwrites a task's dependencies, if tx is null, one is created
type TeamData ¶
type TeamData struct { Name string `json:"name"` ID TeamID `json:"id"` TeamMembers []TeamMember `json:"agents"` RocksComm string `json:"rc,omitempty"` RocksKey string `json:"rk,omitempty"` JoinLinkToken string `json:"jlt,omitempty"` VTeam int64 `json:"vt,omitempty"` VRole int8 `json:"vr,omitempty"` }
TeamData is the wrapper type containing all the team info
type TeamID ¶
type TeamID string
TeamID is the primary means for interfacing with teams
func GetAllTeams ¶
func GetTeamsByVID ¶
GetTeamsByVID returns all wasabee teams which match the V team ID
func RocksCommunityToTeam ¶
RocksCommunityToTeam returns a TeamID from a Rocks Community
func (TeamID) Delete ¶
Delete removes the team identified by teamID does not check team ownership -- caller should take care of authorization
func (TeamID) DeleteJoinToken ¶
DeleteJoinToken removes a team's join link token
func (TeamID) FetchFBTokens ¶
func (TeamID) GenerateJoinToken ¶
GenerateJoinToken sets a team's join link token
func (TeamID) LinkToTelegramChat ¶
func (teamID TeamID) LinkToTelegramChat(chat TelegramID, opID OperationID) error
LinkToTelegramChat associates a telegram chat ID with the team, performs authorization a chat can be linked to a single team a team can be linked to a single chat (irrespective of opID)
func (TeamID) Operations ¶
func (teamID TeamID) Operations() ([]OpPermission, error)
Operations returns a slice containing all the OpPermissions which reference this team
func (TeamID) RemoveAgent ¶
RemoveAgent removes a agent (identified by location share key, GoogleID, agent name, or EnlID) from a team.
func (TeamID) Rename ¶
Rename sets a new name for a teamID does not check team ownership -- caller should take care of authorization
func (TeamID) RocksCommunity ¶
RocksCommunity returns a communityID for a TeamID
func (TeamID) SetComment ¶
SetComment sets an agent's comment on a given team
func (TeamID) SetRocks ¶
SetRocks links a team to a community at enl.rocks. Does not check team ownership -- caller should take care of authorization. Local adds/deletes will be pushed to the community (API management must be enabled on the community at enl.rocks). adds/deletes at enl.rocks will be pushed here (onJoin/onLeave web hooks must be configured in the community at enl.rocks)
func (TeamID) TelegramChat ¶
TelegramChat returns the associated telegram chat ID for this team, if any
func (TeamID) UnlinkFromTelegramChat ¶
UnlinkFromTelegramChat disassociates a telegram chat ID from the team -- not authenticated since bot removal from chat is enough
func (TeamID) VConfigure ¶
VConfigure sets V connection for a Wasabee team -- caller should verify ownership
type TeamMember ¶
type TeamMember struct { Gid GoogleID `json:"id"` Name string `json:"name"` VName string `json:"vname,omitempty"` RocksName string `json:"rocksname,omitempty"` IntelName string `json:"intelname,omitempty"` CommunityName string `json:"communityname,omitempty"` Level uint8 `json:"level,omitempty"` EnlID string `json:"enlid,omitempty"` PictureURL string `json:"pic,omitempty"` Verified bool `json:"Vverified"` Blacklisted bool `json:"blacklisted"` RocksVerified bool `json:"rocks"` RocksSmurf bool `json:"smurf"` IntelFaction string `json:"intelfaction"` Comment string `json:"squad,omitempty"` Lat float64 `json:"lat,omitempty"` Lon float64 `json:"lng,omitempty"` Date string `json:"date"` LoadWD bool `json:"loadWD"` }
TeamMember is the light version of AgentData, containing visible information exported to teams
func FetchAgent ¶
func FetchAgent(id AgentID, caller GoogleID) (*TeamMember, error)
FetchAgent populates the minimal Agent struct with data anyone can see
type TelegramID ¶
type TelegramID int64
TelegramID is a user ID from telegram
func GetAllTelegramIDs ¶
func GetAllTelegramIDs() ([]TelegramID, error)
GetAllTelegramIDs is used by the telegram cleanup function
func (TelegramID) Delete ¶
func (tgid TelegramID) Delete() error
Delete is used to remove a TelegramID
func (TelegramID) Gid ¶
func (tgid TelegramID) Gid() (GoogleID, error)
Gid returns a verified GoogleID for a Telegram ID
func (TelegramID) GidV ¶
func (tgid TelegramID) GidV() (GoogleID, bool, error)
GidV returns a googleID/verified pair for a given telegram ID
func (TelegramID) InitAgent ¶
func (tgid TelegramID) InitAgent(name string, ott OneTimeToken) error
InitAgent establishes a new telegram user in the database and begins the verification process
func (TelegramID) SetName ¶
func (tgid TelegramID) SetName(name string) error
SetName is used to set an agent's telegram display name
func (TelegramID) String ¶
func (tgid TelegramID) String() string
String returns a string format of a TelegramID
func (TelegramID) UnverifyAgent ¶
func (tgid TelegramID) UnverifyAgent() error
UnverifyAgent marks an ID as unverified (if the agent blocks the bot)
func (TelegramID) VerifyAgent ¶
func (tgid TelegramID) VerifyAgent(authtoken string) error
VerifyAgent is the second stage of the verication process
type UnspecifiedTask ¶
type UnspecifiedTask interface { Claim(GoogleID) error Reject(GoogleID) error SetOrder(int16) error GetOrder() int16 IsAssignedTo(GoogleID) bool Acknowledge() error }
UnspecifiedTask is the type for tasks which could be either markers or links
type VAgent ¶
type VAgent struct { EnlID string `json:"enlid"` Gid GoogleID `json:"gid"` Vlevel int64 `json:"vlevel"` Vpoints int64 `json:"vpoints"` Agent string `json:"agent"` Level int64 `json:"level"` Quarantine bool `json:"quarantine"` Active bool `json:"active"` Blacklisted bool `json:"blacklisted"` Verified bool `json:"verified"` Flagged bool `json:"flagged"` Banned bool `json:"banned_by_nia"` CellID string `json:"cellid"` TelegramID int64 `json:"telegramid"` Telegram string `json:"telegram"` Email string `json:"email"` StartLat float64 `json:"lat"` StartLon float64 `json:"lon"` Distance int64 `json:"distance"` Roles []struct { ID uint8 `json:"id"` Name string `json:"name"` } `json:"roles"` }
VAgent is set by the V API most of these fields are empty unless filled in by a team query
type Zone ¶
type Zone int
Zone is the sub-operation zone identifer
ZoneAll is a reserved name for the wildcard zone
func ZoneFromString ¶
ZoneFromString takes a string and returns a valid zone or zonePrimary if invalid input
type ZoneListElement ¶
type ZoneListElement struct { Zone Zone `json:"id"` Name string `json:"name"` Points []zonepoint `json:"points"` // just a string for the client to parse Color string `json:"color"` }
ZoneListElement is used to map display names to zones