warpnet

package
v0.4.49 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2025 License: AGPL-3.0, AGPL-3.0-or-later Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BootstrapOwner = "bootstrap"
	ModeratorOwner = "moderator"
	WarpnetName    = "warpnet"
	NoiseID        = noise.ID

	Connected = network.Connected
	Limited   = network.Limited

	P_IP4 = multiaddr.P_IP4
	P_IP6 = multiaddr.P_IP6
	P_TCP = multiaddr.P_TCP

	PermanentTTL = peerstore.PermanentAddrTTL

	ErrNodeIsOffline = WarpError("node is offline")
	ErrUserIsOffline = WarpError("user is offline")

	ReachabilityPublic  WarpReachability = network.ReachabilityPublic
	ReachabilityPrivate WarpReachability = network.ReachabilityPrivate
	ReachabilityUnknown WarpReachability = network.ReachabilityUnknown
)
View Source
const (
	RelayStatusOff     relayStatus = "off"
	RelayStatusWaiting relayStatus = "waiting"
	RelayStatusRunning relayStatus = "running"
)

Variables

View Source
var ErrAllDialsFailed = swarm.ErrAllDialsFailed

Functions

func FromIDToPubKey added in v0.4.27

func FromIDToPubKey(id peer.ID) ed25519.PublicKey

func GetCPUStats

func GetCPUStats() map[string]string

func GetMacAddr

func GetMacAddr() string

func GetMemoryStats

func GetMemoryStats() map[string]string

func GetNetworkIO

func GetNetworkIO() (bytesSent int64, bytesRecv int64)

func IsPublicMultiAddress

func IsPublicMultiAddress(maddr WarpAddress) bool

func IsRelayAddress

func IsRelayAddress(addr string) bool

func IsRelayMultiaddress

func IsRelayMultiaddress(maddr multiaddr.Multiaddr) bool

func NewAutoScaledLimiter

func NewAutoScaledLimiter() rcmgr.Limiter

func NewConnManager

func NewConnManager(limiter rcmgr.Limiter) (*connmgr.BasicConnMgr, error)

func NewMultiaddr

func NewMultiaddr(s string) (a multiaddr.Multiaddr, err error)

func NewNoise

func NewNoise(id protocol.ID, pk p2pCrypto.PrivKey, mxs []tptu.StreamMuxer) (*noise.Transport, error)

func NewResourceManager

func NewResourceManager(limiter rcmgr.Limiter) (network.ResourceManager, error)

func UnmarshalEd25519PublicKey added in v0.2.509

func UnmarshalEd25519PublicKey(data []byte) (p2pCrypto.PubKey, error)

Types

type NodeInfo

type NodeInfo struct {
	OwnerId        string           `json:"owner_id"`
	ID             WarpPeerID       `json:"node_id"`
	Version        *semver.Version  `json:"version"`
	Addresses      []string         `json:"addresses"`
	StartTime      time.Time        `json:"start_time"`
	RelayState     relayStatus      `json:"relay_state"`
	BootstrapPeers []WarpAddrInfo   `json:"bootstrap_peers"`
	Reachability   WarpReachability `json:"reachability"`
}

func (NodeInfo) IsBootstrap

func (ni NodeInfo) IsBootstrap() bool

type NodeStats

type NodeStats struct {
	UserId          string          `json:"user_id"`
	NodeID          WarpPeerID      `json:"node_id"`
	Version         *semver.Version `json:"version"`
	PublicAddresses string          `json:"public_addresses"`
	RelayState      relayStatus     `json:"relay_state"`

	StartTime string `json:"start_time"`

	NetworkState string `json:"network_state"`

	DatabaseStats  map[string]string `json:"database_stats"`
	ConsensusStats map[string]string `json:"consensus_stats"`
	MemoryStats    map[string]string `json:"memory_stats"`
	CPUStats       map[string]string `json:"cpu_stats"`

	BytesSent     int64 `json:"bytes_sent"`
	BytesReceived int64 `json:"bytes_received"`

	PeersOnline int `json:"peers_online"`
	PeersStored int `json:"peers_stored"`
}

