Documentation ¶
Index ¶
- Constants
- Variables
- func Brute(targetA, targetB, maxA, maxB Hash, numKeys, numP int, ...) (a []*rsa.PrivateKey, b []*rsa.PrivateKey)
- func ColocatedKeys(k []byte, keysDB *KeysDB) (coloNum int, ips []string)
- func ComputeRendV2DescID(serviceID string, replica byte, time int64, descCookie string) ([]byte, error)
- func FromBase32(s string) ([]byte, error)
- func FromBase64(s string) ([]byte, error)
- func FromHex(s string) ([]byte, error)
- func HashToInt(k Hash) *big.Int
- func HashesToIntSlice(keys []Hash) []*big.Int
- func HourToTime(h Hour) time.Time
- func OnionToDescID(onion string, t time.Time) ([][]byte, error)
- func ReadConsensuses(dir string, since, until Hour) chan *Consensus
- func Score(v *big.Int, res *MetricData) int64
- func ToBase32(b []byte) string
- func ToHex(b []byte) string
- func WritePackedConsensus(w io.Writer, c *Consensus) error
- type AnalyzedConsensus
- type Consensus
- type Hash
- type Hashring
- func (h *Hashring) Age(p *big.Int, now Hour, keysDB *KeysDB) (Hour, error)
- func (h *Hashring) AgeData(now Hour, keysDB *KeysDB) (res []*PartitionData, err error)
- func (h *Hashring) Colocated(p *big.Int, keysDB *KeysDB) int
- func (*Hashring) Diff(from, to *big.Int) *big.Int
- func (h *Hashring) Distance(p *big.Int) *big.Int
- func (h *Hashring) Distance4(p *big.Int) *big.Int
- func (h *Hashring) Distance4Data() (res []*PartitionData)
- func (h *Hashring) DistanceData() (res []*PartitionData)
- func (h *Hashring) Fourth(p *big.Int) *big.Int
- func (h *Hashring) Len() int
- func (h *Hashring) Longevity(p *big.Int, now Hour, keysDB *KeysDB) (Hour, error)
- func (h *Hashring) Next(p *big.Int) *big.Int
- func (h *Hashring) Next3(p *big.Int) []*big.Int
- func (h *Hashring) Prev(p *big.Int) *big.Int
- type Hour
- type IPMeta
- type KeyMeta
- type KeysDB
- type MetricData
- type PackReader
- type PackedConsensusHdr
- type PartitionData
Constants ¶
View Source
const ( REPLICAS = 2 REND_TIME_PERIOD_V2_DESC_VALIDITY = 24 * 60 * 60 // 86400 )
View Source
const ROUNDS = 100000
The SampleX functions have been replaced by the analytical (not random) XData + AnalyzePartitionData functions
Variables ¶
View Source
var (
HashringLimit = new(big.Int).Lsh(bigOne, 160)
)
Functions ¶
func Brute ¶
func Brute(targetA, targetB, maxA, maxB Hash, numKeys, numP int, log func(v ...interface{})) (a []*rsa.PrivateKey, b []*rsa.PrivateKey)
func ComputeRendV2DescID ¶
func FromBase32 ¶
func FromBase64 ¶
func HashesToIntSlice ¶
func HourToTime ¶
func ReadConsensuses ¶
ReadConsensuses reads consensus files from a folder structure like DIR/consensuses-2011-02/04/2011-02-04-02-00-00-consensus and sends them on the returned channel. From since to until included.
Types ¶
type AnalyzedConsensus ¶
type AnalyzedConsensus struct { T Hour Distance *MetricData Distance4 *MetricData }
type Consensus ¶
func ParseConsensus ¶
ParseConsensus parses a consensus file and extracts the HSDir Hashring
type Hashring ¶
type Hashring struct {
// contains filtered or unexported fields
}
func NewHashring ¶
NewHashring returns a Hashring with the given unsorted points.
func RandomHashring ¶
func (*Hashring) AgeData ¶
func (h *Hashring) AgeData(now Hour, keysDB *KeysDB) (res []*PartitionData, err error)
AgeData is not really in use, Age and Longevity are assessed in absolute
func (*Hashring) Distance4Data ¶
func (h *Hashring) Distance4Data() (res []*PartitionData)
func (*Hashring) DistanceData ¶
func (h *Hashring) DistanceData() (res []*PartitionData)
type Hour ¶
type Hour int32
Hour is just a Unix timestamp divided by 3600, a unique index for an hour
type MetricData ¶
func AnalyzePartitionData ¶
func AnalyzePartitionData(data []*PartitionData) *MetricData
func SampleDistance ¶
func SampleDistance(h *Hashring) (res *MetricData)
func SampleDistance4 ¶
func SampleDistance4(h *Hashring) (res *MetricData)
type PackReader ¶
type PackReader struct {
// contains filtered or unexported fields
}
func NewPackReader ¶
func NewPackReader(filename string) (p *PackReader)
func (*PackReader) Consensus ¶
func (p *PackReader) Consensus() *Consensus
func (*PackReader) Err ¶
func (p *PackReader) Err() error
func (*PackReader) Load ¶
func (p *PackReader) Load() bool
type PackedConsensusHdr ¶
type PartitionData ¶
type PartitionData struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.