Documentation ¶
Index ¶
- Variables
- func AddrToPeerInfo(multiAddr string) (*peer.AddrInfo, error)
- func Send(sender func([]byte) ([]byte, error), msg *pb.Message) (*pb.Message, error)
- type ConnectHandler
- type DHTManager
- type Handler
- type MessageHandler
- type MessageHandlerPort
- type PeerManager
- type Swarm
- func (swarm *Swarm) AsyncSendByID(id string, msg *pb.Message) error
- func (swarm *Swarm) AsyncSendWithPort(s port.Port, msg *pb.Message) error
- func (swarm *Swarm) Connect(addrInfo *peer.AddrInfo) (string, error)
- func (swarm *Swarm) FindProviders(id string) (string, error)
- func (swarm *Swarm) Peers() map[string]*peer.AddrInfo
- func (swarm *Swarm) Provider(key string, passed bool) error
- func (swarm *Swarm) RegisterConnectHandler(handler ConnectHandler) error
- func (swarm *Swarm) RegisterMsgHandler(messageType pb.Message_Type, handler MessageHandler) error
- func (swarm *Swarm) RegisterMultiMsgHandler(messageTypes []pb.Message_Type, handler MessageHandler) error
- func (swarm *Swarm) RegisterMultiMsgHandlerPort(messageTypes []pb.Message_Type, handler MessageHandlerPort) error
- func (swarm *Swarm) SendByID(id string, msg *pb.Message) (*pb.Message, error)
- func (swarm *Swarm) SendWithPort(s port.Port, msg *pb.Message) (*pb.Message, error)
- func (swarm *Swarm) Start() error
- func (swarm *Swarm) Stop() error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Office = "office" Test = "test" )
Functions ¶
func AddrToPeerInfo ¶
AddrToPeerInfo transfer addr to PeerInfo addr example: "/ip4/104.236.76.40/tcp/4001/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64"
Types ¶
type ConnectHandler ¶
type ConnectHandler func(string)
type DHTManager ¶
type DHTManager interface { // Search for peers who are able to provide a given key FindProviders(id string) (string, error) // Provide adds the given cid to the content routing system. If 'true' is // passed, it also announces it, otherwise it is just kept in the localPeer // accounting of which objects are being provided. Provider(string, bool) error }
type Handler ¶
type Handler interface { // RegisterMsgHandler RegisterMsgHandler(pb.Message_Type, MessageHandler) error // RegisterMultiMsgHandler RegisterMultiMsgHandler([]pb.Message_Type, MessageHandler) error // RegisterConnectHandler RegisterConnectHandler(ConnectHandler) error }
type PeerManager ¶
type PeerManager interface { internal.Launcher DHTManager Handler Connect(info *peer.AddrInfo) (string, error) // AsyncSend sends message to peer with peer info. AsyncSendByID(string, *pb.Message) error // Send sends message waiting response SendByID(string, *pb.Message) (*pb.Message, error) AsyncSendWithPort(port.Port, *pb.Message) error SendWithPort(s port.Port, msg *pb.Message) (*pb.Message, error) }
type Swarm ¶
type Swarm struct {
// contains filtered or unexported fields
}
func New ¶
func New(config *repo.Config, router router.Router, nodePrivKey crypto.PrivateKey, privKey crypto.PrivateKey, providers uint64, logger logrus.FieldLogger) (*Swarm, error)
func (*Swarm) AsyncSendWithPort ¶
func (*Swarm) RegisterConnectHandler ¶
func (swarm *Swarm) RegisterConnectHandler(handler ConnectHandler) error
func (*Swarm) RegisterMsgHandler ¶
func (swarm *Swarm) RegisterMsgHandler(messageType pb.Message_Type, handler MessageHandler) error
func (*Swarm) RegisterMultiMsgHandler ¶
func (swarm *Swarm) RegisterMultiMsgHandler(messageTypes []pb.Message_Type, handler MessageHandler) error
func (*Swarm) RegisterMultiMsgHandlerPort ¶
func (swarm *Swarm) RegisterMultiMsgHandlerPort(messageTypes []pb.Message_Type, handler MessageHandlerPort) error
func (*Swarm) SendWithPort ¶
Directories ¶
Path | Synopsis |
---|---|
Package mock_peermgr is a generated GoMock package.
|
Package mock_peermgr is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.