peer

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2018 License: AGPL-3.0 Imports: 7 Imported by: 0

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

func IsValid

func IsValid(name string) bool

IsValid will return true if a peer name is formatted validly.

Types

type ErrBadName

type ErrBadName struct {
	// contains filtered or unexported fields
}

ErrBadName is returned for invalidly formatted peer names.

func (ErrBadName) Error

func (e ErrBadName) Error() string

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 Info

type Info struct {
	Name Name
	Addr string
}

Info is a pair of addr and a peer name.

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) User

func (name Name) User() string

User returns the user part of the peer name.

func (Name) WithoutResource

func (name Name) WithoutResource() string

WithoutResource returns the same peer name without its resource part.

Jump to

Keyboard shortcuts

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