directory

package
v0.0.0-...-8402838 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2018 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashPublicKey

func HashPublicKey(pub interface{}) ([]byte, error)

func ParseCertification

func ParseCertification(r io.Reader, cache *AuthoritySet) error

func ParseDottedQuad

func ParseDottedQuad(addr string, out *[4]byte)

func WeightedSample

func WeightedSample(weights []int64, rand *mathrand.Rand) int

WeightedSample takes a slice of weights as input and returns the index of the weighed random choice. The slice is modified. Weights must be > 0.

Types

type Authorities

type Authorities interface {
	NumAuthorities() int
	// hex(sha1(idKey)), hex(sha1(signingKey)) -> signingKey
	SigningKey(string, string) *rsa.PublicKey
}

type AuthoritySet

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

func ReadCertifications

func ReadCertifications(r io.Reader, allowedFingerprints []string) *AuthoritySet

ReadCertifications updates signingKeys and identities whenever sufficient cross-certification is provided

func (*AuthoritySet) NumAuthorities

func (c *AuthoritySet) NumAuthorities() int

func (*AuthoritySet) SigningKey

func (c *AuthoritySet) SigningKey(idHashHex, signingHashHex string) *rsa.PublicKey

type BandwidthWeights

type BandwidthWeights struct {
	ForGuard, ForRelay, ForExit PositionWeights
}

func (*BandwidthWeights) WeighBootstrap

func (w *BandwidthWeights) WeighBootstrap(n *NodeInfo) int64

type Consensus

type Consensus struct {
	NotBefore, FreshUntil, NotAfter time.Time
	BandwidthWeights                BandwidthWeights
	Routers                         []*ShortNodeInfo
}

func ReadMicrodescriptorConsensus

func ReadMicrodescriptorConsensus(r io.Reader, authorities Authorities, nRequired int) (*Consensus, error)

212.112.245.170/tor/status-vote/current/consensus-microdesc/14C131+27B6B5+49015F+585769+805509+D586D1+E8A9C4+ED03BB+EFCBE7.z tor.noreply.org/tor/micro/d/MrvCj76HvmISlvtspAVTjzcp7p0NuCkUkUYg3Gs6Cig-xzZVjbCMiNkkTlWOWAcwqXWTTJYz9vDs37gam8kDiLA.z

func (*Consensus) UpdateTime

func (c *Consensus) UpdateTime(rand *mathrand.Rand) time.Time

type Directory

type Directory struct {
	Authorities Authorities
	Consensus   *Consensus
	Routers     []*NodeInfo
}

type MinimalNodeInfo

type MinimalNodeInfo struct {
	ID   [20]byte // hashPublicKey(signingKey)
	IP   [4]byte
	Port uint16
}

type NodeInfo

type NodeInfo struct {
	*ShortNodeInfo

	NTorOnionKey []byte
	OnionKey     rsa.PublicKey

	ExitPolicy4, ExitPolicy6 string
	Addresses                []string
	FamilyFingerprints       []string // []hex(sha1(idKey)), lowerCase
	FamilyNicknames          []string // in addition to FamilyFingerprints, NOT corresponding
}

func Pick

func Pick(weigh func(*NodeInfo) int64, routers []*NodeInfo, rand *mathrand.Rand) *NodeInfo

func ReadMicrodescriptors

func ReadMicrodescriptors(r_ io.Reader, shortInfos []*ShortNodeInfo) ([]*NodeInfo, error)

type PositionWeights

type PositionWeights struct {
	Guard, Relay, Exit, GuardExit int64
}

PositionWeights represents weights for choosing a node that will serve in a particular position (guard / relay / exit / directory).

func (*PositionWeights) Weigh

func (w *PositionWeights) Weigh(n *NodeInfo) int64

type ShortNodeInfo

type ShortNodeInfo struct {
	MinimalNodeInfo

	Nickname              string
	MicrodescriptorDigest [32]byte // sha256(microdescriptor)
	Published             time.Time
	DirectoryPort         uint16
	Version               Version
	RawBandwidth          int // kilobytes per second
	UnmeasuredBandwidth   int

	Authority, BadExit, Exit, Fast, Guard, HSDir, Named, Running, Stable, Unnamed, V2Dir, Valid bool
}

type Version

type Version [4]byte

Directories

Path Synopsis
Package bufio implements buffered I/O. It wraps an io.Reader or io.Writer object, creating another object (Reader or Writer) that also implements the interface but provides buffering and some help for textual I/O.
Package bufio implements buffered I/O. It wraps an io.Reader or io.Writer object, creating another object (Reader or Writer) that also implements the interface but provides buffering and some help for textual I/O.

Jump to

Keyboard shortcuts

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