Documentation ¶
Index ¶
- Constants
- Variables
- func FixOSSettings() error
- type AddrInfo
- type KnownPeer
- type KnownPeerSitSpot
- type KnownPeers
- type Logger
- type MessageType
- type Network
- func (mesh *Network) Close() (err error)
- func (mesh *Network) ClosePeer(peerID peer.ID)
- func (mesh *Network) ConnectPeer(peerID peer.ID)
- func (mesh *Network) HandlePeerFound(addrInfo peer.AddrInfo)
- func (mesh *Network) IsIncomingStream(peerID peer.ID) *bool
- func (mesh *Network) NewStream(peerID peer.ID, protocolID p2pprotocol.ID) (stream Stream, err error)
- func (mesh *Network) SendBroadcastMessage(topic string, msg []byte) (err error)
- func (mesh *Network) SendMessage(peerID peer.ID, topic string, msg []byte) (err error)
- func (mesh *Network) SetMessageHandler(topic string, handler func(Stream, []byte))
- type Stream
- type StreamHandler
Constants ¶
View Source
const ( MessageTypeUndefined = MessageType(iota) MessageTypeOK MessageTypeStopConnectionOnYourSide MessageTypeDontReconnect MessageTypeCustom )
Variables ¶
Functions ¶
func FixOSSettings ¶
func FixOSSettings() error
Types ¶
type KnownPeer ¶
type KnownPeer struct { ID p2ppeer.ID SitSpots []*KnownPeerSitSpot }
type KnownPeerSitSpot ¶
type KnownPeers ¶
func (KnownPeers) MarshalJSON ¶
func (peers KnownPeers) MarshalJSON() ([]byte, error)
func (KnownPeers) Reset ¶
func (peers KnownPeers) Reset() error
func (*KnownPeers) UnmarshalJSON ¶
func (peers *KnownPeers) UnmarshalJSON(b []byte) error
type MessageType ¶
type MessageType uint8
type Network ¶
type Network struct {
// contains filtered or unexported fields
}
func (*Network) ConnectPeer ¶
func (*Network) HandlePeerFound ¶
this method is called by the IPFS Discovery service directly.
func (*Network) SendBroadcastMessage ¶
func (*Network) SendMessage ¶
type StreamHandler ¶
type StreamHandler interface { SetNetwork(network *Network) ProtocolID() protocol.ID NewIncomingStream(stream Stream, peerAddr AddrInfo) ConsiderKnownPeer(peerAddr AddrInfo) OnPeerConnect(peer.ID) SetID(id peer.ID) SetPrivateKey(privKey ed25519.PrivateKey) SetPSK(psk []byte) SetMyAddrs(addrs []multiaddr.Multiaddr) IsBadAddress(maddr multiaddr.Multiaddr) bool Start() error Close() error }
Click to show internal directories.
Click to hide internal directories.