Documentation
¶
Overview ¶
Package pki provides the mix network PKI related interfaces.
Index ¶
- Constants
- Variables
- type Client
- type Document
- func (d *Document) GetMix(name string) (*MixDescriptor, error)
- func (d *Document) GetMixByKey(key []byte) (*MixDescriptor, error)
- func (d *Document) GetMixesInLayer(layer uint8) ([]*MixDescriptor, error)
- func (d *Document) GetNode(name string) (*MixDescriptor, error)
- func (d *Document) GetNodeByKey(key []byte) (*MixDescriptor, error)
- func (d *Document) GetProvider(name string) (*MixDescriptor, error)
- func (d *Document) GetProviderByKey(key []byte) (*MixDescriptor, error)
- func (d *Document) String() string
- type MixDescriptor
- type Transport
Constants ¶
const LayerProvider = 255
LayerProvider is the Layer that providers list in their MixDescriptors.
Variables ¶
var ( // ErrNoDocument is the error returned when there never will be a document // for a given epoch. ErrNoDocument = errors.New("pki: requested epoch will never get a document") // ErrInvalidPostEpoch is the error returned when the server rejects a // descriptor upload for a given epoch due to time reasons. ErrInvalidPostEpoch = errors.New("pki: post for epoch will never succeeed") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
// Get returns the PKI document along with the raw serialized form for the provided epoch.
Get(ctx context.Context, epoch uint64) (*Document, []byte, error)
// Post posts the node's descriptor to the PKI for the provided epoch.
Post(ctx context.Context, epoch uint64, signingKey *eddsa.PrivateKey, d *MixDescriptor) error
// Deserialize returns PKI document given the raw bytes.
Deserialize(raw []byte) (*Document, error)
}
Client is the abstract interface used for PKI interaction.
type Document ¶
type Document struct {
// Epoch is the epoch for which this Document instance is valid for.
Epoch uint64
// MixLambda is the inverse of the mean of the exponential distribution
// that the Sphinx packet per-hop mixing delay will be sampled from.
MixLambda float64
// MixMaxDelay is the maximum Sphinx packet per-hop mixing delay in
// milliseconds.
MixMaxDelay uint64
// SendLambda is the inverse of the mean of the exponential distribution
// that clients will sample to determine send timing.
SendLambda float64
// SendShift is the shift applied to the client send timing samples in
// milliseconds.
SendShift uint64
// SendMaxInterval is the maximum send interval in milliseconds, enforced
// prior to (excluding) SendShift.
SendMaxInterval uint64
// Topology is the mix network topology, excluding providers.
Topology [][]*MixDescriptor
// Providers is the list of providers that can interact with the mix
// network.
Providers []*MixDescriptor
}
Document is a PKI document.
func (*Document) GetMix ¶
func (d *Document) GetMix(name string) (*MixDescriptor, error)
GetMix returns the MixDescriptor for the given mix Name.
func (*Document) GetMixByKey ¶
func (d *Document) GetMixByKey(key []byte) (*MixDescriptor, error)
GetMixByKey returns the specific mix descriptor corresponding to the specified IdentityKey.
func (*Document) GetMixesInLayer ¶
func (d *Document) GetMixesInLayer(layer uint8) ([]*MixDescriptor, error)
GetMixesInLayer returns all the mix descriptors for a given layer.
func (*Document) GetNode ¶
func (d *Document) GetNode(name string) (*MixDescriptor, error)
GetNode returns the specific descriptor corresponding to the specified node Name.
func (*Document) GetNodeByKey ¶
func (d *Document) GetNodeByKey(key []byte) (*MixDescriptor, error)
GetNodeByKey returns the specific descriptor corresponding to the specified IdentityKey.
func (*Document) GetProvider ¶
func (d *Document) GetProvider(name string) (*MixDescriptor, error)
GetProvider returns the MixDescriptor for the given provider Name.
func (*Document) GetProviderByKey ¶
func (d *Document) GetProviderByKey(key []byte) (*MixDescriptor, error)
GetProviderByKey returns the specific provider descriptor corresponding to the specified IdentityKey.
type MixDescriptor ¶
type MixDescriptor struct {
// Name is the human readable (descriptive) node identifier.
Name string
// IdentityKey is the node's identity (signing) key.
IdentityKey *eddsa.PublicKey
// LinkKey is the node's wire protocol public key.
LinkKey *ecdh.PublicKey
// MixKeys is a map of epochs to Sphinx keys.
MixKeys map[uint64]*ecdh.PublicKey
// Addresses is the map of transport to address combinations that can
// be used to reach the node.
Addresses map[Transport][]string
// Kaetzchen is the map of provider autoresponder agents by capability
// to parameters.
Kaetzchen map[string]map[string]interface{} `json:",omitempty"`
// Layer is the topology layer.
Layer uint8
// LoadWeight is the node's load balancing weight (unused).
LoadWeight uint8
}
MixDescriptor is a description of a given Mix or Provider (node).
type Transport ¶
type Transport string
Transport is a link transport protocol.
var ( // TransportInvalid is the invalid transport. TransportInvalid Transport // TransportTCP is TCP, with the IP version determined by the results of // a name server lookup. TransportTCP Transport = "tcp" // TransportTCPv4 is TCP over IPv4. TransportTCPv4 Transport = "tcp4" // TransportTCPv6 is TCP over IPv6. TransportTCPv6 Transport = "tcp6" // InternalTransports is the list of transports used for non-client related // communications. InternalTransports = []Transport{TransportTCPv4, TransportTCPv6} // ClientTransports is the list of transports used by default for client // to provider communication. ClientTransports = []Transport{TransportTCP, TransportTCPv4, TransportTCPv6} )