models

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2018 License: MIT Imports: 31 Imported by: 0

Documentation

Overview

Package models implements the types and structs needed in gophish.

Index

Constants

View Source
const (
	CAMPAIGN_IN_PROGRESS string = "In progress"
	CAMPAIGN_QUEUED      string = "Queued"
	CAMPAIGN_CREATED     string = "Created"
	CAMPAIGN_EMAILS_SENT string = "Emails Sent"
	CAMPAIGN_COMPLETE    string = "Completed"
	EVENT_SENT           string = "Email Sent"
	EVENT_SENDING_ERROR  string = "Error Sending Email"
	EVENT_OPENED         string = "Email Opened"
	EVENT_CLICKED        string = "Clicked Link"
	EVENT_DATA_SUBMIT    string = "Submitted Data"
	EVENT_REPORTED       string = "Email Reported"
	EVENT_PROXY_REQUEST  string = "Proxied request"
	STATUS_SUCCESS       string = "Success"
	STATUS_QUEUED        string = "Queued"
	STATUS_SENDING       string = "Sending"
	STATUS_UNKNOWN       string = "Unknown"
	STATUS_SCHEDULED     string = "Scheduled"
	STATUS_RETRY         string = "Retrying"
	ERROR                string = "Error"
)
View Source
const RecipientParameter = "rid"

RecipientParameter is the URL parameter that points to the result ID for a recipient.

Variables

View Source
var ErrCampaignNameNotSpecified = errors.New("Campaign name not specified")

ErrCampaignNameNotSpecified indicates there was no template given by the user

View Source
var ErrEmailNotSpecified = errors.New("No email address specified")

ErrNoEmailSpecified is thrown when no email is specified for the Target

View Source
var ErrFromAddressNotSpecified = errors.New("No From Address specified")

ErrFromAddressNotSpecified is thrown when there is no "From" address specified in the SMTP configuration

View Source
var ErrGroupNameNotSpecified = errors.New("Group name not specified")

ErrGroupNameNotSpecified is thrown when a group name is not specified

View Source
var ErrGroupNotFound = errors.New("Group not found")

ErrGroupNotFound indicates a group specified by the user does not exist in the database

View Source
var ErrGroupNotSpecified = errors.New("No groups specified")

ErrGroupNotSpecified indicates there was no template given by the user

View Source
var ErrHostNotSpecified = errors.New("No SMTP Host specified")

ErrHostNotSpecified is thrown when there is no Host specified in the SMTP configuration

View Source
var ErrInvalidHost = errors.New("Invalid SMTP server address")

ErrInvalidHost indicates that the SMTP server string is invalid

View Source
var ErrMaxSendAttempts = errors.New("max send attempts exceeded")

ErrMaxSendAttempts is thrown when the maximum number of sending attemps for a given MailLog is exceeded.

View Source
var ErrNoTargetsSpecified = errors.New("No targets specified")

ErrNoTargetsSpecified is thrown when no targets are specified by the user

View Source
var ErrPageNameNotSpecified = errors.New("Page Name not specified")

ErrPageNameNotSpecified is thrown if the name of the landing page is blank.

View Source
var ErrPageNotFound = errors.New("Page not found")

ErrPageNotFound indicates a page specified by the user does not exist in the database

View Source
var ErrPageNotSpecified = errors.New("No landing page specified")

ErrPageNotSpecified indicates a landing page was not provided for the campaign

View Source
var ErrSMTPNotFound = errors.New("Sending profile not found")

ErrSMTPNotFound indicates a sending profile specified by the user does not exist in the database

View Source
var ErrSMTPNotSpecified = errors.New("No sending profile specified")

ErrSMTPNotSpecified indicates a sending profile was not provided for the campaign

View Source
var ErrTemplateMissingParameter = errors.New("Need to specify at least plaintext or HTML content")

ErrTemplateMissingParameter is thrown when a needed parameter is not provided

View Source
var ErrTemplateNameNotSpecified = errors.New("Template name not specified")

ErrTemplateNameNotSpecified is thrown when a template name is not specified

View Source
var ErrTemplateNotFound = errors.New("Template not found")

ErrTemplateNotFound indicates the template specified does not exist in the database

View Source
var ErrTemplateNotSpecified = errors.New("No email template specified")

ErrTemplateNotSpecified indicates there was no template given by the user

