Versions in this module Expand all Collapse all v0 v0.1.0 Jan 19, 2024 Changes in this version + const IDByteLength + const MAIN_NET_SEEDS + const MetricsSubsystem + const TEST_NET_SEEDS + const TestHost + func AddPeerToSwitchPeerSet(sw *Switch, peer Peer) + func BytesToPubKey(b []byte) crypto.PubKey + func Connect2Switches(switches []*Switch, i, j int) + func FuzzConn(conn net.Conn) net.Conn + func FuzzConnAfter(conn net.Conn, d time.Duration) net.Conn + func FuzzConnAfterFromConfig(conn net.Conn, d time.Duration, config *config.FuzzConnConfig) net.Conn + func FuzzConnFromConfig(conn net.Conn, config *config.FuzzConnConfig) net.Conn + func IDAddressString(id ID, protocolHostPort string) string + func MConnConfig(cfg *config.P2PConfig) conn.MConnConfig + func MakePoWTarget(difficulty, targetBits uint) []byte + func MaxNodeInfoSize() int + func StartSwitches(switches []*Switch) error + type AddrBook interface + AddAddress func(addr *NetAddress, src *NetAddress) error + AddOurAddress func(*NetAddress) + HasAddress func(*NetAddress) bool + MarkGood func(ID) + OurAddress func(*NetAddress) bool + RemoveAddress func(*NetAddress) + Save func() + type BaseReactor struct + Switch *Switch + func NewBaseReactor(name string, impl Reactor) *BaseReactor + func (*BaseReactor) AddPeer(peer Peer) + func (*BaseReactor) GetChannels() []*conn.ChannelDescriptor + func (*BaseReactor) InitPeer(peer Peer) Peer + func (*BaseReactor) Receive(chID byte, peer Peer, msgBytes []byte) + func (*BaseReactor) RemovePeer(peer Peer, reason interface{}) + func (br *BaseReactor) SetSwitch(sw *Switch) + type ChannelDescriptor = conn.ChannelDescriptor + type ConnFilterFunc func(ConnSet, net.Conn, []net.IP) error + func ConnDuplicateIPFilter() ConnFilterFunc + type ConnSet interface + Has func(net.Conn) bool + HasIP func(net.IP) bool + Remove func(net.Conn) + RemoveAddr func(net.Addr) + Set func(net.Conn, []net.IP) + func NewConnSet() ConnSet + type ConnectionStatus = conn.ConnectionStatus + type DefaultNodeInfo struct + Channels bytes.HexBytes + DefaultNodeID ID + ListenAddr string + Moniker string + Network string + Other DefaultNodeInfoOther + ProtocolVersion ProtocolVersion + Version string + func (info *DefaultNodeInfo) Marshal() ([]byte, error) + func (info *DefaultNodeInfo) MarshalTo(data []byte) (int, error) + func (info *DefaultNodeInfo) Size() int + func (info *DefaultNodeInfo) Unmarshal(bs []byte) error + func (info DefaultNodeInfo) CompatibleWith(otherInfo NodeInfo) error + func (info DefaultNodeInfo) ID() ID + func (info DefaultNodeInfo) NetAddress() (*NetAddress, error) + func (info DefaultNodeInfo) Validate() error + type DefaultNodeInfoOther struct + RPCAddress string + TxIndex string + type ErrCurrentlyDialingOrExistingAddress struct + Addr string + func (e ErrCurrentlyDialingOrExistingAddress) Error() string + type ErrFilterTimeout struct + func (e ErrFilterTimeout) Error() string + type ErrNetAddressInvalid struct + Addr string + Err error + func (e ErrNetAddressInvalid) Error() string + type ErrNetAddressLookup struct + Addr string + Err error + func (e ErrNetAddressLookup) Error() string + type ErrNetAddressNoID struct + Addr string + func (e ErrNetAddressNoID) Error() string + type ErrRejected struct + func (e ErrRejected) Addr() NetAddress + func (e ErrRejected) Error() string + func (e ErrRejected) IsAuthFailure() bool + func (e ErrRejected) IsDuplicate() bool + func (e ErrRejected) IsFiltered() bool + func (e ErrRejected) IsIncompatible() bool + func (e ErrRejected) IsNodeInfoInvalid() bool + func (e ErrRejected) IsSelf() bool + type ErrSwitchAuthenticationFailure struct + Dialed *NetAddress + Got ID + func (e ErrSwitchAuthenticationFailure) Error() string + type ErrSwitchConnectToSelf struct + Addr *NetAddress + func (e ErrSwitchConnectToSelf) Error() string + type ErrSwitchDuplicatePeerID struct + ID ID + func (e ErrSwitchDuplicatePeerID) Error() string + type ErrSwitchDuplicatePeerIP struct + IP net.IP + func (e ErrSwitchDuplicatePeerIP) Error() string + type ErrTransportClosed struct + func (e ErrTransportClosed) Error() string + type FuzzedConnection struct + func (fc *FuzzedConnection) Close() error + func (fc *FuzzedConnection) Config() *config.FuzzConnConfig + func (fc *FuzzedConnection) LocalAddr() net.Addr + func (fc *FuzzedConnection) Read(data []byte) (n int, err error) + func (fc *FuzzedConnection) RemoteAddr() net.Addr + func (fc *FuzzedConnection) SetDeadline(t time.Time) error + func (fc *FuzzedConnection) SetReadDeadline(t time.Time) error + func (fc *FuzzedConnection) SetWriteDeadline(t time.Time) error + func (fc *FuzzedConnection) Write(data []byte) (n int, err error) + type ID string + func PubKeyToID(pubKey crypto.PubKey) ID + type IPResolver interface + LookupIPAddr func(context.Context, string) ([]net.IPAddr, error) + type IPeerSet interface + Get func(key ID) Peer + Has func(key ID) bool + HasIP func(ip net.IP) bool + List func() []Peer + Size func() int + type Metrics struct + NumTxs metrics.Gauge + PeerPendingSendBytes metrics.Gauge + PeerReceiveBytesTotal metrics.Counter + PeerSendBytesTotal metrics.Counter + Peers metrics.Gauge + func NopMetrics() *Metrics + func PrometheusMetrics(namespace string, labelsAndValues ...string) *Metrics + type MultiplexTransport struct + func NewMultiplexTransport(nodeInfo NodeInfo, nodeKey NodeKey, mConfig conn.MConnConfig) *MultiplexTransport + func (mt *MultiplexTransport) Accept(cfg peerConfig) (Peer, error) + func (mt *MultiplexTransport) Cleanup(p Peer) + func (mt *MultiplexTransport) Close() error + func (mt *MultiplexTransport) Dial(addr NetAddress, cfg peerConfig) (Peer, error) + func (mt *MultiplexTransport) Listen(addr NetAddress) error + func (mt *MultiplexTransport) NetAddress() NetAddress + type MultiplexTransportOption func(*MultiplexTransport) + func MultiplexTransportConnFilters(filters ...ConnFilterFunc) MultiplexTransportOption + func MultiplexTransportFilterTimeout(timeout time.Duration) MultiplexTransportOption + func MultiplexTransportMaxIncomingConnections(n int) MultiplexTransportOption + func MultiplexTransportResolver(resolver IPResolver) MultiplexTransportOption + type NetAddress struct + ID ID + IP net.IP + Port uint16 + func CreateRoutableAddr() (addr string, netAddr *NetAddress) + func NewNetAddress(id ID, addr net.Addr) *NetAddress + func NewNetAddressIPPort(ip net.IP, port uint16) *NetAddress + func NewNetAddressString(addr string) (*NetAddress, error) + func NewNetAddressStrings(addrs []string) ([]*NetAddress, []error) + func (na *NetAddress) Dial() (net.Conn, error) + func (na *NetAddress) DialString() string + func (na *NetAddress) DialTimeout(timeout time.Duration) (net.Conn, error) + func (na *NetAddress) Equals(other interface{}) bool + func (na *NetAddress) HasID() bool + func (na *NetAddress) Local() bool + func (na *NetAddress) OnionCatTor() bool + func (na *NetAddress) RFC1918() bool + func (na *NetAddress) RFC3849() bool + func (na *NetAddress) RFC3927() bool + func (na *NetAddress) RFC3964() bool + func (na *NetAddress) RFC4193() bool + func (na *NetAddress) RFC4380() bool + func (na *NetAddress) RFC4843() bool + func (na *NetAddress) RFC4862() bool + func (na *NetAddress) RFC6052() bool + func (na *NetAddress) RFC6145() bool + func (na *NetAddress) ReachabilityTo(o *NetAddress) int + func (na *NetAddress) Routable() bool + func (na *NetAddress) Same(other interface{}) bool + func (na *NetAddress) String() string + func (na *NetAddress) Valid() error + type NodeInfo interface + ID func() ID + type NodeKey struct + PrivKey crypto.PrivKey + func LoadNodeKey(filePath string) (*NodeKey, error) + func LoadOrGenNodeKey(filePath string) (*NodeKey, error) + func LoadOrGenNodeKeyByIndex(filePath string, index int) (*NodeKey, error) + func (nodeKey *NodeKey) ID() ID + func (nodeKey *NodeKey) PubKey() crypto.PubKey + type Peer interface + CloseConn func() error + FlushStop func() + Get func(string) interface{} + ID func() ID + IsOutbound func() bool + IsPersistent func() bool + NodeInfo func() NodeInfo + RemoteAddr func() net.Addr + RemoteIP func() net.IP + Send func(byte, []byte) bool + Set func(string, interface{}) + SocketAddr func() *NetAddress + Status func() tmconn.ConnectionStatus + TrySend func(byte, []byte) bool + func CreateRandomPeer(outbound bool) Peer + type PeerFilterFunc func(IPeerSet, Peer) error + type PeerOption func(*peer) + func PeerMetrics(metrics *Metrics) PeerOption + type PeerSet struct + func NewPeerSet() *PeerSet + func (ps *PeerSet) Add(peer Peer) error + func (ps *PeerSet) Get(peerKey ID) Peer + func (ps *PeerSet) Has(peerKey ID) bool + func (ps *PeerSet) HasIP(peerIP net.IP) bool + func (ps *PeerSet) List() []Peer + func (ps *PeerSet) Remove(peer Peer) bool + func (ps *PeerSet) Size() int + type ProtocolVersion struct + App version.Protocol + Block version.Protocol + P2P version.Protocol + func NewProtocolVersion(p2p, block, app version.Protocol) ProtocolVersion + type Reactor interface + AddPeer func(peer Peer) + GetChannels func() []*conn.ChannelDescriptor + InitPeer func(peer Peer) Peer + Receive func(chID byte, peer Peer, msgBytes []byte) + RemovePeer func(peer Peer, reason interface{}) + SetSwitch func(*Switch) + type Switch struct + func MakeConnectedSwitches(cfg *config.P2PConfig, n int, initSwitch func(int, *Switch) *Switch, ...) []*Switch + func MakeSwitch(cfg *config.P2PConfig, i int, network, version string, ...) *Switch + func NewSwitch(cfg *config.P2PConfig, transport Transport, options ...SwitchOption) *Switch + func (sw *Switch) AddPersistentPeers(addrs []string) error + func (sw *Switch) AddReactor(name string, reactor Reactor) Reactor + func (sw *Switch) AddUnconditionalPeerIDs(ids []string) error + func (sw *Switch) Broadcast(chID byte, msgBytes []byte) chan bool + func (sw *Switch) DialPeerWithAddress(addr *NetAddress) error + func (sw *Switch) DialPeersAsync(peers []string) error + func (sw *Switch) IsDialingOrExistingAddress(addr *NetAddress) bool + func (sw *Switch) IsPeerPersistent(na *NetAddress) bool + func (sw *Switch) IsPeerUnconditional(id ID) bool + func (sw *Switch) ListenAddress() string + func (sw *Switch) MarkPeerAsGood(peer Peer) + func (sw *Switch) MaxNumOutboundPeers() int + func (sw *Switch) NetAddress() *NetAddress + func (sw *Switch) NodeInfo() NodeInfo + func (sw *Switch) NumPeers() (outbound, inbound, dialing int) + func (sw *Switch) OnStart() error + func (sw *Switch) OnStop() + func (sw *Switch) Peers() IPeerSet + func (sw *Switch) Reactor(name string) Reactor + func (sw *Switch) Reactors() map[string]Reactor + func (sw *Switch) RemoveReactor(name string, reactor Reactor) + func (sw *Switch) SetAddrBook(addrBook AddrBook) + func (sw *Switch) SetNodeInfo(nodeInfo NodeInfo) + func (sw *Switch) SetNodeKey(nodeKey *NodeKey) + func (sw *Switch) StopPeerForError(peer Peer, reason interface{}) + func (sw *Switch) StopPeerGracefully(peer Peer) + type SwitchOption func(*Switch) + func SwitchFilterTimeout(timeout time.Duration) SwitchOption + func SwitchPeerFilters(filters ...PeerFilterFunc) SwitchOption + func WithMetrics(metrics *Metrics) SwitchOption + type Transport interface + Accept func(peerConfig) (Peer, error) + Cleanup func(Peer) + Dial func(NetAddress, peerConfig) (Peer, error) + NetAddress func() NetAddress