Documentation
¶
Overview ¶
Package peer implements the basic data types needed to communicate with other brig instances.
user[@domain[/resource]
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ErrBadName ¶
type ErrBadName struct {
// contains filtered or unexported fields
}
ErrBadName is returned for invalidly formatted peer names.
type Fingerprint ¶
type Fingerprint string
Fingerprint encodes the addr of a remote and an ID (i.e. hash) of the remote's public key. It is later used to verify if a remote's addr or pubkey has changed and is presented to the user as initial identification token for another user.
func BuildFingerprint ¶
func BuildFingerprint(addr string, pubKeyData []byte) Fingerprint
BuildFingerprint builds a fingerprint from `addr` and a public key.
func CastFingerprint ¶
func CastFingerprint(s string) (Fingerprint, error)
CastFingerprint converts and checks `s` to be a valid Fingerprint.
func (Fingerprint) Addr ¶
func (fp Fingerprint) Addr() string
Addr returns the addr part of a fingerprint.
func (Fingerprint) PubKeyID ¶
func (fp Fingerprint) PubKeyID() string
PubKeyID returns the public key hash in the fingerprint.
func (Fingerprint) PubKeyMatches ¶
func (fp Fingerprint) PubKeyMatches(pubKeyData []byte) bool
PubKeyMatches checks if the supplied public key matches with the hashed version in the fingerprint.
type Name ¶
type Name string
Name is the display name of a peer. (i.e. how another repo calls itself)
func CastName ¶
func CastName(name string) (Name, error)
CastName checks `name` to be correct and returns a wrapped name.
func (Name) AsPath ¶
func (name Name) AsPath() string
AsPath converts a peer name to a path that can be used for storage.
func (Name) Domain ¶
func (name Name) Domain() string
Domain will return the domain part of a peer name, if present.
func (Name) Resource ¶
func (name Name) Resource() string
Resource will return the resource part of a peer name, if present.
func (Name) WithoutResource ¶
func (name Name) WithoutResource() string
WithoutResource returns the same peer name without its resource part.