Documentation ¶
Index ¶
- func GetExternalIP() string
- type MessagePayload
- type Peer
- func (p *Peer) ConnectToPeer(ip string) error
- func (p *Peer) HandleIncoming(w http.ResponseWriter, r *http.Request)
- func (p *Peer) RetrieveMessages(w http.ResponseWriter, r *http.Request)
- func (p *Peer) SendMessage(ip string, msg msg.Message)
- func (p *Peer) StoreMessage(w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MessagePayload ¶
Expected JSON payload of an incoming message
type Peer ¶
type Peer struct { // Exposed information Ip string `json:"ip"` // IP of our local node Version string `json:"version"` // Protocol version Services struct { Messenger struct { Total int `json:"total"` Broadhash string `json:"broadhash"` } `json:"messenger"` } `json:"services"` Os string `json:"os"` // Operating system the local node is running // contains filtered or unexported fields }
A representation of a Peer
func (*Peer) ConnectToPeer ¶
Connect to a peer based on its IP address
func (*Peer) HandleIncoming ¶
func (p *Peer) HandleIncoming(w http.ResponseWriter, r *http.Request)
Incoming messages
func (*Peer) RetrieveMessages ¶
func (p *Peer) RetrieveMessages(w http.ResponseWriter, r *http.Request)
Retrieve messages querying via a public key with a GET request Return a list of all the messages we have for this public key. It will be up to the client to filter them.
func (*Peer) SendMessage ¶
Send messages to other peers
func (*Peer) StoreMessage ¶
func (p *Peer) StoreMessage(w http.ResponseWriter, r *http.Request)
Submit a message to other peers on the network through the HTTP API. This endpoint will take a JSON payload, convert it to a P2P friendly message and then broadcast to the other connected nodes.
Click to show internal directories.
Click to hide internal directories.