mc

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2016 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NATConfigNone = iota
	NATConfigAuto
	NATConfigManual
)
View Source
const MaxMessageSize = 2 << 20 // 1 MB
View Source
const NATPortMap = p2p_bhost.NATPortMap

re-export this option to avoid basic host interface leakage

Variables

View Source
var (
	BadAddressSpec = errors.New("Bad NAT address specification")
)
View Source
var BadHandle = errors.New("Bad handle")
View Source
var IfconfigError = errors.New("ifconfig service error")

Functions

func CompoundValue

func CompoundValue(val map[string]interface{}) (*pb.CompoundValue, error)

func FilterAddrs

func FilterAddrs(addrs []multiaddr.Multiaddr, predf func(multiaddr.Multiaddr) bool) []multiaddr.Multiaddr

func FormatHandle

func FormatHandle(pi p2p_pstore.PeerInfo) string

handle: multiaddr/p2p/id

func GetPublicIP

func GetPublicIP() (string, error)

func Hash

func Hash(data []byte) multihash.Multihash

func HashFromBytes

func HashFromBytes(hash []byte) multihash.Multihash

func IsLinkLocalAddr

func IsLinkLocalAddr(addr multiaddr.Multiaddr) bool

func IsLocalhostAddr

func IsLocalhostAddr(addr multiaddr.Multiaddr) bool

func IsPrivateAddr

func IsPrivateAddr(addr multiaddr.Multiaddr) bool

func IsPublicAddr

func IsPublicAddr(addr multiaddr.Multiaddr) bool

func IsRoutableAddr

func IsRoutableAddr(addr multiaddr.Multiaddr) bool

func NewHost

func NewHost(ctx context.Context, id PeerIdentity, laddr multiaddr.Multiaddr, opts ...interface{}) (p2p_host.Host, error)

func PBFromPeerInfo

func PBFromPeerInfo(pbpi *pb.PeerInfo, pinfo p2p_pstore.PeerInfo)

func PBToPeerInfo

func PBToPeerInfo(pbpi *pb.PeerInfo) (empty p2p_pstore.PeerInfo, err error)

func ParseAddress

func ParseAddress(str string) (multiaddr.Multiaddr, error)

func ParseHandle

func ParseHandle(str string) (empty p2p_pstore.PeerInfo, err error)

parses multiaddr[/p2p]/id (backwards compatible)

func ParseHandleId

func ParseHandleId(str string) (empty p2p_pstore.PeerInfo, err error)

func PublisherID58

func PublisherID58(pubk p2p_crypto.PubKey) (string, error)

func PublisherKey

func PublisherKey(id58 string) (p2p_crypto.PubKey, error)

func SimpleValue

func SimpleValue(val interface{}) (*pb.SimpleValue, error)

func SimpleValueOf

func SimpleValueOf(sv *pb.SimpleValue) (interface{}, error)

func ValueOf

func ValueOf(res *pb.QueryResultValue) (interface{}, error)

Types

type NATConfig

type NATConfig struct {
	Opt int
	// contains filtered or unexported fields
}

func NATConfigFromString

func NATConfigFromString(str string) (cfg NATConfig, err error)

func (*NATConfig) Clear

func (cfg *NATConfig) Clear()

func (*NATConfig) PublicAddr

func (cfg *NATConfig) PublicAddr(base multiaddr.Multiaddr) (multiaddr.Multiaddr, error)

func (*NATConfig) String

func (cfg *NATConfig) String() string

type PeerIdentity

type PeerIdentity struct {
	ID      p2p_peer.ID
	PrivKey p2p_crypto.PrivKey
}

Node identities: PeerIdentity and PublisherIdentity the structs are different because the semantics of id differ PeerIdentities use the raw public key hash as dictated by libp2p

they use RSA keys for interop with js, which is lagging in libp2p-crypto

PublisherIdentities use the base58 encoded public key as identifier

they use ECC (Ed25519) keys and sign statements with them

func MakePeerIdentity

func MakePeerIdentity(home string) (empty PeerIdentity, err error)

Peer Identities

func (PeerIdentity) Pretty

func (id PeerIdentity) Pretty() string

type PublisherIdentity

type PublisherIdentity struct {
	ID58    string
	PrivKey p2p_crypto.PrivKey
}

func MakePublisherIdentity

func MakePublisherIdentity(home string) (empty PublisherIdentity, err error)

Publisher Identities

func (PublisherIdentity) Pretty

func (id PublisherIdentity) Pretty() string

type ValueError

type ValueError string

func (ValueError) Error

func (v ValueError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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