Documentation
¶
Overview ¶
Package node pkg/cxo/node/config.go c2-net-cxo
Package node pkg/cxo/node/conn.go c2-net-cxo
Package node pkg/cxo/node/errors.go c2-net-cxo
Package node pkg/cxo/node/feed.go c2-net-cxo
Package node pkg/cxo/node/feeds.go c2-net-cxo
Package node pkg/cxo/node/handshake.go c2-net-cxo
Package node pkg/cxo/node/head.go c2-net-cxo
Package node pkg/cxo/node/logs.go c2-net-cxo
Package node pkg/cxo/node/node.go c2-net-cxo
Package node pkg/cxo/node/rpc.go c2-net-cxo
Package node pkg/cxo/node/rpc_client.go c2-net-cxo
Package node pkg/cxo/node/swarm.go c2-net-cxo
Package node pkg/cxo/node/transport_dmsg.go c2-net-cxo transport_dmsg.go implements the DMSG transport for CXO nodes, allowing CXO peer connections over skywire's DMSG network.
Package node pkg/cxo/node/transports.go c2-net-cxo
Index ¶
- Constants
- Variables
- type Config
- type Conn
- func (c *Conn) Address() (address string)
- func (c *Conn) Close() (err error)
- func (c *Conn) Done() <-chan struct{}
- func (c *Conn) Feeds() (feeds []cipher.PubKey)
- func (c *Conn) Getter() skyobject.Getter
- func (c *Conn) HasFeed(feed cipher.PubKey) bool
- func (c *Conn) IsIncoming() (ok bool)
- func (c *Conn) IsOutgoing() (ok bool)
- func (c *Conn) Node() (node *Node)
- func (c *Conn) PeerID() (id cipher.PubKey)
- func (c *Conn) Preview(feed cipher.PubKey, previewFunc PreviewFunc) (err error)
- func (c *Conn) RemoteFeeds() (feeds []cipher.PubKey, err error)
- func (c *Conn) String() string
- func (c *Conn) Subscribe(feed cipher.PubKey) (err error)
- func (c *Conn) Unsubscribe(feed cipher.PubKey)
- type ConnFeed
- type DMSG
- func (d *DMSG) CloseConn(pk cipher.PubKey) error
- func (d *DMSG) ConnectPK(ctx context.Context, remotePK cipher.PubKey) (*Conn, error)
- func (d *DMSG) Connections() []cipher.PubKey
- func (d *DMSG) Drop(pk cipher.PubKey)
- func (d *DMSG) Listen() error
- func (d *DMSG) PeerAddr(pk cipher.PubKey) (net.Addr, bool)
- type DMSGConnFeed
- type DMSGRPC
- type NetConfig
- type Node
- func (n *Node) Close() (err error)
- func (n *Node) Config() (conf *Config)
- func (n *Node) Connections() (cs []*Conn)
- func (n *Node) ConnectionsOfFeed(feed cipher.PubKey) (cs []*Conn)
- func (n *Node) Container() (c *skyobject.Container)
- func (n *Node) DMSG() *DMSG
- func (n *Node) DontShare(feed cipher.PubKey) (err error)
- func (n *Node) EnableDMSG(factory *transport.DMSGFactory) error
- func (n *Node) Feeds() (feeds []cipher.PubKey)
- func (n *Node) ID() (id cipher.PubKey)
- func (n *Node) InSwarm(feed cipher.PubKey) (*Swarm, bool)
- func (n *Node) IsSharing(feed cipher.PubKey) (ok bool)
- func (n *Node) JoinSwarm(feed cipher.PubKey, cfg SwarmConfig) (*Swarm, error)
- func (n *Node) LeaveSwarm(feed cipher.PubKey) error
- func (n *Node) Publish(r *registry.Root)
- func (n *Node) SetDMSG(d *DMSG)
- func (n *Node) Share(feed cipher.PubKey) (err error)
- func (n *Node) Stat() (s *Stat)
- func (n *Node) Stats() PublisherStats
- func (n *Node) SwapOnFillingBreaks(next func(*Node, *registry.Root, error)) (prev func(*Node, *registry.Root, error))
- func (n *Node) SwapOnRootFilled(next func(*Node, *registry.Root)) (prev func(*Node, *registry.Root))
- func (n *Node) TCP() (tcp *TCP)
- func (n *Node) UDP() (tcp *UDP)
- type OnConnectFunc
- type OnDisconnectFunc
- type OnFillingBreaksFunc
- type OnPeerAddedFunc
- type OnPeerRemovedFunc
- type OnPeerUpdatedFunc
- type OnRootFilledFunc
- type OnRootReceivedFunc
- type OnSubscribeRemoteFunc
- type OnUnsubscribeRemoteFunc
- type Peer
- type PreviewFunc
- type PublisherStats
- type RPC
- func (r *RPC) Config(_ struct{}, config *Config) (err error)
- func (r *RPC) Connections(_ struct{}, cs *[]string) (_ error)
- func (r *RPC) ConnectionsOfFeed(feed cipher.PubKey, cs *[]string) (_ error)
- func (r *RPC) DontShare(pk cipher.PubKey, _ *struct{}) (err error)
- func (r *RPC) Feeds(_ struct{}, fs *[]cipher.PubKey) (_ error)
- func (r *RPC) IsSharing(pk cipher.PubKey, yep *bool) (_ error)
- func (r *RPC) Share(pk cipher.PubKey, _ *struct{}) (err error)
- func (r *RPC) Shutdown(_ struct{}, _ *struct{}) error
- func (r *RPC) Stat(_ struct{}, stat *Stat) (err error)
- type RPCClient
- type RPCClientNode
- func (r *RPCClientNode) Config() (config *Config, err error)
- func (r *RPCClientNode) Connections() (cs []string, err error)
- func (r *RPCClientNode) ConnectionsOfFeed(pk cipher.PubKey) (cs []string, err error)
- func (r *RPCClientNode) DontShare(pk cipher.PubKey) (err error)
- func (r *RPCClientNode) Feeds() (fs []cipher.PubKey, err error)
- func (r *RPCClientNode) IsSharing(pk cipher.PubKey) (yep bool, err error)
- func (r *RPCClientNode) Share(pk cipher.PubKey) (err error)
- func (r *RPCClientNode) Shutdown() error
- func (r *RPCClientNode) Stat() (stat *Stat, err error)
- type RPCClientRoot
- type RPCClientTCP
- func (r *RPCClientTCP) Address() (address string, err error)
- func (r *RPCClientTCP) Connect(address string) (err error)
- func (r *RPCClientTCP) Disconnect(address string) (err error)
- func (r *RPCClientTCP) RemoteFeeds(address string) (rfs []cipher.PubKey, err error)
- func (r *RPCClientTCP) Subscribe(address string, pk cipher.PubKey) (err error)
- func (r *RPCClientTCP) Unsubscribe(address string, pk cipher.PubKey) (err error)
- type RPCClientUDP
- func (r *RPCClientUDP) Address() (address string, err error)
- func (r *RPCClientUDP) Connect(address string) (err error)
- func (r *RPCClientUDP) Disconnect(address string) (err error)
- func (r *RPCClientUDP) RemoteFeeds(address string) (rfs []cipher.PubKey, err error)
- func (r *RPCClientUDP) Subscribe(address string, pk cipher.PubKey) (err error)
- func (r *RPCClientUDP) Unsubscribe(address string, pk cipher.PubKey) (err error)
- type RootRPC
- type RootSelector
- type Stat
- type Swarm
- type SwarmConfig
- type TCP
- type TCPRPC
- func (t *TCPRPC) Address(_ struct{}, address *string) (_ error)
- func (t *TCPRPC) Connect(address string, _ *struct{}) (err error)
- func (t *TCPRPC) Disconnect(address string, _ *struct{}) (err error)
- func (t *TCPRPC) RemoteFeeds(address string, rfs *[]cipher.PubKey) (err error)
- func (t *TCPRPC) Subscribe(cf ConnFeed, _ *struct{}) (err error)
- func (t *TCPRPC) Unsubscribe(cf ConnFeed, _ *struct{}) (err error)
- type UDP
- type UDPRPC
- func (u *UDPRPC) Address(_ struct{}, address *string) (_ error)
- func (u *UDPRPC) Connect(address string, _ *struct{}) (err error)
- func (u *UDPRPC) Disconnect(address string, _ *struct{}) (err error)
- func (u *UDPRPC) RemoteFeeds(address string, rfs *[]cipher.PubKey) (err error)
- func (u *UDPRPC) Subscribe(cf ConnFeed, _ *struct{}) (err error)
- func (u *UDPRPC) Unsubscribe(cf ConnFeed, _ *struct{}) (err error)
Constants ¶
const ( Prefix string = "[node] " MaxConnections int = 1000 * 1000 MaxPendingConnections int = 1000 MaxFillingTime time.Duration = 2 * time.Minute MaxTotalFillTime time.Duration = 10 * time.Minute MaxHeads int = 10 ListenTCP string = ":8870" ListenUDP string = "" // don't listen RPCAddress string = ":8871" ResponseTimeout time.Duration = 59 * time.Second Pings time.Duration = 118 * time.Second Public bool = false )
default configurations
const ( NewInConnPin log.Pin = 1 << iota // new incoming connection NewOutConnPin // new outgoing connection ConnHskPin // handshake logs ConnEstPin // connection established CloseConnPin // connection closed (except ERR logs) MsgSendPin // send msg MsgReceivePin // receive msg FillPin // FeedPin // DiscoveryPin // show discovery debug logs PEXPin // show peer exchange debug logs MsgPin = MsgSendPin | MsgReceivePin // send/receive ConnPin = NewInConnPin | NewOutConnPin | ConnEstPin | ConnHskPin | CloseConnPin // connections )
debug log pins
Variables ¶
var ( ErrAlreadyListen = errors.New("already listen") ErrTimeout = errors.New("timeout") ErrClosed = errors.New("closed") ErrNotPublic = errors.New("not a public server") ErrAlreadyHaveConnection = errors.New("already have connection") ErrInvalidResponse = errors.New("invalid response") ErrNotHeld = errors.New("object not held by the peer") ErrNoConnectionsToFillFrom = errors.New("no connections to fill from") ErrMaxHeadsLimit = errors.New("max heads limit") ErrUnsubscribe = errors.New("unsubscribe") ErrBlankFeed = errors.New("blank feed") ErrConnLimit = errors.New("max nubmber of connections exceeded") ErrPendConnLimit = errors.New("max number of pending connections exceeded") )
common errors
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// SecKey allows to provide secret key.
SecKey cipher.SecKey
// Logger contains configurations of logger
Logger log.Config
// Config is configurations of skyobject.Container.
*skyobject.Config
// MaxConnections is limit of connections.
MaxConnections int
// MaxPendingConnections is limit of pending connections.
MaxPendingConnections int
// MaxHeads is limit of heads per feed.
MaxHeads int
// MaxFillingTime is the STALL limit for filling of a Root object: the max
// time a fill may go WITHOUT fetching an object. The timer resets on every
// successful object fetch, so a large Root that keeps making progress is
// never aborted no matter how long its total fill takes — only a genuinely
// stalled peer (no object delivered for this long) is treated as broken and
// aborted with ErrTimeout (the Root refills when the publisher republishes).
// This replaced a fixed TOTAL-time cap that killed big-but-progressing hub
// Roots at the wall clock, which is the residual TPD churn (a single-source
// feed whose large Root couldn't finish inside the flat cap never landed).
// A hung fill still pins its "wanted" objects in the cache (which cleanDown
// skips), so MaxTotalFillTime below bounds the absolute window — that pair
// preserves the #3562/#3569 leak guard while letting slow fills complete.
// The TPD aggregator pins its own tighter 90s stall override on top of this.
MaxFillingTime time.Duration
// MaxTotalFillTime is the HARD ceiling on a single Root's fill, independent
// of progress: even a fill that keeps fetching objects is aborted once it
// has run this long in total. It backstops the progress-reset MaxFillingTime
// stall timer so a pathological source that dribbles one object every stall
// window can't pin "wanted" objects indefinitely (the #3562 leak class).
// Must be > MaxFillingTime; if <= 0 the package default (MaxTotalFillTime
// const) is used, and a value <= the stall timer is bumped to the default.
MaxTotalFillTime time.Duration
// RPC is RPC listening address. Empty string disables RPC.
RPC string
// TCP configurations
TCP NetConfig
// UDP configurations
UDP NetConfig
OnConnect OnConnectFunc
OnDisconnect OnDisconnectFunc
// Public makes the Node share its list of feeds.
Public bool
OnSubscribeRemote OnSubscribeRemoteFunc
OnUnsubscribeRemote OnUnsubscribeRemoteFunc
OnRootReceived OnRootReceivedFunc
OnRootFilled OnRootFilledFunc
OnFillingBreaks OnFillingBreaksFunc
// Peer callbacks
OnPeerAdded OnPeerAddedFunc
OnPeerUpdated OnPeerUpdatedFunc
OnPeerRemoved OnPeerRemovedFunc
}
A Config represents configurations of the Node.
type Conn ¶
type Conn struct {
*transport.Connection
// contains filtered or unexported fields
}
A Conn represent connection of the Node
func (*Conn) Close ¶
Close the Conn Close signals the connection to shut down. The connection is fully cleaned up asynchronously by run(). Use Done() to wait for full cleanup if needed.
func (*Conn) Done ¶
func (c *Conn) Done() <-chan struct{}
Done returns a channel that is closed when run() has fully completed (connection removed from node maps, transport closed, OnDisconnect called).
func (*Conn) Getter ¶
Getter returns a skyobject.Getter that fetches single objects by hash from this connection's remote peer on demand (one RqObject request per Get, hash-verified, bounded by the connection's ResponseTimeout).
Unlike a Root fill it neither walks an object graph nor writes anything to the node's container: each Get is an isolated request/response for exactly the requested object, and the caller decides what (if anything) to keep. Pairing it with (*Container).Preview yields a bounded, on-demand read of one chosen path through a Root without triggering or interfering with a concurrent whole-Root fill. The TPD aggregator uses this to pull just the small tp-list discovery leaf out of a Root whose bulky telemetry subtree can't finish filling within the conn's window.
func (*Conn) HasFeed ¶ added in v1.3.98
HasFeed reports whether this connection is subscribed to feed. Unlike Feeds, which walks every feed of the node, it is two map lookups on the node's feeds loop, so it is the one to ask per connection on a node holding thousands of feeds.
func (*Conn) IsIncoming ¶
IsIncoming returns true if this Conn is incoming and accepted by listener
func (*Conn) IsOutgoing ¶
IsOutgoing is inverse of the IsIncoming
func (*Conn) Preview ¶
func (c *Conn) Preview( feed cipher.PubKey, previewFunc PreviewFunc, ) ( err error, )
Preview a feed of remote peer. The request is blocking. The Preview gets latest Root of given feed from remote peer and uses the peer to obtain objects this node does not have.
func (*Conn) RemoteFeeds ¶
RemoteFeeds requests list of feeds that remote peer share. It's possible if the remote peer is public server, otherwise it returns "not a public server" error. The request has timeout configured by Config
func (*Conn) String ¶
String returns string "-> network://remote_address" for example: "-> tcp://127.0.0.1:8887". Where the arrow is "->" for incoming connections and is "<-" for outgoing
func (*Conn) Subscribe ¶
Subscribe to gievn feed of remote peer. The Subscribe adds feed to the Node if the Node doesn't have the feed calling the (*Node).Share method. If request fails, then the feed is not removed. E.g. if the Subscribe method returns error then it probably adds given feed to the Node, but request fails. Or it can returns error of the (*Node).Share
func (*Conn) Unsubscribe ¶
Unsubscribe from given feed of remote peer
type DMSG ¶
type DMSG struct {
*transport.DMSGFactory
// contains filtered or unexported fields
}
DMSG represents the DMSG transport of a CXO Node. It manages CXO connections over DMSG, using public keys as addresses instead of IP:port.
func (*DMSG) ConnectPK ¶
ConnectPK connects to a remote CXO node over DMSG by public key. If a healthy connection already exists, returns the existing one.
ctx bounds the underlying dmsg.Client.Dial — when ctx is canceled or its deadline elapses before the dial completes, ConnectPK returns ctx.Err() rather than blocking on a half-dead transport. Pre-this-change the dmsg dial used context.Background(), so a peer hung at the dmsg layer would survive the caller's deadline (Manager.tryReconnectPeers, Session.ReconnectPeer, …) and pin a goroutine in the dial until OS-level keepalive fired.
Cached-Conn liveness gate: a cached Conn whose closeq is signaled (run loop has observed the underlying transport going away, but removeConn hasn't yet completed) OR whose underlying transport reports IsClosed() is evicted here and re-dialed. Without this gate, the symmetric peer-side bug fixed in #2625's acceptHandshake also manifested on the dial side: a half-dead Conn whose run loop is stuck in receiveMsg's select on a transport that will never return — closeq not closed yet — would be returned from this cache. Subsequent Subscribe calls on the dead Conn hang, reconnect timeouts pile up, and the visor's peerSubs go silent indefinitely.
Concretely observed in production (2026-05-16): after an Alpha visor restart, all 3 peerSubs to remote group members appeared healthy for ~35 seconds, then went silent. The per-peer reconnect loop from #2606 fired every 30s but every attempt timed out at 15s with "context deadline exceeded" — because every ConnectPK returned the same dead cached Conn, Subscribe hung on it, the outer 15s deadline fired. Forty-five minutes of silent stale peerSubs until manual halt+restart cleared the cache. This fix makes ConnectPK self-heal on the next reconnect tick.
The closeq check catches the explicit-close case; the IsClosed() check catches the case where the underlying transport's close was observed but run loop hasn't yet propagated. Neither catches the truly-half-dead-but-not-yet-erroring case (e.g. a wedged network with no FIN/RST) — that path needs a separate liveness pulse, deferred. For typical "peer's dmsg server flipped / transport reset cleanly" failures this is sufficient.
func (*DMSG) Connections ¶
Connections returns a list of connected remote public keys.
type DMSGConnFeed ¶
DMSGConnFeed represents a DMSG peer and feed to subscribe to.
type DMSGRPC ¶
type DMSGRPC struct {
// contains filtered or unexported fields
}
DMSGRPC represents RPC methods for the DMSG transport.
func (*DMSGRPC) Connect ¶
Connect to a remote CXO node over DMSG by public key. net/rpc's method signature doesn't carry a ctx, so the dial is bounded only by the dmsg client's own timeouts. Callers that need cancellation must reach (*DMSG).ConnectPK directly with their own context.
func (*DMSGRPC) Connections ¶
Connections lists connected DMSG peers.
func (*DMSGRPC) Subscribe ¶
func (d *DMSGRPC) Subscribe(cf DMSGConnFeed, _ *struct{}) error
Subscribe to a feed on a DMSG-connected peer.
type NetConfig ¶
type NetConfig struct {
// Listen is listening address. Blank string
// disables listening.
Listen string
// ResponseTimeout is timeout for requests.
ResponseTimeout time.Duration
// Pings is interval for pinging peers.
Pings time.Duration
}
NetConfig represents configurations of a TCP or UDP network
type Node ¶
A Node represents network P2P transport for CX objects. The node used to receive, send and retransmit CX objects. The Node cares about last Root object of active head (see skyobject.Index.ActiveHead) of a feed. E.g. the Node never replicates an old Root if there is a newer one. The Node uses TCP and UDP transports.
func NewNode ¶
NewNode creates new Node instance using provided Config. If the Config is nil, then default is used (see NewConfig for defaults)
func NewNodeContainer ¶
NewNodeContainer use provided Container. Configurations related to Container ignored.
func (*Node) Close ¶
Close the Node. The Close returns error of (skyobject.Container).Close once.
Note: connection close cascades drain shard mutexes rather than holding Node.mx — closing a Conn signals goroutines that may re-enter Node methods (removeConn, etc.) and pre-fix that re-entry deadlocked against the Node.mx held here.
func (*Node) Config ¶
Config returns Config with which the Node was created. The Config must not be modified. If the Node created using NewNodeContainer, then Config field replaced with config of given Container
func (*Node) Connections ¶
Connections returns all established connections. Snapshots the sharded active map; no Node-wide lock held during the walk.
func (*Node) ConnectionsOfFeed ¶
ConnectionsOfFeed returns list of connections of given feed. Use blank public key to get all connections that does not share a feed
func (*Node) DontShare ¶
DontShare given feed. The method does't remove the feed from underlying Container. The method calls Unsubscribe() for all connections that share the feed. The method does nothing if the Node doesn't share the feed The Node never sync with Container automatically, and before removing a feed from Container, call this method to prevent sharing feed that does not exist
func (*Node) EnableDMSG ¶
func (n *Node) EnableDMSG(factory *transport.DMSGFactory) error
EnableDMSG creates and starts a DMSG transport on this node using the given DMSG factory. It starts listening for incoming CXO connections over DMSG.
func (*Node) ID ¶
ID retursn identifier of the Node. The identifier is unique random identifier that used to avoid cross-connections
func (*Node) Publish ¶
Publish sends given Root object to peers that subscribed to feed of the Root. The Publish used to publish new Root objects. E.g. the Node sends last Root object of a feed to subsctibers. But the Node knows nothing about new Root objects. And to share an updated Root, call the Publish. And don't call the publish for Root objects that alredy saved (that saved before subscription)
func (*Node) SetDMSG ¶
SetDMSG sets the DMSG transport for this node. Must be called before Listen/Connect operations on the DMSG transport.
func (*Node) Share ¶
Share given feed. By default the Node dousn't share a feed. Even if underlying Container have any. To start sharing a feed, call this method. Thus, you can keep some feeds locally. To share all feeds of the Container use following code
for _, pk := range n.Container().Feeds() {
n.Share(pk)
}
The Share method adds given feed to underlying Container calling (*skyobjec.Container).AddFeed() method. The method never return an error if given feed is already shared. The share never associate the feed with a connection. You should to call (*Conn).Subscribe to do that.
func (*Node) Stats ¶
func (n *Node) Stats() PublisherStats
Stats returns a snapshot of the Node's publisher-side health counters + active gauges. Cheap: pure atomic loads — no shard mutex acquired.
func (*Node) SwapOnFillingBreaks ¶
func (n *Node) SwapOnFillingBreaks(next func(*Node, *registry.Root, error)) (prev func(*Node, *registry.Root, error))
SwapOnFillingBreaks atomically replaces the OnFillingBreaks callback and returns the previous value. Mirror of SwapOnRootFilled.
func (*Node) SwapOnRootFilled ¶
func (n *Node) SwapOnRootFilled(next func(*Node, *registry.Root)) (prev func(*Node, *registry.Root))
SwapOnRootFilled atomically replaces the OnRootFilled callback and returns the previous value. Used by pkg/cxo/treestore's Subscriber to chain its handler in front of any pre-existing one without racing the head goroutine's read at onRootFilled.
type OnConnectFunc ¶
OnConnectFunc represents callback that called when a connection created and established. It's possible to terminate connection returning error
type OnDisconnectFunc ¶
OnDisconnectFunc represents callback that called when a connection closed.
type OnFillingBreaksFunc ¶
OnFillingBreaksFunc represents callback that called when a new Root object can't be filled.
type OnRootFilledFunc ¶
OnRootFilledFunc represents callback that called when new Root filled and can be used. The callback called once per Root.
type OnRootReceivedFunc ¶
OnRootReceivedFunc represents callback that called when new Root objects received. It's possible to reject a received Root returning error by this function.
type OnSubscribeRemoteFunc ¶
OnSubscribeRemoteFunc represents callback that called when a remote peer subscribes to some feed of the Node.
type OnUnsubscribeRemoteFunc ¶
OnUnsubscribeRemoteFunc represent callback that called when a remote peer unsubscribes from some feed.
type Peer ¶
type Peer struct {
PubKey cipher.PubKey
Metadata []byte
TCPAddr string
UDPAddr string
LastSeen time.Time
RetryTimes uint64
}
Peer
type PreviewFunc ¶
PreviewFunc used by (*Conn).Preview method. The function receive registry.Pack and lates Root object. The Pack used to get objects from DB or from remote peer. If the function returns true, then the Node and the Connection will be subscribed to the feed. Given Pack and given Root can't be used outside the function.
type PublisherStats ¶
type PublisherStats struct {
SendMsgTimeouts uint64 `json:"sendmsg_timeouts"`
DeadConnsClosed uint64 `json:"dead_conns_closed"`
ActiveConnections int `json:"active_connections"`
ActiveFeeds int `json:"active_feeds"`
}
PublisherStats is the snapshot of CXO-publisher-side health counters. Surfaced upward (treestore.Publisher.Stats() → visor RPC → `skywire cli visor doctor`) so operators can spot a publisher fanout that's silently shedding subscribers without parsing WARN logs.
Counter semantics:
- SendMsgTimeouts counts sendMsg-queue-full-timeout events. Each tick is one subscriber whose queue was blocked for the full sendMsgQueueTimeout window before the conn was force-closed. A non-zero counter is the smoking gun for the pre-#2538 stuck publisher pattern, now bounded but worth surfacing.
- DeadConnsClosed counts Conn instances closed by sendMsg's timeout path. Today this is always equal to SendMsgTimeouts; kept distinct so future auto-close paths (idle, frame-error, etc.) can be counted without rebasing this struct.
- ActiveConnections / ActiveFeeds are point-in-time gauges useful for sanity checking ("did my publisher lose all its subscribers?").
type RPC ¶
type RPC struct {
// contains filtered or unexported fields
}
A RPC represnet RPC server of the Node. The RPC is exported because the net/rpc package requires it. E.g. the RPC is registered by the rpc package. The RPC can't be used outside the Node.
Short words, the RPC is internal
func (*RPC) Connections ¶
Connections is RPC method
func (*RPC) ConnectionsOfFeed ¶
ConnectionsOfFeed is RPC method
type RPCClient ¶
type RPCClient struct {
// contains filtered or unexported fields
}
A RPCClient represents client for RPC methods of the Node
func NewRPCClient ¶
NewRPCClient creates RPC client connected to RPC server with given address
type RPCClientNode ¶
type RPCClientNode struct {
// contains filtered or unexported fields
}
An RPCClientNode implements RPC methods related to the Node
func (*RPCClientNode) Config ¶
func (r *RPCClientNode) Config() (config *Config, err error)
Config of the Node
func (*RPCClientNode) Connections ¶
func (r *RPCClientNode) Connections() (cs []string, err error)
Connections of the Node
func (*RPCClientNode) ConnectionsOfFeed ¶
func (r *RPCClientNode) ConnectionsOfFeed( pk cipher.PubKey, ) ( cs []string, err error, )
ConnectionsOfFeed of the Node
func (*RPCClientNode) DontShare ¶
func (r *RPCClientNode) DontShare(pk cipher.PubKey) (err error)
DontShare given feed
func (*RPCClientNode) Feeds ¶
func (r *RPCClientNode) Feeds() (fs []cipher.PubKey, err error)
Feeds that the Node is shareing
func (*RPCClientNode) IsSharing ¶
func (r *RPCClientNode) IsSharing(pk cipher.PubKey) (yep bool, err error)
IsSharing a feed or not
func (*RPCClientNode) Share ¶
func (r *RPCClientNode) Share(pk cipher.PubKey) (err error)
Share given feed
func (*RPCClientNode) Shutdown ¶
func (r *RPCClientNode) Shutdown() error
Shutdown gracefully stops the node
func (*RPCClientNode) Stat ¶
func (r *RPCClientNode) Stat() (stat *Stat, err error)
Stat obtains statistic of the Node
type RPCClientRoot ¶
type RPCClientRoot struct {
// contains filtered or unexported fields
}
A RPCClientRoot implements RPC methods related to Root objects
type RPCClientTCP ¶
type RPCClientTCP struct {
// contains filtered or unexported fields
}
A RPCClientTCP implements RPC methods related to TCP transport
func (*RPCClientTCP) Address ¶
func (r *RPCClientTCP) Address() (address string, err error)
Address of TCP listener
func (*RPCClientTCP) Connect ¶
func (r *RPCClientTCP) Connect(address string) (err error)
Connect to given TCP address
func (*RPCClientTCP) Disconnect ¶
func (r *RPCClientTCP) Disconnect(address string) (err error)
Disconnect from peer
func (*RPCClientTCP) RemoteFeeds ¶
func (r *RPCClientTCP) RemoteFeeds( address string, ) ( rfs []cipher.PubKey, err error, )
RemoteFeeds of peer
func (*RPCClientTCP) Subscribe ¶
func (r *RPCClientTCP) Subscribe(address string, pk cipher.PubKey) (err error)
Subscribe to feed of peer
func (*RPCClientTCP) Unsubscribe ¶
func (r *RPCClientTCP) Unsubscribe( address string, pk cipher.PubKey, ) ( err error, )
Unsubscribe from feed of peer
type RPCClientUDP ¶
type RPCClientUDP struct {
// contains filtered or unexported fields
}
A RPCClientUDP implements RPC methods related to UDP transport
func (*RPCClientUDP) Address ¶
func (r *RPCClientUDP) Address() (address string, err error)
Address of UDP listener
func (*RPCClientUDP) Connect ¶
func (r *RPCClientUDP) Connect(address string) (err error)
Connect to peer
func (*RPCClientUDP) Disconnect ¶
func (r *RPCClientUDP) Disconnect(address string) (err error)
Disconnect from peer
func (*RPCClientUDP) RemoteFeeds ¶
func (r *RPCClientUDP) RemoteFeeds( address string, ) ( rfs []cipher.PubKey, err error, )
RemoteFeeds of peer
func (*RPCClientUDP) Subscribe ¶
func (r *RPCClientUDP) Subscribe(address string, pk cipher.PubKey) (err error)
Subscribe to feed of peer
func (*RPCClientUDP) Unsubscribe ¶
func (r *RPCClientUDP) Unsubscribe( address string, pk cipher.PubKey, ) ( err error, )
Unsubscribe from feed of peer
type RootRPC ¶
type RootRPC struct {
// contains filtered or unexported fields
}
A RootRPC represents RPC object of Root objects of the Node
type RootSelector ¶
A RootSelector represents Root selector
type Swarm ¶
type Swarm struct {
// contains filtered or unexported fields
}
Swarm
type SwarmConfig ¶
type SwarmConfig struct {
MaxPeers uint64
RequestPeerRate time.Duration
PeerExpirePeriod time.Duration
ClearOldPeersRate time.Duration
MaxConns uint64
OutgoingConnRate time.Duration
PeersPerResponse uint64
}
SwarmConfig defines on how node finds peers, belonging to the same swarm, and how it interacts with them later.
func DefaultSwarmConfig ¶
func DefaultSwarmConfig() SwarmConfig
type TCP ¶
type TCP struct {
*transport.TCPFactory // underlying transport
// contains filtered or unexported fields
}
A TCP represents TCP transport of the Node. The TCP used to listen and connect
func (*TCP) Address ¶
Address returns listening address as it passed to the Listen method. The address is blank string if the TCP is not listening
type TCPRPC ¶
type TCPRPC struct {
// contains filtered or unexported fields
}
A TCPRPC represents RPC object of TCP transport of the Node
func (*TCPRPC) Disconnect ¶
Disconnect is RPC method
func (*TCPRPC) RemoteFeeds ¶
RemoteFeeds is RPC method
func (*TCPRPC) Unsubscribe ¶
Unsubscribe is RPC method
type UDP ¶
type UDP struct {
*transport.UDPFactory // underlying transport
// contains filtered or unexported fields
}
A UDP represents UDP transport of the Node. The UDP used to listen and connect
func (*UDP) Address ¶
Address returns listening address as it passed to the Listen method. The address is blank string if the UDP is not listening
type UDPRPC ¶
type UDPRPC struct {
// contains filtered or unexported fields
}
A UDPRPC represents RPC object of UDP transport of the Node
func (*UDPRPC) Disconnect ¶
Disconnect is RPC method
func (*UDPRPC) RemoteFeeds ¶
RemoteFeeds is RPC method
func (*UDPRPC) Unsubscribe ¶
Unsubscribe is RPC method
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package log pkg/cxo/node/log/log.go c2-net-cxo
|
Package log pkg/cxo/node/log/log.go c2-net-cxo |
|
Package msg pkg/cxo/node/msg/msg.go c2-net-cxo
|
Package msg pkg/cxo/node/msg/msg.go c2-net-cxo |
|
Package transport pkg/cxo/node/transport/connection.go c2-net-cxo
|
Package transport pkg/cxo/node/transport/connection.go c2-net-cxo |