type P2PNode

type P2PNode = host.Host

func NewP2PNode

func NewP2PNode(opts ...libp2p.Option) (P2PNode, error)

type PSK

type PSK = pnet.PSK

type StreamHandler added in v0.4.21

type StreamHandler = network.StreamHandler

type Swarm

type Swarm = swarm.Swarm

type SwarmOption

type SwarmOption = swarm.Option

type TCPOption

type TCPOption = tcp.Option

type TCPTransport

type TCPTransport = tcp.TcpTransport

type WarpAddrInfo

type WarpAddrInfo = peer.AddrInfo

func AddrInfoFromP2pAddr

func AddrInfoFromP2pAddr(m multiaddr.Multiaddr) (*WarpAddrInfo, error)

func AddrInfoFromString

func AddrInfoFromString(s string) (*WarpAddrInfo, error)

type WarpAddress

type WarpAddress = multiaddr.Multiaddr

type WarpAutoNAT added in v0.2.494

type WarpAutoNAT = autonat.AutoNAT

type WarpBatching

type WarpBatching = datastore.Batching

type WarpConnManager added in v0.2.494

type WarpConnManager = coreconnmgr.ConnManager

type WarpDHT

type WarpDHT = dht.IpfsDHT

type WarpError

type WarpError string

func (WarpError) Error

func (e WarpError) Error() string

type WarpEventBus added in v0.2.494

type WarpEventBus = event.Bus

type WarpGossiper

type WarpGossiper interface {
	Close() error
}

interfaces

type WarpHandlerFunc added in v0.4.21

type WarpHandlerFunc func(msg []byte, s WarpStream) (any, error)

type WarpIDService added in v0.2.494

type WarpIDService = identify.IDService

type WarpMDNS

type WarpMDNS mdns.Service

types

type WarpMessage added in v0.3.113

type WarpMessage = pubsub.Message

aliases

type WarpNetwork

type WarpNetwork = network.Network

type WarpOption added in v0.3.106

type WarpOption = libp2p.Option

type WarpPeerID

type WarpPeerID = peer.ID

func FromBytesToPeerID

func FromBytesToPeerID(b []byte) WarpPeerID

func FromStringToPeerID

func FromStringToPeerID(s string) WarpPeerID

func IDFromPublicKey added in v0.2.499

func IDFromPublicKey(pk ed25519.PublicKey) (WarpPeerID, error)

type WarpPeerRouting

type WarpPeerRouting = routing.PeerRouting

type WarpPeerstore

type WarpPeerstore = peerstore.Peerstore

func NewPeerstore

func NewPeerstore(ctx context.Context, db datastore.Batching) (WarpPeerstore, error)

type WarpPrivateKey

type WarpPrivateKey p2pCrypto.PrivKey

type WarpProtocolID

type WarpProtocolID = protocol.ID

type WarpProtocolSwitch

type WarpProtocolSwitch = protocol.Switch

type WarpProviderStore

type WarpProviderStore = providers.ProviderStore

type WarpPubInfo added in v0.2.494

type WarpPubInfo struct {
	ID    WarpPeerID `json:"peer_id"`
	Addrs []string   `json:"addrs"`
}

type WarpReachability added in v0.2.494

type WarpReachability = network.Reachability

type WarpRelayCloser

type WarpRelayCloser interface {
	Close() error
}

interfaces

type WarpRoutingFunc

type WarpRoutingFunc func(node P2PNode) (WarpPeerRouting, error)

type WarpStream

type WarpStream = network.Stream

type WarpStreamBody added in v0.4.21

type WarpStreamBody struct {
	WarpStream
	Body []byte
}

type WarpStreamHandler

type WarpStreamHandler struct {
	Path    WarpProtocolID
	Handler WarpHandlerFunc
}

structures

func (*WarpStreamHandler) IsValid added in v0.4.21

func (wh *WarpStreamHandler) IsValid() bool

func (*WarpStreamHandler) String added in v0.4.21

func (wh *WarpStreamHandler) String() string

type WarpStreamStats

type WarpStreamStats = network.Stats

Jump to

Keyboard shortcuts

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