Documentation ¶
Overview ¶
Package P2P represents a peer-to-peer network linked with go-libp2p.
Index ¶
- type Adapter
- func (e *Adapter) Enabled() bool
- func (e *Adapter) Handle(err error)
- func (e *Adapter) HasTarget() bool
- func (e *Adapter) Listen(stop chan error)
- func (e *Adapter) PushMsgForFiles(stop chan error)
- func (e *Adapter) SetTarget(target string)
- func (e *Adapter) Shutdown()
- func (e *Adapter) Target() string
- type Config
- type Option
- type XCache
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter représente un adaptateur pair à pair.
func New ¶
func New( cfg Config, per persistenceadapter.Adapter, wallets wallet.IWallets, logs *zap.Logger, evt *event.Event, opts ...Option, ) *Adapter
New represent a new peer to peer adapter.
func (*Adapter) PushMsgForFiles ¶
PushMsgForFiles sends a message to retrieve files.
type Config ¶
type Config struct { Enabled bool `"mapstructure:p2p_enabled"` // Parse options from the command line // Port ouvre le port auquel nous voulons autoriser les connexions Port int `mapstructure:"p2p_port"` // secio : sécurisation des flux Secio bool `mapstructure:"p2p_secio_enabled"` // target nous permet de spécifier l'adresse d'un autre hôte auquel nous voulons nous connecter, // ce qui signifie que nous agissons en tant qu'homologue d'un hôte si nous utilisons ce drapeau. Target string `mapstructure:"p2p_target"` // seed est le paramètre aléatoire facultatif utilisé pour construire notre adresse // que d'autres pairs peuvent utiliser pour se connecter à nous Seed int64 `mapstructure:"p2p_seed"` TimeToCommunicate int `mapstructure:"p2p_time_to_communicate"` // token utilisé pour assurer la sécurité de la connexion Token string `mapstructure:"p2p_token"` ProtocolID string `mapstructure:"p2p_protocol_ID"` DiscoveryNamespace string `mapstructure:"p2p_discovery_name"` AddressTimer time.Duration `mapstructure:"p2p_address_timer"` }
type Option ¶
type Option func(e *Adapter)
Option is the type of option passed to the constructor.
func WithXCache ¶
WithXCache offers the possibility to add a cache system to the peer-to-peer adapter.
Click to show internal directories.
Click to hide internal directories.