Versions in this module Expand all Collapse all v0 v0.11.1 Oct 10, 2017 v0.11.0 Sep 22, 2017 Changes in this version type Peer + NodeInfo func() *NodeInfo + Set func(string, interface{}) + Status func() ConnectionStatus v0.10.4 Sep 5, 2017 v0.10.3 Aug 10, 2017 v0.10.2 Jul 10, 2017 v0.10.1 Jun 28, 2017 v0.10.0 Jun 3, 2017 Changes in this version + const FuzzModeDelay + const FuzzModeDrop + const PexChannel + const Version + var ErrSwitchDuplicatePeer = errors.New("Duplicate peer") + var PanicOnAddPeerErr = false + func AddToIPRangeCounts(counts map[string]int, ip string) map[string]int + func CheckIPRangeCounts(counts map[string]int, limits []int) bool + 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 *FuzzConnConfig) net.Conn + func FuzzConnFromConfig(conn net.Conn, config *FuzzConnConfig) net.Conn + func StartSwitches(switches []*Switch) error + type AddrBook struct + func NewAddrBook(filePath string, routabilityStrict bool) *AddrBook + func (a *AddrBook) AddAddress(addr *NetAddress, src *NetAddress) + func (a *AddrBook) AddOurAddress(addr *NetAddress) + func (a *AddrBook) GetSelection() []*NetAddress + func (a *AddrBook) MarkAttempt(addr *NetAddress) + func (a *AddrBook) MarkBad(addr *NetAddress) + func (a *AddrBook) MarkGood(addr *NetAddress) + func (a *AddrBook) NeedMoreAddrs() bool + func (a *AddrBook) OnStart() error + func (a *AddrBook) OnStop() + func (a *AddrBook) OurAddresses() []*NetAddress + func (a *AddrBook) PickAddress(newBias int) *NetAddress + func (a *AddrBook) RemoveAddress(addr *NetAddress) + func (a *AddrBook) Save() + func (a *AddrBook) Size() int + func (a *AddrBook) Wait() + type BaseReactor struct + Switch *Switch + func NewBaseReactor(name string, impl Reactor) *BaseReactor + func (_ *BaseReactor) AddPeer(peer *Peer) + func (_ *BaseReactor) GetChannels() []*ChannelDescriptor + func (_ *BaseReactor) Receive(chID byte, peer *Peer, msgBytes []byte) + func (_ *BaseReactor) RemovePeer(peer *Peer, reason interface{}) + func (br *BaseReactor) SetSwitch(sw *Switch) + type Channel struct + type ChannelDescriptor struct + ID byte + Priority int + RecvBufferCapacity int + RecvMessageCapacity int + SendQueueCapacity int + func (chDesc *ChannelDescriptor) FillDefaults() + type ChannelStatus struct + ID byte + Priority int + RecentlySent int64 + SendQueueCapacity int + SendQueueSize int + type ConnectionStatus struct + Channels []ChannelStatus + RecvMonitor flow.Status + SendMonitor flow.Status + type DefaultListener struct + func (l *DefaultListener) Connections() <-chan net.Conn + func (l *DefaultListener) ExternalAddress() *NetAddress + func (l *DefaultListener) InternalAddress() *NetAddress + func (l *DefaultListener) NetListener() net.Listener + func (l *DefaultListener) OnStart() error + func (l *DefaultListener) OnStop() + func (l *DefaultListener) String() string + type FuzzConnConfig struct + MaxDelay time.Duration + Mode int + ProbDropConn float64 + ProbDropRW float64 + ProbSleep float64 + func DefaultFuzzConnConfig() *FuzzConnConfig + type FuzzedConnection struct + func (fc *FuzzedConnection) Close() error + func (fc *FuzzedConnection) 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 IPeerSet interface + Get func(key string) *Peer + Has func(key string) bool + List func() []*Peer + Size func() int + type Listener interface + Connections func() <-chan net.Conn + ExternalAddress func() *NetAddress + InternalAddress func() *NetAddress + Stop func() bool + String func() string + func NewDefaultListener(protocol string, lAddr string, skipUPNP bool, logger log.Logger) Listener + type MConnConfig struct + RecvRate int64 + SendRate int64 + func DefaultMConnConfig() *MConnConfig + type MConnection struct + LocalAddress *NetAddress + RemoteAddress *NetAddress + func NewMConnection(conn net.Conn, chDescs []*ChannelDescriptor, onReceive receiveCbFunc, ...) *MConnection + func NewMConnectionWithConfig(conn net.Conn, chDescs []*ChannelDescriptor, onReceive receiveCbFunc, ...) *MConnection + func (c *MConnection) CanSend(chID byte) bool + func (c *MConnection) OnStart() error + func (c *MConnection) OnStop() + func (c *MConnection) Send(chID byte, msg interface{}) bool + func (c *MConnection) Status() ConnectionStatus + func (c *MConnection) String() string + func (c *MConnection) TrySend(chID byte, msg interface{}) bool + type NetAddress struct + IP net.IP + Port uint16 + func NewNetAddress(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) DialTimeout(timeout time.Duration) (net.Conn, error) + func (na *NetAddress) Equals(other interface{}) bool + func (na *NetAddress) Less(other interface{}) bool + func (na *NetAddress) Local() 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) String() string + func (na *NetAddress) Valid() bool + type NodeInfo struct + ListenAddr string + Moniker string + Network string + Other []string + PubKey crypto.PubKeyEd25519 + RemoteAddr string + Version string + func (info *NodeInfo) CompatibleWith(other *NodeInfo) error + func (info *NodeInfo) ListenHost() string + func (info *NodeInfo) ListenPort() int + func (info NodeInfo) String() string + type PEXReactor struct + func NewPEXReactor(b *AddrBook) *PEXReactor + func (r *PEXReactor) AddPeer(p *Peer) + func (r *PEXReactor) GetChannels() []*ChannelDescriptor + func (r *PEXReactor) IncrementMsgCountForPeer(addr string) + func (r *PEXReactor) OnStart() error + func (r *PEXReactor) OnStop() + func (r *PEXReactor) ReachedMaxMsgCountForPeer(addr string) bool + func (r *PEXReactor) Receive(chID byte, src *Peer, msgBytes []byte) + func (r *PEXReactor) RemovePeer(p *Peer, reason interface{}) + func (r *PEXReactor) RequestPEX(p *Peer) + func (r *PEXReactor) SendAddrs(p *Peer, addrs []*NetAddress) + func (r *PEXReactor) SetEnsurePeersPeriod(d time.Duration) + func (r *PEXReactor) SetMaxMsgCountByPeer(v uint16) + type Peer struct + Data *cmn.CMap + Key string + func (p *Peer) Addr() net.Addr + func (p *Peer) CanSend(chID byte) bool + func (p *Peer) CloseConn() + func (p *Peer) Connection() *MConnection + func (p *Peer) Equals(other *Peer) bool + func (p *Peer) Get(key string) interface{} + func (p *Peer) HandshakeTimeout(ourNodeInfo *NodeInfo, timeout time.Duration) error + func (p *Peer) IsOutbound() bool + func (p *Peer) IsPersistent() bool + func (p *Peer) OnStart() error + func (p *Peer) OnStop() + func (p *Peer) PubKey() crypto.PubKeyEd25519 + func (p *Peer) Send(chID byte, msg interface{}) bool + func (p *Peer) String() string + func (p *Peer) TrySend(chID byte, msg interface{}) bool + func (p *Peer) WriteTo(w io.Writer) (n int64, err error) + type PeerConfig struct + AuthEnc bool + DialTimeout time.Duration + Fuzz bool + FuzzConfig *FuzzConnConfig + HandshakeTimeout time.Duration + MConfig *MConnConfig + func DefaultPeerConfig() *PeerConfig + type PeerSet struct + func NewPeerSet() *PeerSet + func (ps *PeerSet) Add(peer *Peer) error + func (ps *PeerSet) Get(peerKey string) *Peer + func (ps *PeerSet) Has(peerKey string) bool + func (ps *PeerSet) List() []*Peer + func (ps *PeerSet) Remove(peer *Peer) + func (ps *PeerSet) Size() int + type PexMessage interface + func DecodeMessage(bz []byte) (msgType byte, msg PexMessage, err error) + type Reactor interface + AddPeer func(peer *Peer) + GetChannels func() []*ChannelDescriptor + Receive func(chID byte, peer *Peer, msgBytes []byte) + RemovePeer func(peer *Peer, reason interface{}) + SetSwitch func(*Switch) + type SecretConnection struct + func MakeSecretConnection(conn io.ReadWriteCloser, locPrivKey crypto.PrivKeyEd25519) (*SecretConnection, error) + func (sc *SecretConnection) Close() error + func (sc *SecretConnection) LocalAddr() net.Addr + func (sc *SecretConnection) Read(data []byte) (n int, err error) + func (sc *SecretConnection) RemoteAddr() net.Addr + func (sc *SecretConnection) RemotePubKey() crypto.PubKeyEd25519 + func (sc *SecretConnection) SetDeadline(t time.Time) error + func (sc *SecretConnection) SetReadDeadline(t time.Time) error + func (sc *SecretConnection) SetWriteDeadline(t time.Time) error + func (sc *SecretConnection) Write(data []byte) (n int, err error) + type Switch struct + func MakeConnectedSwitches(cfg *cfg.P2PConfig, n int, initSwitch func(int, *Switch) *Switch, ...) []*Switch + func NewSwitch(config *cfg.P2PConfig) *Switch + func (sw *Switch) AddListener(l Listener) + func (sw *Switch) AddPeer(peer *Peer) error + func (sw *Switch) AddReactor(name string, reactor Reactor) Reactor + func (sw *Switch) Broadcast(chID byte, msg interface{}) chan bool + func (sw *Switch) DialPeerWithAddress(addr *NetAddress, persistent bool) (*Peer, error) + func (sw *Switch) DialSeeds(addrBook *AddrBook, seeds []string) error + func (sw *Switch) FilterConnByAddr(addr net.Addr) error + func (sw *Switch) FilterConnByPubKey(pubkey crypto.PubKeyEd25519) error + func (sw *Switch) IsDialing(addr *NetAddress) bool + func (sw *Switch) IsListening() bool + func (sw *Switch) Listeners() []Listener + 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) SetAddrFilter(f func(net.Addr) error) + func (sw *Switch) SetNodeInfo(nodeInfo *NodeInfo) + func (sw *Switch) SetNodePrivKey(nodePrivKey crypto.PrivKeyEd25519) + func (sw *Switch) SetPubKeyFilter(f func(crypto.PubKeyEd25519) error) + func (sw *Switch) StopPeerForError(peer *Peer, reason interface{}) + func (sw *Switch) StopPeerGracefully(peer *Peer) + type SwitchEventDonePeer struct + Error interface{} + Peer *Peer + type SwitchEventNewPeer struct + Peer *Peer v0.10.0-rc2 May 29, 2017 v0.10.0-rc1 May 18, 2017