mirror of
https://github.com/gravitl/netmaker.git
synced 2024-09-20 15:26:04 +08:00
rm peers from node model
This commit is contained in:
parent
2ff8684fd4
commit
bff68bd945
|
@ -644,15 +644,7 @@ func createNode(w http.ResponseWriter, r *http.Request) {
|
|||
logic.ReturnErrorResponse(w, r, logic.FormatError(err, "internal"))
|
||||
return
|
||||
}
|
||||
peerUpdate, err := logic.GetPeerUpdate(&data.Node, &data.Host)
|
||||
if err != nil && !database.IsEmptyRecord(err) {
|
||||
logger.Log(0, r.Header.Get("user"),
|
||||
fmt.Sprintf("error fetching wg peers config for node [ %s ]: %v", data.Node.ID.String(), err))
|
||||
logic.ReturnErrorResponse(w, r, logic.FormatError(err, "internal"))
|
||||
return
|
||||
}
|
||||
data.Host.Peers = hostPeerUpdate.Peers
|
||||
data.Node.Peers = peerUpdate.Peers
|
||||
response := models.NodeJoinResponse{
|
||||
Node: data.Node,
|
||||
ServerConfig: server,
|
||||
|
|
|
@ -59,7 +59,6 @@ func (a *ApiNode) ConvertToServerNode(currentNode *Node) *Node {
|
|||
convertedNode.IsRelay = a.IsRelay
|
||||
convertedNode.IsRelayed = a.IsRelayed
|
||||
convertedNode.PendingDelete = a.PendingDelete
|
||||
convertedNode.Peers = currentNode.Peers
|
||||
convertedNode.Failover = a.Failover
|
||||
convertedNode.IsEgressGateway = a.IsEgressGateway
|
||||
convertedNode.IsIngressGateway = a.IsIngressGateway
|
||||
|
|
|
@ -56,27 +56,26 @@ type Iface struct {
|
|||
|
||||
// CommonNode - represents a commonn node data elements shared by netmaker and netclient
|
||||
type CommonNode struct {
|
||||
ID uuid.UUID `json:"id" yaml:"id"`
|
||||
HostID uuid.UUID `json:"hostid" yaml:"hostid"`
|
||||
Name string `json:"name" yaml:"name"`
|
||||
Network string `json:"network" yaml:"network"`
|
||||
NetworkRange net.IPNet `json:"networkrange" yaml:"networkrange"`
|
||||
NetworkRange6 net.IPNet `json:"networkrange6" yaml:"networkrange6"`
|
||||
InternetGateway *net.UDPAddr `json:"internetgateway" yaml:"internetgateway"`
|
||||
Server string `json:"server" yaml:"server"`
|
||||
Connected bool `json:"connected" yaml:"connected"`
|
||||
Address net.IPNet `json:"address" yaml:"address"`
|
||||
Address6 net.IPNet `json:"address6" yaml:"address6"`
|
||||
PostUp string `json:"postup" yaml:"postup"`
|
||||
PostDown string `json:"postdown" yaml:"postdown"`
|
||||
Action string `json:"action" yaml:"action"`
|
||||
LocalAddress net.IPNet `json:"localaddress" yaml:"localaddress"`
|
||||
IsLocal bool `json:"islocal" yaml:"islocal"`
|
||||
IsEgressGateway bool `json:"isegressgateway" yaml:"isegressgateway"`
|
||||
IsIngressGateway bool `json:"isingressgateway" yaml:"isingressgateway"`
|
||||
DNSOn bool `json:"dnson" yaml:"dnson"`
|
||||
PersistentKeepalive time.Duration `json:"persistentkeepalive" yaml:"persistentkeepalive"`
|
||||
Peers []wgtypes.PeerConfig `json:"peers" yaml:"peers"`
|
||||
ID uuid.UUID `json:"id" yaml:"id"`
|
||||
HostID uuid.UUID `json:"hostid" yaml:"hostid"`
|
||||
Name string `json:"name" yaml:"name"`
|
||||
Network string `json:"network" yaml:"network"`
|
||||
NetworkRange net.IPNet `json:"networkrange" yaml:"networkrange"`
|
||||
NetworkRange6 net.IPNet `json:"networkrange6" yaml:"networkrange6"`
|
||||
InternetGateway *net.UDPAddr `json:"internetgateway" yaml:"internetgateway"`
|
||||
Server string `json:"server" yaml:"server"`
|
||||
Connected bool `json:"connected" yaml:"connected"`
|
||||
Address net.IPNet `json:"address" yaml:"address"`
|
||||
Address6 net.IPNet `json:"address6" yaml:"address6"`
|
||||
PostUp string `json:"postup" yaml:"postup"`
|
||||
PostDown string `json:"postdown" yaml:"postdown"`
|
||||
Action string `json:"action" yaml:"action"`
|
||||
LocalAddress net.IPNet `json:"localaddress" yaml:"localaddress"`
|
||||
IsLocal bool `json:"islocal" yaml:"islocal"`
|
||||
IsEgressGateway bool `json:"isegressgateway" yaml:"isegressgateway"`
|
||||
IsIngressGateway bool `json:"isingressgateway" yaml:"isingressgateway"`
|
||||
DNSOn bool `json:"dnson" yaml:"dnson"`
|
||||
PersistentKeepalive time.Duration `json:"persistentkeepalive" yaml:"persistentkeepalive"`
|
||||
}
|
||||
|
||||
// Node - a model of a network node
|
||||
|
|
Loading…
Reference in a new issue