Documentation ¶
Overview ¶
Package vain implements a vanity service for use by the the go tool.
The executable, cmd/vaind, is located in the respective subdirectory. vaind, a webserver for hosting go get vanity urls.
The go get command searches for the following header when searching for packages:
<meta name="go-import" content="import-prefix vcs repo-root">
this is simply a service for aggregating a collection of prefix, vcs, and repo-root tuples, and serving the appropriate header over http. For more information please refer to the documentation for the go tool found at https://golang.org/cmd/go/#hdr-Remote_import_paths
For instructions on how to use this service, build the daemon, run it, and visit the root url.
Index ¶
- func Valid(p string, packages []Package) bool
- type Email
- type Mail
- type Mailer
- type MemDB
- func (m *MemDB) AddPackage(p Package) error
- func (m *MemDB) Confirm(tok Token) (Token, error)
- func (m *MemDB) Forgot(e Email, window time.Duration) (Token, error)
- func (m *MemDB) NSForToken(ns namespace, tok Token) error
- func (m *MemDB) Package(pth string) (Package, error)
- func (m *MemDB) PackageExists(pth path) bool
- func (m *MemDB) Pkgs() []Package
- func (m *MemDB) Register(e Email) (Token, error)
- func (m *MemDB) RemovePackage(pth path) error
- func (m *MemDB) Sync() error
- type Package
- type Server
- type Storer
- type Token
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Mail ¶
type Mail struct {
// contains filtered or unexported fields
}
Mail stores information required to use smtp.
type MemDB ¶
type MemDB struct { Users map[Email]User TokToEmail map[Token]Email Packages map[path]Package Namespaces map[namespace]Email // contains filtered or unexported fields }
MemDB implements an in-memory, and disk-backed database for a vain server.
func TestDB ¶
TestDB returns a populated MemDB in a temp location, as well as a function to call at cleanup time.
func (*MemDB) AddPackage ¶
AddPackage adds p into packages table.
func (*MemDB) Confirm ¶
Confirm modifies the user with the given token. Used on register confirmation.
func (*MemDB) Forgot ¶
Forgot is used fetch a user's token. It implements rudimentary rate limiting.
func (*MemDB) NSForToken ¶
NSForToken creates an entry namespaces with a relation to the token.
func (*MemDB) PackageExists ¶
PackageExists tells if a package with path is in the database.
func (*MemDB) RemovePackage ¶
RemovePackage removes package with given path
type Package ¶
type Package struct { //Vcs (version control system) supported: "hg", "git", "bzr", "svn" Vcs string `json:"vcs"` // Repo: the remote repository url Repo string `json:"repo"` Path string `json:"path"` Ns namespace `json:"-"` }
Package stores the three pieces of information needed to create the meta tag. Two of these (Vcs and Repo) are stored explicitly, and the third is determined implicitly by the path POSTed to. For more information refer to the documentation for the go tool:
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server serves up the http.
type Storer ¶
type Storer interface { NSForToken(ns namespace, tok Token) error Package(path string) (Package, error) AddPackage(p Package) error RemovePackage(pth path) error PackageExists(pth path) bool Pkgs() []Package Register(e Email) (Token, error) Confirm(tok Token) (Token, error) Forgot(e Email, window time.Duration) (Token, error) }
Storer defines the db interface.