const (
HostPortRegex string = "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9]):\\d+$"
IPPortRegex string = "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]):\\d+$"
)
const (
ConnectionProviderLatency time.Duration = 1 // in seconds
DefaultBootstrapAddress string = "vminko.org:8004"
)
type AddressConsumer interface {
AddressFound(a string)
ErrorFindingAddresses(err error)
}
AddressList provider node addresses by reading them from a text file. Implements AddressProvider interface
type AddressList struct {
// contains filtered or unexported fields
}
func NewAddressList(filepath string) *AddressList
func (al *AddressList) RegisterAddressConsumer(ac AddressConsumer)
func (al *AddressList) Start()
func (al *AddressList) Stop()
AddressProvider isolates ConnectionProvider from implementations of various address discovery methods.
type AddressProvider interface {
RegisterAddressConsumer(ac AddressConsumer)
Start()
Stop()
}
Responsible for establishing connections with other peers.
type ConnectionProvider struct {
// contains filtered or unexported fields
}
func NewConnectionProvider(
ap AddressProvider,
hostport string,
maxInConnCount uint32,
maxOutConnCount uint32,
) *ConnectionProvider
func (cp *ConnectionProvider) AddressFound(a string)
func (cp *ConnectionProvider) ErrorFindingAddresses(err error)
func (cp *ConnectionProvider) Start()
func (cp *ConnectionProvider) Stop()
PeerPool is responsible for managing peers. It creates new peers, accounts peers and manages peer life cycle. But it has nothing to do with Entity transferring.
type PeerPool struct {
// contains filtered or unexported fields
}
func NewPeerPool(cp *ConnectionProvider, owner *owner.Owner) *PeerPool
func (pp *PeerPool) ListPeers() []*peer.Info
func (pp *PeerPool) Start()
func (pp *PeerPool) Stop()
func (pp *PeerPool) ValidatePeer(newPeer *peer.Peer) bool
| Name | Synopsis |
|---|---|
| .. | |
| connection | |
| peer | |