mirror of
https://github.com/gravitl/netmaker.git
synced 2025-02-27 09:36:08 +08:00
adding comments
This commit is contained in:
parent
7c56420b9f
commit
62d0a6a83a
2 changed files with 5 additions and 2 deletions
|
@ -19,7 +19,8 @@ import (
|
|||
"golang.org/x/crypto/bcrypt"
|
||||
)
|
||||
|
||||
const RELAY_NODE_ERR = "could not find relay for node "
|
||||
// RELAY_NODE_ERR - error to return if relay node is unfound
|
||||
const RELAY_NODE_ERR = "could not find relay for node"
|
||||
|
||||
// GetNetworkNodes - gets the nodes of a network
|
||||
func GetNetworkNodes(network string) ([]models.Node, error) {
|
||||
|
@ -508,7 +509,7 @@ func GetNodeRelay(network string, relayedNodeAddr string) (models.Node, error) {
|
|||
}
|
||||
}
|
||||
}
|
||||
return relay, errors.New(RELAY_NODE_ERR + relayedNodeAddr)
|
||||
return relay, errors.New(RELAY_NODE_ERR + " " + relayedNodeAddr)
|
||||
}
|
||||
|
||||
// GetNodeByIDorMacAddress - gets the node, if a mac address exists, but not id, then it should delete it and recreate in DB with new ID
|
||||
|
|
|
@ -84,6 +84,7 @@ func SetRelayedNodes(yesOrno string, networkName string, addrs []string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// SetNodeIsRelayed - Sets IsRelayed to on or off for relay
|
||||
func SetNodeIsRelayed(yesOrno string, id string) error {
|
||||
node, err := GetNodeByID(id)
|
||||
if err != nil {
|
||||
|
@ -106,6 +107,7 @@ func SetNodeIsRelayed(yesOrno string, id string) error {
|
|||
return database.Insert(node.ID, string(data), database.NODES_TABLE_NAME)
|
||||
}
|
||||
|
||||
// PeerListUnRelay - call this function if a relayed node fails to get its relay: unrelays node and gets new peer list
|
||||
func PeerListUnRelay(id string, network string) ([]models.Node, error) {
|
||||
err := SetNodeIsRelayed("no", id)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue