Documentation ¶
Overview ¶
The golink server runs http://go/, a private shortlink service for tailnets.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var LastSnapshot []byte
LastSnapshot is the data snapshot (as returned by the /.export handler) that will be loaded on startup.
Functions ¶
Types ¶
type ClickStats ¶
ClickStats is the number of clicks a set of links have received in a given time period. It is keyed by link short name, with values of total clicks.
type Link ¶
type Link struct { Short string // the "foo" part of http://go/foo Long string // the target URL or text/template pattern to run Created time.Time LastEdit time.Time // when the link was last edited Owner string // user@domain Clicks int `json:",omitempty"` // number of times this link has been served }
Link is the structure stored for each go short link.
type SQLiteDB ¶
type SQLiteDB struct {
// contains filtered or unexported fields
}
SQLiteDB stores Links in a SQLite database.
func NewSQLiteDB ¶
NewSQLiteDB returns a new SQLiteDB that stores links in a SQLite database stored at f.
func (*SQLiteDB) Load ¶
Load returns a Link by its short name.
It returns fs.ErrNotExist if the link does not exist.
The caller owns the returned value.
func (*SQLiteDB) LoadStats ¶
func (s *SQLiteDB) LoadStats() (ClickStats, error)
LoadStats returns click stats for links.
func (*SQLiteDB) SaveStats ¶
func (s *SQLiteDB) SaveStats(stats ClickStats) error
SaveStats records click stats for links. The provided map includes incremental clicks that have occurred since the last time SaveStats was called.