View Source
var MaxSendAttempts = 8

MaxSendAttempts set to 8 since we exponentially backoff after each failed send attempt. This will give us a maximum send delay of 256 minutes, or about 4.2 hours.

Functions

func CompleteCampaign added in v0.2.0

func CompleteCampaign(id int64, uid int64) error

CompleteCampaign effectively "ends" a campaign. Any future emails clicked will return a simple "404" page.

func DeleteCampaign

func DeleteCampaign(id int64) error

DeleteCampaign deletes the specified campaign

func DeleteGroup

func DeleteGroup(g *Group) error

DeleteGroup deletes a given group by group ID and user ID

func DeletePage

func DeletePage(id int64, uid int64) error

DeletePage deletes an existing page in the database. An error is returned if a page with the given user id and page id is not found.

func DeleteSMTP added in v0.1.2

func DeleteSMTP(id int64, uid int64) error

DeleteSMTP deletes an existing SMTP in the database. An error is returned if a SMTP with the given user id and SMTP id is not found.

func DeleteTemplate

func DeleteTemplate(id int64, uid int64) error

DeleteTemplate deletes an existing template in the database. An error is returned if a template with the given user id and template id is not found.

func GenerateMailLog added in v0.5.0

func GenerateMailLog(c *Campaign, r *Result) error

GenerateMailLog creates a new maillog for the given campaign and result. It sets the initial send date to match the campaign's launch date.

func LockMailLogs added in v0.5.0

func LockMailLogs(ms []*MailLog, lock bool) error

LockMailLogs locks or unlocks a slice of maillogs for processing.

func PostCampaign

func PostCampaign(c *Campaign, uid int64) error

PostCampaign inserts a campaign and all associated records into the database.

func PostGroup

func PostGroup(g *Group) error

PostGroup creates a new group in the database.

func PostPage

func PostPage(p *Page) error

PostPage creates a new page in the database.

func PostSMTP added in v0.1.2

func PostSMTP(s *SMTP) error

PostSMTP creates a new SMTP in the database.

func PostTemplate

func PostTemplate(t *Template) error

PostTemplate creates a new template in the database.

func PutGroup

func PutGroup(g *Group) error

PutGroup updates the given group if found in the database.

func PutPage

func PutPage(p *Page) error

PutPage edits an existing Page in the database. Per the PUT Method RFC, it presumes all data for a page is provided.

func PutSMTP added in v0.1.2

func PutSMTP(s *SMTP) error

PutSMTP edits an existing SMTP in the database. Per the PUT Method RFC, it presumes all data for a SMTP is provided.

func PutTemplate

func PutTemplate(t *Template) error

PutTemplate edits an existing template in the database. Per the PUT Method RFC, it presumes all data for a template is provided.

func PutUser

func PutUser(u *User) error

PutUser updates the given user

func Setup

func Setup() error

Setup initializes the Conn object It also populates the Gophish Config object

func UnlockAllMailLogs added in v0.5.0

func UnlockAllMailLogs() error

UnlockAllMailLogs removes the processing lock for all maillogs in the database. This is intended to be called when Gophish is started so that any previously locked maillogs can resume processing.

func UpdateTarget added in v0.2.0

func UpdateTarget(target Target) error

UpdateTarget updates the given target information in the database.

Types

type Attachment

type Attachment struct {
	Id         int64  `json:"-"`
	TemplateId int64  `json:"-"`
	Content    string `json:"content"`
	Type       string `json:"type"`
	Name       string `json:"name"`
}

Attachment contains the fields and methods for an email attachment

type Campaign

type Campaign struct {
	Id            int64     `json:"id"`
	UserId        int64     `json:"-"`
	Name          string    `json:"name" sql:"not null"`
	CreatedDate   time.Time `json:"created_date"`
	LaunchDate    time.Time `json:"launch_date"`
	CompletedDate time.Time `json:"completed_date"`
	TemplateId    int64     `json:"-"`
	Template      Template  `json:"template"`
	PageId        int64     `json:"-"`
	Page          Page      `json:"page"`
	Status        string    `json:"status"`
	Results       []Result  `json:"results,omitempty"`
	Groups        []Group   `json:"groups,omitempty"`
	Events        []Event   `json:"timeline,omitemtpy"`
	SMTPId        int64     `json:"-"`
	SMTP          SMTP      `json:"smtp"`
	URL           string    `json:"url"`
}

