warpnet

package
v0.2.477 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	BootstrapOwner = "bootstrap"
	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

	PermanentAddrTTL = peerstore.PermanentAddrTTL

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

Variables

View Source
var ErrAllDialsFailed = swarm.ErrAllDialsFailed

Functions

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 crypto.PrivKey, mxs []tptu.StreamMuxer) (*noise.Transport, error)

func NewP2PNode

func NewP2PNode(opts ...libp2p.Option) (host.Host, error)

func NewResourceManager

func NewResourceManager(limiter rcmgr.Limiter) (network.ResourceManager, 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     string          `json:"relay_state"`
	BootstrapPeers []PeerAddrInfo  `json:"bootstrap_peers"`
	PSKHash        string          `json:"psk_hash"`
}

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      string          `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

type PSK

type PSK = pnet.PSK

type PeerAddrInfo

type PeerAddrInfo = peer.AddrInfo

func AddrInfoFromP2pAddr

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

func AddrInfoFromString

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

type Swarm

type Swarm = swarm.Swarm

type SwarmOption

type SwarmOption = swarm.Option

type TCPOption

type TCPOption = tcp.Option

type TCPTransport

type TCPTransport = tcp.TcpTransport

aliases

type WarpAddrInfo

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

structures

type WarpAddress

type WarpAddress = multiaddr.Multiaddr

type WarpBatching

type WarpBatching = datastore.Batching

type WarpDHT

type WarpDHT = dht.IpfsDHT

type WarpError

type WarpError string

func (WarpError) Error

func (e WarpError) Error() string

type WarpGossiper

type WarpGossiper interface {
	Close() error
}

interfaces

type WarpMDNS

type WarpMDNS mdns.Service

type WarpNetwork

type WarpNetwork = network.Network

type WarpPeerID

type WarpPeerID = peer.ID

func FromBytesToPeerID

func FromBytesToPeerID(b []byte) WarpPeerID

func FromStringToPeerID

func FromStringToPeerID(s string) WarpPeerID

func IDFromPrivateKey

func IDFromPrivateKey(sk crypto.PrivKey) (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 crypto.PrivKey

type WarpProtocolID

type WarpProtocolID = protocol.ID

type WarpProtocolSwitch

type WarpProtocolSwitch = protocol.Switch

type WarpProviderStore

type WarpProviderStore = providers.ProviderStore

type WarpRelayCloser

type WarpRelayCloser interface {
	Close() error
}

interfaces

type WarpRoutingFunc

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

type WarpStream

type WarpStream = network.Stream

type WarpStreamHandler

type WarpStreamHandler = network.StreamHandler

type WarpStreamStats

type WarpStreamStats = network.Stats

Jump to

Keyboard shortcuts

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