host

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2020 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HostCmd

type HostCmd struct {
	*base.Base

	GlobalPeerstores track.Peerstores
	CurrentPeerstore track.DynamicPeerstore

	WithSetHost
	WithSetEnr
	WithCloseHost
}

func (*HostCmd) Cmd

func (c *HostCmd) Cmd(route string) (cmd interface{}, err error)

func (*HostCmd) Help

func (c *HostCmd) Help() string

func (*HostCmd) Routes

func (c *HostCmd) Routes() []string

type HostListenCmd

type HostListenCmd struct {
	*base.Base
	WithSetEnr

	IP net.IP `ask:"--ip" help:"If no IP is specified, network interfaces are checked for one."`

	TcpPort uint16 `ask:"--tcp" help:"If no tcp port is specified, it defaults to 9000."`
	UdpPort uint16 `ask:"--udp" help:"If no udp port is specified (= 0), UDP equals TCP."`
}

func (*HostListenCmd) Default

func (c *HostListenCmd) Default()

func (*HostListenCmd) Help

func (c *HostListenCmd) Help() string

func (*HostListenCmd) Run

func (c *HostListenCmd) Run(ctx context.Context, args ...string) error

type HostNotifyCmd

type HostNotifyCmd struct {
	*base.Base
}

func (*HostNotifyCmd) Help

func (c *HostNotifyCmd) Help() string

func (*HostNotifyCmd) HelpLong

func (c *HostNotifyCmd) HelpLong() string

func (*HostNotifyCmd) Run

func (c *HostNotifyCmd) Run(ctx context.Context, args ...string) error

type HostStartCmd

type HostStartCmd struct {
	*base.Base
	WithSetHost

	GlobalPeerstores track.Peerstores
	CurrentPeerstore track.DynamicPeerstore

	PrivKey          flags.P2pPrivKeyFlag `ask:"--priv" help:"hex-encoded private key for libp2p host. Random if none is specified."`
	TransportsStrArr []string             `ask:"--transport" help:"Transports to use. Options: tcp, ws"`
	MuxStrArr        []string             `ask:"--mux" help:"Multiplexers to use"`
	SecurityArr      []string             `ask:"--security" help:"Security to use. Multiple can be selected, order matters. Options: secio, noise, tls, none"`
	RelayEnabled     bool                 `ask:"--relay" help:"enable relayer functionality"`
	LoPeers          int                  `ask:"--lo-peers" help:"low-water for connection manager to trim peer count to"`
	HiPeers          int                  `ask:"--hi-peers" help:"high-water for connection manager to trim peer count from"`
	GracePeriod      time.Duration        `ask:"--peer-grace-period" help:"Time to grace a peer from being trimmed"`
	NatEnabled       bool                 `ask:"--nat" help:"enable nat address discovery (upnp/pmp)"`
	UserAgent        string               `ask:"--agent" help:"user agent string to use in libp2p identify protocol"`
}

func (*HostStartCmd) Default

func (c *HostStartCmd) Default()

func (*HostStartCmd) Help

func (c *HostStartCmd) Help() string

func (*HostStartCmd) Run

func (c *HostStartCmd) Run(ctx context.Context, args ...string) error

type HostState

type HostState struct {
	IP      net.IP
	TcpPort uint16
	UdpPort uint16
	// contains filtered or unexported fields
}

func (*HostState) CloseHost

func (s *HostState) CloseHost() error

func (*HostState) GetEnr

func (s *HostState) GetEnr() *enr.Record

func (*HostState) GetIP

func (s *HostState) GetIP() net.IP

func (*HostState) GetPriv

func (s *HostState) GetPriv() crypto.PrivKey

func (*HostState) GetTCP

func (s *HostState) GetTCP() uint16

func (*HostState) GetUDP

func (s *HostState) GetUDP() uint16

func (*HostState) Host

func (s *HostState) Host() (h host.Host, err error)

shortcut to check if there is a libp2p host available, and error-log if not available.

func (*HostState) SetHost

func (s *HostState) SetHost(h host.Host) error

func (*HostState) SetIP

func (s *HostState) SetIP(ip net.IP)

func (*HostState) SetTCP

func (s *HostState) SetTCP(port uint16)

func (*HostState) SetUDP

func (s *HostState) SetUDP(port uint16)

type HostStopCmd

type HostStopCmd struct {
	*base.Base
	WithCloseHost
}

func (*HostStopCmd) Help

func (c *HostStopCmd) Help() string

func (*HostStopCmd) Run

func (c *HostStopCmd) Run(ctx context.Context, args ...string) error

type HostViewCmd

type HostViewCmd struct {
	*base.Base
}

func (*HostViewCmd) Help

func (c *HostViewCmd) Help() string

func (*HostViewCmd) Run

func (c *HostViewCmd) Run(ctx context.Context, args ...string) error

type WithCloseHost

type WithCloseHost interface {
	CloseHost() error
}

type WithSetEnr

type WithSetEnr interface {
	SetIP(ip net.IP)
	SetTCP(port uint16)
	SetUDP(port uint16)
}

type WithSetHost

type WithSetHost interface {
	SetHost(h host.Host) error
}

Jump to

Keyboard shortcuts

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