Campaign is a struct representing a created campaign

func GetCampaign

func GetCampaign(id int64, uid int64) (Campaign, error)

GetCampaign returns the campaign, if it exists, specified by the given id and user_id.

func GetCampaigns

func GetCampaigns(uid int64) ([]Campaign, error)

GetCampaigns returns the campaigns owned by the given user.

func GetQueuedCampaigns added in v0.2.0

func GetQueuedCampaigns(t time.Time) ([]Campaign, error)

GetQueuedCampaigns returns the campaigns that are queued up for this given minute

func (*Campaign) AddEvent

func (c *Campaign) AddEvent(e Event) error

AddEvent creates a new campaign event in the database

func (*Campaign) UpdateStatus

func (c *Campaign) UpdateStatus(s string) error

UpdateStatus changes the campaign status appropriately

func (*Campaign) Validate

func (c *Campaign) Validate() error

Validate checks to make sure there are no invalid fields in a submitted campaign

type CampaignResults added in v0.2.0

type CampaignResults struct {
	Id       int64    `json:"id"`
	Name     string   `json:"name"`
	Status   string   `json:"status"`
	Reported string   `json:"reported"`
	Results  []Result `json:"results, omitempty"`
	Events   []Event  `json:"timeline,omitempty"`
}

CampaignResults is a struct representing the results from a campaign

func GetCampaignResults added in v0.2.0

func GetCampaignResults(id int64, uid int64) (CampaignResults, error)

GetCampaignResults returns just the campaign results for the given campaign

type CampaignStats added in v0.3.0

type CampaignStats struct {
	Total         int64 `json:"total"`
	EmailsSent    int64 `json:"sent"`
	OpenedEmail   int64 `json:"opened"`
	ClickedLink   int64 `json:"clicked"`
	SubmittedData int64 `json:"submitted_data"`
	EmailReported int64 `json:"email_reported"`
	Error         int64 `json:"error"`
}

CampaignStats is a struct representing the statistics for a single campaign

type CampaignSummaries added in v0.3.0

type CampaignSummaries struct {
	Total     int64             `json:"total"`
	Campaigns []CampaignSummary `json:"campaigns"`
}

CampaignSummaries is a struct representing the overview of campaigns

func GetCampaignSummaries added in v0.3.0

func GetCampaignSummaries(uid int64) (CampaignSummaries, error)

GetCampaignSummaries gets the summary objects for all the campaigns owned by the current user

type CampaignSummary added in v0.3.0

type CampaignSummary struct {
	Id            int64         `json:"id"`
	CreatedDate   time.Time     `json:"created_date"`
	LaunchDate    time.Time     `json:"launch_date"`
	CompletedDate time.Time     `json:"completed_date"`
	Status        string        `json:"status"`
	Name          string        `json:"name"`
	Stats         CampaignStats `json:"stats"`
}

CampaignSummary is a struct representing the overview of a single camaign

func GetCampaignSummary added in v0.3.0

func GetCampaignSummary(id int64, uid int64) (CampaignSummary, error)

GetCampaignSummary gets the summary object for a campaign specified by the campaign ID

type Dialer added in v0.5.0

type Dialer struct {
	*gomail.Dialer
}

Dialer is a wrapper around a standard gomail.Dialer in order to implement the mailer.Dialer interface. This allows us to better separate the mailer package as opposed to forcing a connection between mailer and gomail.

func (*Dialer) Dial added in v0.5.0

func (d *Dialer) Dial() (mailer.Sender, error)

Dial wraps the gomail dialer's Dial command

type Event

type Event struct {
	Id         int64     `json:"-"`
	CampaignId int64     `json:"-"`
	Email      string    `json:"email"`
	Time       time.Time `json:"time"`
	Message    string    `json:"message"`
	Details    string    `json:"details"`
}

Event contains the fields for an event that occurs during the campaign

type Flash

type Flash struct {
	Type    string
	Message string
}

Flash is used to hold flash information for use in templates.

type Group

type Group struct {
	Id           int64     `json:"id"`
	UserId       int64     `json:"-"`
	Name         string    `json:"name"`
	ModifiedDate time.Time `json:"modified_date"`
	Targets      []Target  `json:"targets" sql:"-"`
}

Group contains the fields needed for a user -> group mapping Groups contain 1..* Targets

