translator

package
v0.33.33-no-read-segment Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2024 License: AGPL-3.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FixedTableIdentityTranslator

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

FixedTableIdentityTranslator implements an IDTranslator which translates ID's for a fixed list of identities.

func NewFixedTableIdentityTranslator

func NewFixedTableIdentityTranslator(identities flow.IdentityList) (*FixedTableIdentityTranslator, error)

func (*FixedTableIdentityTranslator) GetFlowID

func (*FixedTableIdentityTranslator) GetPeerID

type HierarchicalIDTranslator

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

HierarchicalIDTranslator implements an IDTranslator which combines the ID translation capabilities of multiple IDTranslators. When asked to translate an ID, it will iterate through all of the IDTranslators it was given and return the first successful translation.

func NewHierarchicalIDTranslator

func NewHierarchicalIDTranslator(translators ...p2p.IDTranslator) *HierarchicalIDTranslator

func (*HierarchicalIDTranslator) GetFlowID

func (t *HierarchicalIDTranslator) GetFlowID(peerID peer.ID) (flow.Identifier, error)

func (*HierarchicalIDTranslator) GetPeerID

func (t *HierarchicalIDTranslator) GetPeerID(flowID flow.Identifier) (peer.ID, error)

type IdentityProviderIDTranslator

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

IdentityProviderIDTranslator implements an `p2p.IDTranslator` which provides ID translation capabilities for an IdentityProvider.

func NewIdentityProviderIDTranslator

func NewIdentityProviderIDTranslator(provider module.IdentityProvider) *IdentityProviderIDTranslator

func (*IdentityProviderIDTranslator) GetFlowID

func (*IdentityProviderIDTranslator) GetPeerID

type PublicNetworkIDTranslator

type PublicNetworkIDTranslator struct{}

PublicNetworkIDTranslator implements an `p2p.IDTranslator` which translates IDs for peers on the unstaked network. On the unstaked network, a Flow ID is derived from a peer ID by extracting the public key from the peer ID, dropping the first byte (parity byte), and using the remaining 32 bytes as the Flow ID. Network keys for unstaked nodes must be generated using the Secp256k1 curve, and must be positive. It is assumed that these requirements are enforced during key generation, and any peer ID's which don't follow these conventions are considered invalid.

func NewPublicNetworkIDTranslator

func NewPublicNetworkIDTranslator() *PublicNetworkIDTranslator

TODO Rename this one to NewPublicNetworkIDTranslator once observer changes are merged

func (*PublicNetworkIDTranslator) GetFlowID

func (t *PublicNetworkIDTranslator) GetFlowID(peerID peer.ID) (flow.Identifier, error)

GetFlowID returns the Flow ID for the given peer ID. TODO: implement BFT-compliant error handling -> https://github.com/onflow/flow-go/blob/master/CodingConventions.md

func (*PublicNetworkIDTranslator) GetPeerID

func (t *PublicNetworkIDTranslator) GetPeerID(flowID flow.Identifier) (peer.ID, error)

GetPeerID returns the peer ID for the given Flow ID. TODO: implement BFT-compliant error handling -> https://github.com/onflow/flow-go/blob/master/CodingConventions.md

Jump to

Keyboard shortcuts

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