Documentation ¶
Index ¶
- func ConfigUpdate(w http.ResponseWriter, r *http.Request)
- func Join(w http.ResponseWriter, r *http.Request)
- func Leave(w http.ResponseWriter, r *http.Request)
- func List(w http.ResponseWriter, r *http.Request)
- func Ping(w http.ResponseWriter, r *http.Request)
- func Refill(w http.ResponseWriter, r *http.Request)
- func Reset(w http.ResponseWriter, r *http.Request)
- type BootstrapData
- type Config
- type Peer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigUpdate ¶
func ConfigUpdate(w http.ResponseWriter, r *http.Request)
ConfigUpdate update the configuration of the bootstrap service. It is only for manual administration via curl and not used by the API.
func Join ¶
func Join(w http.ResponseWriter, r *http.Request)
Join gets information of the new member via http and stores it in Firestore
func Leave ¶
func Leave(w http.ResponseWriter, r *http.Request)
Leave gets information of the leaving peer via http and deletes it in Firestore.
func List ¶
func List(w http.ResponseWriter, r *http.Request)
List sends back all bootstrap data from Firestore
func Refill ¶
func Refill(w http.ResponseWriter, r *http.Request)
Refill checks to add the requesting peer in the list of bootstrap peers. If a bootstrap peer has left, other peers do ask to fill the gap. Criterium is the number of needed peers, and, the peer with the oldest timestamp will succeed then.
Types ¶
type BootstrapData ¶
BootstrapData is a complete data structure
type Config ¶
type Config struct { MaxPeers int `json:"maxpeers,omitempty"` // Max number of bootstrap peers to be saved MinRefillCandidates int `json:"minrefillcandidates,omitempty"` // Number used to decide peer send refill request NumPeers int `json:"numpeers,omitempty"` // Number of bootstrap peers }
Config has the configuration of the bootstrap service.
type Peer ¶
type Peer struct { ID string `json:"id,omitempty"` // UUID Name string `json:"name,omitempty"` // chat name Ip string `json:"ip,omitempty"` Port string `json:"port,omitempty"` Protocol string `json:"protocol,omitempty"` // "tcp" or "udp" // todo get rid of unused field status Status string `json:"status,omitempty"` Timestamp string `json:"timestamp,omitempty"` // Unix time in seconds }
Peer is the struct for the collection