func GetGroup

func GetGroup(id int64, uid int64) (Group, error)

GetGroup returns the group, if it exists, specified by the given id and user_id.

func GetGroupByName

func GetGroupByName(n string, uid int64) (Group, error)

GetGroupByName returns the group, if it exists, specified by the given name and user_id.

func GetGroups

func GetGroups(uid int64) ([]Group, error)

GetGroups returns the groups owned by the given user.

func (*Group) Validate

func (g *Group) Validate() error

Validate performs validation on a group given by the user

type GroupSummaries added in v0.3.0

type GroupSummaries struct {
	Total  int64          `json:"total"`
	Groups []GroupSummary `json:"groups"`
}

GroupSummaries is a struct representing the overview of Groups.

func GetGroupSummaries added in v0.3.0

func GetGroupSummaries(uid int64) (GroupSummaries, error)

GetGroupSummaries returns the summaries for the groups created by the given uid.

type GroupSummary added in v0.3.0

type GroupSummary struct {
	Id           int64     `json:"id"`
	Name         string    `json:"name"`
	ModifiedDate time.Time `json:"modified_date"`
	NumTargets   int64     `json:"num_targets"`
}

GroupSummary represents a summary of the Group model. The only difference is that, instead of listing the Targets (which could be expensive for large groups), it lists the target count.

func GetGroupSummary added in v0.3.0

func GetGroupSummary(id int64, uid int64) (GroupSummary, error)

GetGroupSummary returns the summary for the requested group

type GroupTarget

type GroupTarget struct {
	GroupId  int64 `json:"-"`
	TargetId int64 `json:"-"`
}

GroupTarget is used for a many-to-many relationship between 1..* Groups and 1..* Targets

type Header struct {
	Id     int64  `json:"-"`
	SMTPId int64  `json:"-"`
	Key    string `json:"key"`
	Value  string `json:"value"`
}

Header contains the fields and methods for a sending profile to have custom headers

type MailLog added in v0.5.0

type MailLog struct {
	Id          int64     `json:"-"`
	UserId      int64     `json:"-"`
	CampaignId  int64     `json:"campaign_id"`
	RId         string    `json:"id"`
	SendDate    time.Time `json:"send_date"`
	SendAttempt int       `json:"send_attempt"`
	Processing  bool      `json:"-"`
}

MailLog is a struct that holds information about an email that is to be sent out.

func GetMailLogsByCampaign added in v0.5.0

func GetMailLogsByCampaign(cid int64) ([]*MailLog, error)

GetMailLogsByCampaign returns all of the mail logs for a given campaign.

func GetQueuedMailLogs added in v0.5.0

func GetQueuedMailLogs(t time.Time) ([]*MailLog, error)

GetQueuedMailLogs returns the mail logs that are queued up for the given minute.

func (*MailLog) Backoff added in v0.5.0

func (m *MailLog) Backoff(reason error) error

Backoff sets the MailLog SendDate to be the next entry in an exponential backoff. ErrMaxRetriesExceeded is thrown if this maillog has been retried too many times. Backoff also unlocks the maillog so that it can be processed again in the future.

func (*MailLog) Error added in v0.5.0

func (m *MailLog) Error(e error) error

Error sets the error status on the models.Result that the maillog refers to. Since MailLog errors are permanent, this action also deletes the maillog.

func (*MailLog) Generate added in v0.5.0

func (m *MailLog) Generate(msg *gomail.Message) error

Generate fills in the details of a gomail.Message instance with the correct headers and body from the campaign and recipient listed in the maillog. We accept the gomail.Message as an argument so that the caller can choose to re-use the message across recipients.

func (*MailLog) GetDialer added in v0.5.0

func (m *MailLog) GetDialer() (mailer.Dialer, error)

GetDialer returns a dialer based on the maillog campaign's SMTP configuration

func (*MailLog) Lock added in v0.5.0

func (m *MailLog) Lock() error

Lock sets the processing flag so that other processes cannot modify the maillog

func (*MailLog) Success added in v0.5.0

func (m *MailLog) Success() error

Success deletes the maillog from the database and updates the underlying campaign result.

func (*MailLog) Unlock added in v0.5.0

func (m *MailLog) Unlock() error

Unlock removes the processing flag so the maillog can be processed again

type Page

