utils

package
v0.0.0-...-73c7f38 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2019 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeDefaultRoutedHost

func MakeDefaultRoutedHost(listenPort int, priv crypto.PrivKey, useGlobalIPFSInstance bool) (host.Host, error)

MakeDefaultRoutedHost creates a default LibP2P host with a random peer ID listening on the given multiaddress.

func MakeRoutedHost

func MakeRoutedHost(listenPort int, priv crypto.PrivKey, bootstrapPeers []pstore.PeerInfo) (host.Host, error)

MakeRoutedHost creates a LibP2P host with a random peer ID listening on the given multiaddress. It will use secio if secio is true. It will bootstrap using the provided PeerInfo

func ReadFromProtectedStream

func ReadFromProtectedStream(ps ProtectedStream, m Message) error

func ReadFromReader

func ReadFromReader(r io.Reader, m Message, dbg string) error

func ReadFromStream

func ReadFromStream(s net.Stream, m Message) error

func WriteToProtectedStream

func WriteToProtectedStream(ps ProtectedStream, m Message) error

func WriteToStream

func WriteToStream(s net.Stream, m Message) error

func WriteToWriter

func WriteToWriter(w io.Writer, m Message, dbg string) error

Types

type IDOutput

type IDOutput struct {
	ID              string
	PublicKey       string
	Addresses       []string
	AgentVersion    string
	ProtocolVersion string
}

IDOutput Borrowed from ipfs code to parse the results of the command `ipfs id`

type Message

type Message interface {
	proto.Marshaler
	proto.Unmarshaler
}

Message A protobuf message

type ProtectedStream

type ProtectedStream struct {
	net.Stream
	RWMutex
}

ProtectedStream A stream protected by a RWMutex

func NewProtectedStream

func NewProtectedStream(s net.Stream) ProtectedStream

type RWMutex

type RWMutex struct {
	R, W *sync.Mutex
}

RWMutex A structure containing separate read and write mutexes

Jump to

Keyboard shortcuts

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