powergate: github.com/textileio/powergate/net Index | Files | Directories

package net

import "github.com/textileio/powergate/net"

Index

Package Files

interface.go

type Connectedness Uses

type Connectedness int

Connectedness signals the capacity for a connection with a given node.

const (
    // Unspecified means unable to determine connectedness.
    Unspecified Connectedness = iota

    // NotConnected means no connection to peer, and no extra information (default).
    NotConnected

    // Connected means has an open, live connection to peer.
    Connected

    // CanConnect means recently connected to peer, terminated gracefully.
    CanConnect

    // CannotConnect means recently attempted connecting but failed to connect.
    CannotConnect

    // Error means there was an error determining connectedness.
    Error
)

func (Connectedness) String Uses

func (s Connectedness) String() string

type Module Uses

type Module interface {
    // ListenAddr returns listener address info for the local node.
    ListenAddr(context.Context) (peer.AddrInfo, error)
    // Peers returns a list of peers.
    Peers(context.Context) ([]PeerInfo, error)
    // FindPeer finds a peer by peer id
    FindPeer(context.Context, peer.ID) (PeerInfo, error)
    // ConnectPeer connects to a peer.
    ConnectPeer(context.Context, peer.AddrInfo) error
    // DisconnectPeer disconnects from a peer.
    DisconnectPeer(context.Context, peer.ID) error
    // Connectedness returns the connection status to a peer.
    Connectedness(context.Context, peer.ID) (Connectedness, error)
}

Module defines the net API.

type PeerInfo Uses

type PeerInfo struct {
    AddrInfo peer.AddrInfo
    Location *iplocation.Location
}

PeerInfo provides address info and location info about a peer.

Directories

PathSynopsis
lotus
rpc

Package net imports 3 packages (graph) and is imported by 15 packages. Updated 2020-09-21. Refresh now. Tools for package owners.