common

package
v0.0.0-...-e847439 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FLAG_AUTHORITY uint8 = iota
	FLAG_BAD_EXIT
	FLAG_EXIT
	FLAG_FAST
	FLAG_GUARD
	FLAG_HIDDEN_SERVICE_DIR
	FLAG_MIDDLE_ONLY
	FLAG_NO_ED_CONSENSUS
	FLAG_STABLE
	FLAG_STALE_DESC
	FLAG_RUNNING
	FLAG_VALID
	FLAG_V2DIR
	FLAG_SYBIL
	FLAG_ARRAY_LENGTH
)
View Source
const (
	VERSION_1 uint8 = iota
	VERSION_2
	VERSION_3
	VERSION_4
	VERSION_5
	VERSION_6
)
View Source
const (
	PARSER_STATE_HEADER uint8 = iota
	PARSER_STATE_DIRS
	PARSER_STATE_ROUTERS
	PARSER_STATE_FOOTER
)
View Source
const (
	LEVEL_ASN  = 1
	LEVEL_P24  = 2
	LEVEL_P16  = 3
	LEVEL_IPV6 = 4
)
View Source
const AUTH_DIR_NUM_AGREEMENTS uint8 = 9
View Source
const CONSENSUS_DATE_FORMAT string = "2006-01-02 15:04:05"

Variables

This section is empty.

Functions

func DestroyGetReasonS

func DestroyGetReasonS(reason uint8) string

func IPLevel

func IPLevel(ipStr string, asn uint32) (uint32, error)

func ParsePortsLine

func ParsePortsLine(dst *Ports, s string) error

ParsePortsLine needs to receive: "accept 20-21,23"

func SetGlobalConsensus

func SetGlobalConsensus(c *Consensus)

Types

type BandWidthWeight

type BandWidthWeight struct {
	Wbd int32
	Wbe int32
	Wbg int32
	Wbm int32
	Wdb int32
	Web int32
	Wed int32
	Wee int32
	Weg int32
	Wem int32
	Wgb int32
	Wgd int32
	Wgg int32
	Wgm int32
	Wmb int32
	Wmd int32
	Wme int32
	Wmg int32
	Wmm int32
}

type Consensus

type Consensus struct {
	NetowrkStatusVersion uint8

	ValidAfter time.Time
	FreshUntil time.Time
	ValidUntil time.Time

	SharedCurrentValue [32]byte

	RelayInformation []RouterStatus

	BandWidthWeight BandWidthWeight
	// contains filtered or unexported fields
}
var GlobalConsensus *Consensus

func GetGlobalConsensus

func GetGlobalConsensus() *Consensus

func ParseConsensus

func ParseConsensus(scanner *bufio.Scanner) (*Consensus, error)

type Family

type Family struct {
	Digest   []byte
	Nickname string
}

type FamilyIDs

type FamilyIDs struct {
	Kind  string
	Value []byte
}

type Microdesc

type Microdesc struct {
	OnionKey     []byte
	NTorOnionKey []byte            // curve25519
	IdEd25519    ed25519.PublicKey // ed25519
	Family       []Family
	Familys      []*FamilyIDs

	ExitRules *Ports
}

func ParseMicrodescFile

func ParseMicrodescFile(scanner *bufio.Scanner, digests []string) (microdesc []*Microdesc, err error)

type Ports

type Ports [65536 / 8]byte

func (*Ports) IsAllowed

func (p *Ports) IsAllowed(n uint16) bool

func (*Ports) SetPort

func (p *Ports) SetPort(n uint16, on bool)

type Proto

type Proto struct {
	Link      VersionValue
	LinkAuth  VersionValue
	Relay     VersionValue
	DirCache  VersionValue
	HSDir     VersionValue
	HSIntro   VersionValue
	HSRend    VersionValue
	Desc      VersionValue
	Microdesc VersionValue
	Cons      VersionValue
	Padding   VersionValue
	FlowCtrl  VersionValue
	Conflux   VersionValue
}

type RouterStatus

type RouterStatus struct {
	Nickname string
	NodeID   [20]byte

	Ipv4Addr string
	ORPort   uint16
	IPLevel  uint32

	MicrodescriptorDigest string

	DirPort uint16

	BandWidth uint32

	Ipv6Addr string // like [0000:00a:000:0000::000a]:8443 or empty string

	ProtoVersions Proto
	StatusFlags   [FLAG_ARRAY_LENGTH + 1]bool

	Ports Ports

	OnionKey     []byte
	NTorOnionKey *ecdh.PublicKey
	IdEd25519    []byte

	Family  []Family
	Familys []*FamilyIDs
}

type VersionValue

type VersionValue byte

func (*VersionValue) CheckIsTrue

func (v *VersionValue) CheckIsTrue(n uint8) bool

func (*VersionValue) SetValue

func (s *VersionValue) SetValue(n uint8, value bool)

Jump to

Keyboard shortcuts

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