type Page struct {
	Id                 int64     `json:"id" gorm:"column:id; primary_key:yes"`
	UserId             int64     `json:"-" gorm:"column:user_id"`
	Name               string    `json:"name"`
	HTML               string    `json:"html" gorm:"column:html"`
	CaptureCredentials bool      `json:"capture_credentials" gorm:"column:capture_credentials"`
	CapturePasswords   bool      `json:"capture_passwords" gorm:"column:capture_passwords"`
	RedirectURL        string    `json:"redirect_url" gorm:"column:redirect_url"`
	ModifiedDate       time.Time `json:"modified_date"`
}

Page contains the fields used for a Page model

func GetPage

func GetPage(id int64, uid int64) (Page, error)

GetPage returns the page, if it exists, specified by the given id and user_id.

func GetPageByName

func GetPageByName(n string, uid int64) (Page, error)

GetPageByName returns the page, if it exists, specified by the given name and user_id.

func GetPages

func GetPages(uid int64) ([]Page, error)

GetPages returns the pages owned by the given user.

func (*Page) Validate

func (p *Page) Validate() error

Validate ensures that a page contains the appropriate details

type Response

type Response struct {
	Message string      `json:"message"`
	Success bool        `json:"success"`
	Data    interface{} `json:"data"`
}

Response contains the attributes found in an API response

type Result

type Result struct {
	Id         int64     `json:"-"`
	CampaignId int64     `json:"-"`
	UserId     int64     `json:"-"`
	RId        string    `json:"id"`
	Email      string    `json:"email"`
	FirstName  string    `json:"first_name"`
	LastName   string    `json:"last_name"`
	Position   string    `json:"position"`
	Status     string    `json:"status" sql:"not null"`
	IP         string    `json:"ip"`
	Latitude   float64   `json:"latitude"`
	Longitude  float64   `json:"longitude"`
	SendDate   time.Time `json:"send_date"`
	Reported   bool      `json:"reported" sql:"not null"`
}

Result contains the fields for a result object, which is a representation of a target in a campaign.

func GetResult

func GetResult(rid string) (Result, error)

GetResult returns the Result object from the database given the ResultId

func (*Result) FormatAddress added in v0.4.0

func (r *Result) FormatAddress() string

FormatAddress returns the email address to use in the "To" header of the email

func (*Result) GenerateId

func (r *Result) GenerateId() error

GenerateId generates a unique key to represent the result in the database

func (*Result) UpdateGeo

func (r *Result) UpdateGeo(addr string) error

UpdateGeo updates the latitude and longitude of the result in the database given an IP address

func (*Result) UpdateReported added in v0.6.0

func (r *Result) UpdateReported(s bool) error

UpdateReported updates when a user reports a campaign

func (*Result) UpdateStatus

func (r *Result) UpdateStatus(s string) error

UpdateStatus updates the status of the result in the database

type SMTP

type SMTP struct {
	Id               int64     `json:"id" gorm:"column:id; primary_key:yes"`
	UserId           int64     `json:"-" gorm:"column:user_id"`
	Interface        string    `json:"interface_type" gorm:"column:interface_type"`
	Name             string    `json:"name"`
	Host             string    `json:"host"`
	Username         string    `json:"username,omitempty"`
	Password         string    `json:"password,omitempty"`
	FromAddress      string    `json:"from_address"`
	IgnoreCertErrors bool      `json:"ignore_cert_errors"`
	Headers          []Header  `json:"headers"`
	ModifiedDate     time.Time `json:"modified_date"`
}

SMTP contains the attributes needed to handle the sending of campaign emails

func GetSMTP added in v0.1.2

func GetSMTP(id int64, uid int64) (SMTP, error)

GetSMTP returns the SMTP, if it exists, specified by the given id and user_id.

func GetSMTPByName added in v0.1.2

func GetSMTPByName(n string, uid int64) (SMTP, error)

GetSMTPByName returns the SMTP, if it exists, specified by the given name and user_id.

func GetSMTPs added in v0.1.2

func GetSMTPs(uid int64) ([]SMTP, error)

GetSMTPs returns the SMTPs owned by the given user.

func (*SMTP) GetDialer added in v0.5.0

func (s *SMTP) GetDialer() (mailer.Dialer, error)

GetDialer returns a dialer for the given SMTP profile

func (SMTP) TableName

func (s SMTP) TableName() string

