Documentation
¶
Index ¶
- func FirstTCPAddr(h *Host) string
- func GenerateIdentityB64() (string, error)
- func PrivateKeyFromB64(encoded string) (crypto.PrivKey, error)
- type Host
- func (h *Host) AttachDiscovery(mgr *discovery.Manager)
- func (h *Host) Close() error
- func (h *Host) ConnectByAddr(ctx context.Context, addrStr string) (PeerInfo, error)
- func (h *Host) NicknameFor(id peer.ID) string
- func (h *Host) RememberNickname(id peer.ID, nickname string)
- func (h *Host) SendFrame(ctx context.Context, peerID peer.ID, frame proto.Frame) error
- func (h *Host) StartDHTDiscovery(ctx context.Context, mgr *discovery.Manager)
- func (h *Host) StartStreamHandler()
- type PeerInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FirstTCPAddr ¶
FirstTCPAddr returns the first TCP listen multiaddr of h (with peer ID appended).
func GenerateIdentityB64 ¶
Types ¶
type Host ¶
type Host struct {
Libp2p host.Host
Nickname string
OnFrame func(peer.ID, proto.Frame)
OnFileStream func(peer.ID, proto.Frame, io.Reader)
OnConnected func(peer.ID)
OnLog func(string)
// contains filtered or unexported fields
}
func NewHostWithIdentity ¶
func (*Host) AttachDiscovery ¶
func (*Host) ConnectByAddr ¶
ConnectByAddr connects to a peer by full multiaddr string (e.g., /ip4/1.2.3.4/tcp/4001/p2p/QmXxx)
func (*Host) StartDHTDiscovery ¶
StartDHTDiscovery advertises on the DHT and periodically finds peers.
func (*Host) StartStreamHandler ¶
func (h *Host) StartStreamHandler()
StartStreamHandler registers the /bdpeer/1.0.0 stream handler.
Click to show internal directories.
Click to hide internal directories.