libp2p

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2020 License: BSD-3-Clause Imports: 41 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStream

func NewStream(s network.Stream) p2p.Stream

Types

type Options

type Options struct {
	PrivateKey     *ecdsa.PrivateKey
	NATAddr        string
	EnableWS       bool
	EnableQUIC     bool
	LightNode      bool
	WelcomeMessage string
	Addressbook    addressbook.Putter
	Logger         logging.Logger
	Tracer         *tracing.Tracer
}

type Service

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

func New

func New(ctx context.Context, signer beecrypto.Signer, networkID uint64, overlay swarm.Address, addr string,
	o Options) (*Service, error)

func (*Service) AddProtocol

func (s *Service) AddProtocol(p p2p.ProtocolSpec) (err error)

func (*Service) Addresses

func (s *Service) Addresses() (addreses []ma.Multiaddr, err error)

func (*Service) Close

func (s *Service) Close() error

func (*Service) Connect

func (s *Service) Connect(ctx context.Context, addr ma.Multiaddr) (address *bzz.Address, err error)

func (*Service) Disconnect

func (s *Service) Disconnect(overlay swarm.Address) error

func (*Service) Metrics

func (s *Service) Metrics() []prometheus.Collector

func (*Service) NATManager

func (s *Service) NATManager() basichost.NATManager

func (*Service) NewStream

func (s *Service) NewStream(ctx context.Context, overlay swarm.Address, headers p2p.Headers, protocolName, protocolVersion, streamName string) (p2p.Stream, error)

func (*Service) Peers

func (s *Service) Peers() []p2p.Peer

func (*Service) SetNotifier

func (s *Service) SetNotifier(n topology.Notifier)

type UpnpAddressResolver

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

func (*UpnpAddressResolver) Resolve

func (r *UpnpAddressResolver) Resolve(observedAddress ma.Multiaddr) (ma.Multiaddr, error)

Resolve checks if there is a possible better advertisable underlay then the provided observed address. In some NAT situations, for example in the case when nodes are behind upnp, observer might send the observed address with a wrong port. In this case, observed address is compared to addresses provided by host, and if there is a same address but with different port, that one is used as advertisable address instead of provided observed one. TODO: this is a quickfix and it will be improved in the future

Directories

Path Synopsis
internal
handshake/pb
Package pb holds only Protocol Buffer definitions and generated code.
Package pb holds only Protocol Buffer definitions and generated code.
headers/pb
Package pb holds only Protocol Buffer definitions and generated code.
Package pb holds only Protocol Buffer definitions and generated code.

Jump to

Keyboard shortcuts

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