TableName specifies the database tablename for Gorm to use

func (*SMTP) Validate

func (s *SMTP) Validate() error

Validate ensures that SMTP configs/connections are valid

type SendTestEmailRequest

type SendTestEmailRequest struct {
	Template    Template `json:"template"`
	Page        Page     `json:"page"`
	SMTP        SMTP     `json:"smtp"`
	URL         string   `json:"url"`
	Tracker     string   `json:"tracker"`
	TrackingURL string   `json:"tracking_url"`
	From        string   `json:"from"`
	Target
	ErrorChan chan (error) `json:"-"`
}

SendTestEmailRequest is the structure of a request to send a test email to test an SMTP connection. This type implements the mailer.Mail interface.

func (*SendTestEmailRequest) Backoff added in v0.5.0

func (s *SendTestEmailRequest) Backoff(reason error) error

Backoff treats temporary errors as permanent since this is expected to be a synchronous operation. It returns any errors given back to the ErrorChan

func (*SendTestEmailRequest) Error added in v0.5.0

func (s *SendTestEmailRequest) Error(err error) error

Error returns an error on the ErrorChan.

func (*SendTestEmailRequest) Generate added in v0.5.0

func (s *SendTestEmailRequest) Generate(msg *gomail.Message) error

Generate fills in the details of a gomail.Message with the contents from the SendTestEmailRequest.

func (*SendTestEmailRequest) GetDialer added in v0.5.0

func (s *SendTestEmailRequest) GetDialer() (mailer.Dialer, error)

GetDialer returns the mailer.Dialer for the underlying SMTP object

func (*SendTestEmailRequest) Success added in v0.5.0

func (s *SendTestEmailRequest) Success() error

Success returns nil on the ErrorChan to indicate that the email was sent successfully.

func (*SendTestEmailRequest) Validate

func (s *SendTestEmailRequest) Validate() error

Validate ensures the SendTestEmailRequest structure is valid.

type Target

type Target struct {
	Id        int64  `json:"-"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	Email     string `json:"email"`
	Position  string `json:"position"`
}

Target contains the fields needed for individual targets specified by the user Groups contain 1..* Targets, but 1 Target may belong to 1..* Groups

func GetTargets

func GetTargets(gid int64) ([]Target, error)

GetTargets performs a many-to-many select to get all the Targets for a Group

func (*Target) FormatAddress added in v0.4.0

func (t *Target) FormatAddress() string

Returns the email address to use in the "To" header of the email

type Template

type Template struct {
	Id           int64        `json:"id" gorm:"column:id; primary_key:yes"`
	UserId       int64        `json:"-" gorm:"column:user_id"`
	Name         string       `json:"name"`
	Subject      string       `json:"subject"`
	Text         string       `json:"text"`
	HTML         string       `json:"html" gorm:"column:html"`
	ModifiedDate time.Time    `json:"modified_date"`
	Attachments  []Attachment `json:"attachments"`
}

Template models hold the attributes for an email template to be sent to targets

func GetTemplate

func GetTemplate(id int64, uid int64) (Template, error)

GetTemplate returns the template, if it exists, specified by the given id and user_id.

func GetTemplateByName

func GetTemplateByName(n string, uid int64) (Template, error)

GetTemplateByName returns the template, if it exists, specified by the given name and user_id.

func GetTemplates

func GetTemplates(uid int64) ([]Template, error)

GetTemplates returns the templates owned by the given user.

func (*Template) Validate

func (t *Template) Validate() error

Validate checks the given template to make sure values are appropriate and complete

type User

type User struct {
	Id       int64  `json:"id"`
	Username string `json:"username" sql:"not null;unique"`
	Hash     string `json:"-"`
	ApiKey   string `json:"api_key" sql:"not null;unique"`
}

User represents the user model for gophish.

func GetUser

func GetUser(id int64) (User, error)

GetUser returns the user that the given id corresponds to. If no user is found, an error is thrown.

func GetUserByAPIKey

func GetUserByAPIKey(key string) (User, error)

GetUserByAPIKey returns the user that the given API Key corresponds to. If no user is found, an error is thrown.

func GetUserByUsername

func GetUserByUsername(username string) (User, error)

GetUserByUsername returns the user that the given username corresponds to. If no user is found, an error is thrown.

Jump to

Keyboard shortcuts

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