base

package
v0.3.15 Latest Latest
Warning

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

Go to latest
Published: May 31, 2025 License: GPL-2.0, GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTimeout = 60 * time.Second
View Source
const ErrSelfRequest = warpnet.WarpError("self request is not allowed")

Variables

This section is empty.

Functions

func EmptyOption added in v0.2.494

func EmptyOption() func() libp2p.Option

func EnableAutoRelayWithStaticRelays

func EnableAutoRelayWithStaticRelays(static []warpnet.WarpAddrInfo, currentNodeID warpnet.WarpPeerID) func() libp2p.Option

func WithDefaultTCPConnectionTimeout

func WithDefaultTCPConnectionTimeout(t time.Duration) warpnet.TCPOption

func WithDialTimeout

func WithDialTimeout(t time.Duration) warpnet.SwarmOption

func WithDialTimeoutLocal

func WithDialTimeoutLocal(t time.Duration) warpnet.SwarmOption

Types

type BackoffEnabler added in v0.2.481

type BackoffEnabler interface {
	IsBackoffEnabled(id peer.ID) bool
	Reset(id peer.ID)
}

type Streamer

type Streamer interface {
	Send(peerAddr warpnet.WarpAddrInfo, r stream.WarpRoute, data []byte) ([]byte, error)
}

type WarpNode

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

func NewWarpNode

func NewWarpNode(
	ctx context.Context,
	privKey ed25519.PrivateKey,
	store warpnet.WarpPeerstore,
	psk security.PSK,
	listenAddrs []string,
	routingFn func(node warpnet.P2PNode) (warpnet.WarpPeerRouting, error),
) (*WarpNode, error)

func (*WarpNode) BaseNodeInfo added in v0.3.8

func (n *WarpNode) BaseNodeInfo() warpnet.NodeInfo

func (*WarpNode) Connect

func (n *WarpNode) Connect(p warpnet.WarpAddrInfo) error

func (*WarpNode) Mux

func (*WarpNode) Network

func (n *WarpNode) Network() warpnet.WarpNetwork

func (*WarpNode) Node

func (n *WarpNode) Node() warpnet.P2PNode

func (*WarpNode) Peerstore

func (n *WarpNode) Peerstore() warpnet.WarpPeerstore

func (*WarpNode) SetStreamHandler

func (n *WarpNode) SetStreamHandler(route stream.WarpRoute, handler warpnet.WarpStreamHandler)

func (*WarpNode) SimpleConnect added in v0.3.5

func (n *WarpNode) SimpleConnect(info warpnet.WarpAddrInfo) error

func (*WarpNode) StopNode

func (n *WarpNode) StopNode()

func (*WarpNode) Stream

func (n *WarpNode) Stream(nodeId warpnet.WarpPeerID, path stream.WarpRoute, data any) (_ []byte, err error)

Jump to

Keyboard shortcuts

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