netmaker/models/node.go

560 lines
17 KiB
Go
Raw Normal View History

2021-03-26 00:17:52 +08:00
package models
import (
2021-07-22 06:55:19 +08:00
"encoding/json"
2021-07-25 04:13:24 +08:00
"errors"
2021-04-25 20:18:43 +08:00
"math/rand"
"net"
2021-07-25 04:13:24 +08:00
"strings"
2021-04-25 20:18:43 +08:00
"time"
2021-07-27 00:24:36 +08:00
2021-07-25 04:13:24 +08:00
"github.com/go-playground/validator/v10"
2021-07-22 06:55:19 +08:00
"github.com/gravitl/netmaker/database"
2021-07-27 00:24:36 +08:00
"golang.org/x/crypto/bcrypt"
2021-03-26 00:17:52 +08:00
)
const charset = "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
2021-07-27 22:48:58 +08:00
const TEN_YEARS_IN_SECONDS = 300000000
2021-08-03 06:06:26 +08:00
// == ACTIONS == (can only be set by GRPC)
const NODE_UPDATE_KEY = "updatekey"
2021-08-10 00:43:09 +08:00
const NODE_SERVER_NAME = "netmaker"
2021-08-03 06:06:26 +08:00
const NODE_DELETE = "delete"
const NODE_IS_PENDING = "pending"
2021-08-06 04:46:23 +08:00
const NODE_NOOP = "noop"
2021-08-03 06:06:26 +08:00
2021-03-26 00:17:52 +08:00
var seededRand *rand.Rand = rand.New(
2021-04-25 20:18:43 +08:00
rand.NewSource(time.Now().UnixNano()))
2021-03-26 00:17:52 +08:00
//node struct
type Node struct {
2021-07-25 04:13:24 +08:00
ID string `json:"id,omitempty" bson:"id,omitempty"`
2021-08-03 06:06:26 +08:00
Address string `json:"address" bson:"address" yaml:"address" validate:"omitempty,ipv4"`
Address6 string `json:"address6" bson:"address6" yaml:"address6" validate:"omitempty,ipv6"`
LocalAddress string `json:"localaddress" bson:"localaddress" yaml:"localaddress" validate:"omitempty,ip"`
Name string `json:"name" bson:"name" yaml:"name" validate:"omitempty,max=12,in_charset"`
ListenPort int32 `json:"listenport" bson:"listenport" yaml:"listenport" validate:"omitempty,numeric,min=1024,max=65535"`
PublicKey string `json:"publickey" bson:"publickey" yaml:"publickey" validate:"required,base64"`
Endpoint string `json:"endpoint" bson:"endpoint" yaml:"endpoint" validate:"required,ip"`
PostUp string `json:"postup" bson:"postup" yaml:"postup"`
PostDown string `json:"postdown" bson:"postdown" yaml:"postdown"`
AllowedIPs []string `json:"allowedips" bson:"allowedips" yaml:"allowedips"`
PersistentKeepalive int32 `json:"persistentkeepalive" bson:"persistentkeepalive" yaml:"persistentkeepalive" validate:"omitempty,numeric,max=1000"`
SaveConfig string `json:"saveconfig" bson:"saveconfig" yaml:"saveconfig" validate:"checkyesorno"`
AccessKey string `json:"accesskey" bson:"accesskey" yaml:"accesskey"`
Interface string `json:"interface" bson:"interface" yaml:"interface"`
LastModified int64 `json:"lastmodified" bson:"lastmodified" yaml:"lastmodified"`
KeyUpdateTimeStamp int64 `json:"keyupdatetimestamp" bson:"keyupdatetimestamp" yaml:"keyupdatetimestamp"`
ExpirationDateTime int64 `json:"expdatetime" bson:"expdatetime" yaml:"expdatetime"`
LastPeerUpdate int64 `json:"lastpeerupdate" bson:"lastpeerupdate" yaml:"lastpeerupdate"`
LastCheckIn int64 `json:"lastcheckin" bson:"lastcheckin" yaml:"lastcheckin"`
MacAddress string `json:"macaddress" bson:"macaddress" yaml:"macaddress" validate:"required,mac,macaddress_unique"`
CheckInInterval int32 `json:"checkininterval" bson:"checkininterval" yaml:"checkininterval"`
Password string `json:"password" bson:"password" yaml:"password" validate:"required,min=6"`
Network string `json:"network" bson:"network" yaml:"network" validate:"network_exists"`
2021-09-18 22:33:14 +08:00
IsRelayed string `json:"isrelayed" bson:"isrelayed" yaml:"isrelayed"`
2021-08-03 06:06:26 +08:00
IsPending string `json:"ispending" bson:"ispending" yaml:"ispending"`
2021-09-18 22:33:14 +08:00
IsRelay string `json:"isrelay" bson:"isrelay" yaml:"isrelay" validate:"checkyesorno"`
2021-08-03 06:06:26 +08:00
IsEgressGateway string `json:"isegressgateway" bson:"isegressgateway" yaml:"isegressgateway"`
IsIngressGateway string `json:"isingressgateway" bson:"isingressgateway" yaml:"isingressgateway"`
EgressGatewayRanges []string `json:"egressgatewayranges" bson:"egressgatewayranges" yaml:"egressgatewayranges"`
2021-09-18 22:33:14 +08:00
RelayAddrs []string `json:"relayaddrs" bson:"relayaddrs" yaml:"relayaddrs"`
2021-08-03 06:06:26 +08:00
IngressGatewayRange string `json:"ingressgatewayrange" bson:"ingressgatewayrange" yaml:"ingressgatewayrange"`
2021-08-11 00:15:30 +08:00
IsStatic string `json:"isstatic" bson:"isstatic" yaml:"isstatic" validate:"checkyesorno"`
2021-08-03 06:06:26 +08:00
UDPHolePunch string `json:"udpholepunch" bson:"udpholepunch" yaml:"udpholepunch" validate:"checkyesorno"`
PullChanges string `json:"pullchanges" bson:"pullchanges" yaml:"pullchanges" validate:"checkyesorno"`
DNSOn string `json:"dnson" bson:"dnson" yaml:"dnson" validate:"checkyesorno"`
IsDualStack string `json:"isdualstack" bson:"isdualstack" yaml:"isdualstack" validate:"checkyesorno"`
2021-08-10 00:43:09 +08:00
IsServer string `json:"isserver" bson:"isserver" yaml:"isserver" validate:"checkyesorno"`
2021-08-03 06:06:26 +08:00
Action string `json:"action" bson:"action" yaml:"action"`
IsLocal string `json:"islocal" bson:"islocal" yaml:"islocal" validate:"checkyesorno"`
LocalRange string `json:"localrange" bson:"localrange" yaml:"localrange"`
Roaming string `json:"roaming" bson:"roaming" yaml:"roaming" validate:"checkyesorno"`
IPForwarding string `json:"ipforwarding" bson:"ipforwarding" yaml:"ipforwarding" validate:"checkyesorno"`
2021-08-31 03:58:23 +08:00
OS string `json:"os" bson:"os" yaml:"os"`
MTU int32 `json:"mtu" bson:"mtu" yaml:"mtu"`
}
func (node *Node) SetDefaultMTU() {
if node.MTU == 0 {
node.MTU = 1280
}
2021-08-03 06:06:26 +08:00
}
2021-08-11 00:15:30 +08:00
func (node *Node) SetDefaulIsPending() {
if node.IsPending == "" {
node.IsPending = "no"
}
}
2021-09-18 22:33:14 +08:00
func (node *Node) SetDefaultIsRelayed() {
if node.IsRelayed == "" {
node.IsRelayed = "no"
}
}
func (node *Node) SetDefaultIsRelay() {
if node.IsRelay == "" {
node.IsRelay = "no"
}
}
2021-08-11 00:15:30 +08:00
func (node *Node) SetDefaultEgressGateway() {
if node.IsEgressGateway == "" {
node.IsEgressGateway = "no"
}
}
func (node *Node) SetDefaultIngressGateway() {
if node.IsIngressGateway == "" {
node.IsIngressGateway = "no"
}
}
2021-08-06 04:46:23 +08:00
func (node *Node) SetDefaultAction() {
if node.Action == "" {
node.Action = NODE_NOOP
}
}
2021-08-06 00:52:50 +08:00
func (node *Node) SetRoamingDefault() {
if node.Roaming == "" {
node.Roaming = "yes"
2021-08-06 00:52:50 +08:00
}
}
func (node *Node) SetPullChangesDefault() {
if node.PullChanges == "" {
node.PullChanges = "no"
}
}
2021-08-03 06:06:26 +08:00
func (node *Node) SetIPForwardingDefault() {
if node.IPForwarding == "" {
node.IPForwarding = "yes"
2021-08-03 06:06:26 +08:00
}
}
func (node *Node) SetIsLocalDefault() {
if node.IsLocal == "" {
node.IsLocal = "no"
}
}
func (node *Node) SetDNSOnDefault() {
if node.DNSOn == "" {
2021-08-12 00:19:28 +08:00
node.DNSOn = "yes"
2021-08-03 06:06:26 +08:00
}
}
func (node *Node) SetIsDualStackDefault() {
if node.IsDualStack == "" {
node.IsDualStack = "no"
}
2021-03-26 00:17:52 +08:00
}
2021-08-10 00:43:09 +08:00
func (node *Node) SetIsServerDefault() {
if node.IsServer != "yes" {
node.IsServer = "no"
}
}
2021-08-10 02:28:43 +08:00
func (node *Node) SetIsStaticDefault() {
if node.IsServer == "yes" {
node.IsStatic = "yes"
} else if node.IsStatic != "yes" {
node.IsStatic = "no"
}
}
2021-04-25 20:18:43 +08:00
func (node *Node) SetLastModified() {
2021-03-26 00:17:52 +08:00
node.LastModified = time.Now().Unix()
}
2021-04-25 20:18:43 +08:00
func (node *Node) SetLastCheckIn() {
node.LastCheckIn = time.Now().Unix()
2021-03-26 00:17:52 +08:00
}
2021-04-25 20:18:43 +08:00
func (node *Node) SetLastPeerUpdate() {
node.LastPeerUpdate = time.Now().Unix()
2021-03-26 00:17:52 +08:00
}
2021-07-25 04:13:24 +08:00
func (node *Node) SetID() {
node.ID = node.MacAddress + "###" + node.Network
}
2021-04-25 20:18:43 +08:00
func (node *Node) SetExpirationDateTime() {
2021-07-27 22:48:58 +08:00
node.ExpirationDateTime = time.Now().Unix() + TEN_YEARS_IN_SECONDS
2021-04-06 08:47:19 +08:00
}
2021-04-25 20:18:43 +08:00
func (node *Node) SetDefaultName() {
if node.Name == "" {
2021-08-09 22:58:09 +08:00
node.Name = GenerateNodeName()
2021-04-25 20:18:43 +08:00
}
2021-03-26 00:17:52 +08:00
}
2021-08-10 00:43:09 +08:00
func (node *Node) CheckIsServer() bool {
nodeData, err := database.FetchRecords(database.NODES_TABLE_NAME)
if err != nil && !database.IsEmptyRecord(err) {
return false
}
for _, value := range nodeData {
var tmpNode Node
if err := json.Unmarshal([]byte(value), &tmpNode); err != nil {
continue
}
if tmpNode.Network == node.Network && tmpNode.MacAddress != node.MacAddress {
return false
}
}
return true
}
2021-07-22 06:55:19 +08:00
func (node *Node) GetNetwork() (Network, error) {
var network Network
networkData, err := database.FetchRecord(database.NETWORKS_TABLE_NAME, node.Network)
if err != nil {
return network, err
}
if err = json.Unmarshal([]byte(networkData), &network); err != nil {
return Network{}, err
}
return network, nil
}
2021-03-26 00:17:52 +08:00
//TODO: I dont know why this exists
//This should exist on the node.go struct. I'm sure there was a reason?
2021-04-25 20:18:43 +08:00
func (node *Node) SetDefaults() {
//TODO: Maybe I should make Network a part of the node struct. Then we can just query the Network object for stuff.
parentNetwork, _ := node.GetNetwork()
2021-07-27 22:48:58 +08:00
node.ExpirationDateTime = time.Now().Unix() + TEN_YEARS_IN_SECONDS
2021-04-25 20:18:43 +08:00
if node.ListenPort == 0 {
node.ListenPort = parentNetwork.DefaultListenPort
}
2021-07-25 04:13:24 +08:00
if node.SaveConfig == "" {
2021-07-24 06:24:34 +08:00
if parentNetwork.DefaultSaveConfig != "" {
2021-07-25 04:13:24 +08:00
node.SaveConfig = parentNetwork.DefaultSaveConfig
2021-07-26 04:05:31 +08:00
} else {
node.SaveConfig = "yes"
2021-05-06 22:35:04 +08:00
}
2021-04-25 20:18:43 +08:00
}
if node.Interface == "" {
node.Interface = parentNetwork.DefaultInterface
}
if node.PersistentKeepalive == 0 {
node.PersistentKeepalive = parentNetwork.DefaultKeepalive
}
if node.PostUp == "" {
postup := parentNetwork.DefaultPostUp
node.PostUp = postup
}
2021-08-10 02:13:19 +08:00
if node.IsStatic == "" {
node.IsStatic = "no"
2021-07-22 06:55:19 +08:00
}
2021-07-25 04:13:24 +08:00
if node.UDPHolePunch == "" {
node.UDPHolePunch = parentNetwork.DefaultUDPHolePunch
2021-07-26 04:05:31 +08:00
if node.UDPHolePunch == "" {
node.UDPHolePunch = "yes"
}
2021-07-25 04:13:24 +08:00
}
// == Parent Network settings ==
2021-04-25 20:18:43 +08:00
node.CheckInInterval = parentNetwork.DefaultCheckInInterval
node.IsDualStack = parentNetwork.IsDualStack
2021-08-31 03:58:23 +08:00
node.MTU = parentNetwork.DefaultMTU
// == node defaults if not set by parent ==
2021-08-03 06:06:26 +08:00
node.SetIPForwardingDefault()
node.SetDNSOnDefault()
node.SetIsLocalDefault()
node.SetIsDualStackDefault()
2021-07-25 04:13:24 +08:00
node.SetLastModified()
node.SetDefaultName()
node.SetLastCheckIn()
node.SetLastPeerUpdate()
2021-08-06 00:55:20 +08:00
node.SetRoamingDefault()
node.SetPullChangesDefault()
2021-08-06 04:46:23 +08:00
node.SetDefaultAction()
2021-07-25 04:13:24 +08:00
node.SetID()
2021-08-10 00:43:09 +08:00
node.SetIsServerDefault()
2021-08-10 02:28:43 +08:00
node.SetIsStaticDefault()
2021-08-11 00:15:30 +08:00
node.SetDefaultEgressGateway()
node.SetDefaultIngressGateway()
node.SetDefaulIsPending()
2021-08-31 03:58:23 +08:00
node.SetDefaultMTU()
2021-09-18 22:33:14 +08:00
node.SetDefaultIsRelayed()
node.SetDefaultIsRelay()
2021-07-25 04:13:24 +08:00
node.KeyUpdateTimeStamp = time.Now().Unix()
}
2021-07-27 00:24:36 +08:00
func (newNode *Node) Fill(currentNode *Node) {
if newNode.ID == "" {
newNode.ID = currentNode.ID
}
2021-08-11 00:15:30 +08:00
if newNode.Address == "" && newNode.IsStatic != "yes" {
2021-07-27 00:24:36 +08:00
newNode.Address = currentNode.Address
}
2021-08-11 00:15:30 +08:00
if newNode.Address6 == "" && newNode.IsStatic != "yes" {
2021-07-27 00:24:36 +08:00
newNode.Address6 = currentNode.Address6
}
if newNode.LocalAddress == "" {
newNode.LocalAddress = currentNode.LocalAddress
}
if newNode.Name == "" {
newNode.Name = currentNode.Name
}
2021-08-11 00:15:30 +08:00
if newNode.ListenPort == 0 && newNode.IsStatic != "yes" {
2021-07-27 00:24:36 +08:00
newNode.ListenPort = currentNode.ListenPort
}
2021-08-10 02:13:19 +08:00
if newNode.PublicKey == "" && newNode.IsStatic != "yes" {
2021-07-27 00:24:36 +08:00
newNode.PublicKey = currentNode.PublicKey
2021-07-27 01:57:50 +08:00
} else {
newNode.KeyUpdateTimeStamp = time.Now().Unix()
2021-07-27 00:24:36 +08:00
}
2021-08-11 00:15:30 +08:00
if newNode.Endpoint == "" && newNode.IsStatic != "yes" {
2021-07-27 00:24:36 +08:00
newNode.Endpoint = currentNode.Endpoint
}
if newNode.PostUp == "" {
newNode.PostUp = currentNode.PostUp
}
if newNode.PostDown == "" {
newNode.PostDown = currentNode.PostDown
}
if newNode.AllowedIPs == nil {
newNode.AllowedIPs = currentNode.AllowedIPs
}
if newNode.PersistentKeepalive == 0 {
newNode.PersistentKeepalive = currentNode.PersistentKeepalive
}
if newNode.SaveConfig == "" {
newNode.SaveConfig = currentNode.SaveConfig
}
if newNode.AccessKey == "" {
newNode.AccessKey = currentNode.AccessKey
}
if newNode.Interface == "" {
newNode.Interface = currentNode.Interface
}
if newNode.LastModified == 0 {
newNode.LastModified = currentNode.LastModified
}
if newNode.KeyUpdateTimeStamp == 0 {
newNode.LastModified = currentNode.LastModified
}
if newNode.ExpirationDateTime == 0 {
newNode.ExpirationDateTime = currentNode.ExpirationDateTime
}
if newNode.LastPeerUpdate == 0 {
newNode.LastPeerUpdate = currentNode.LastPeerUpdate
}
if newNode.LastCheckIn == 0 {
newNode.LastCheckIn = currentNode.LastCheckIn
}
if newNode.MacAddress == "" {
newNode.MacAddress = currentNode.MacAddress
}
if newNode.CheckInInterval == 0 {
newNode.CheckInInterval = currentNode.CheckInInterval
}
if newNode.Password != "" {
err := bcrypt.CompareHashAndPassword([]byte(newNode.Password), []byte(currentNode.Password))
if err != nil && currentNode.Password != newNode.Password {
hash, err := bcrypt.GenerateFromPassword([]byte(newNode.Password), 5)
if err == nil {
newNode.Password = string(hash)
}
}
} else {
newNode.Password = currentNode.Password
}
if newNode.Network == "" {
newNode.Network = currentNode.Network
}
if newNode.IsPending == "" {
newNode.IsPending = currentNode.IsPending
}
if newNode.IsEgressGateway == "" {
newNode.IsEgressGateway = currentNode.IsEgressGateway
}
if newNode.IsIngressGateway == "" {
newNode.IsIngressGateway = currentNode.IsIngressGateway
}
if newNode.EgressGatewayRanges == nil {
newNode.EgressGatewayRanges = currentNode.EgressGatewayRanges
}
if newNode.IngressGatewayRange == "" {
newNode.IngressGatewayRange = currentNode.IngressGatewayRange
}
2021-08-10 02:13:19 +08:00
if newNode.IsStatic == "" {
newNode.IsStatic = currentNode.IsStatic
2021-07-27 00:24:36 +08:00
}
if newNode.UDPHolePunch == "" {
newNode.UDPHolePunch = currentNode.SaveConfig
}
2021-08-03 06:06:26 +08:00
if newNode.DNSOn == "" {
newNode.DNSOn = currentNode.DNSOn
}
if newNode.IsDualStack == "" {
newNode.IsDualStack = currentNode.IsDualStack
}
if newNode.IsLocal == "" {
newNode.IsLocal = currentNode.IsLocal
}
if newNode.IPForwarding == "" {
newNode.IPForwarding = currentNode.IPForwarding
}
2021-08-06 00:55:20 +08:00
if newNode.PullChanges == "" {
newNode.PullChanges = currentNode.PullChanges
}
2021-08-03 06:06:26 +08:00
if newNode.Roaming == "" {
newNode.Roaming = currentNode.Roaming
}
if newNode.Action == "" {
newNode.Action = currentNode.Action
}
2021-08-10 02:13:19 +08:00
newNode.IsServer = currentNode.IsServer
2021-08-10 02:28:43 +08:00
if newNode.IsServer == "yes" {
newNode.IsStatic = "yes"
}
2021-08-31 03:58:23 +08:00
if newNode.MTU == 0 {
newNode.MTU = currentNode.MTU
}
2021-09-17 08:00:40 +08:00
if newNode.OS == "" {
newNode.OS = currentNode.OS
}
if newNode.RelayAddrs == nil {
newNode.RelayAddrs = currentNode.RelayAddrs
}
if newNode.IsRelay == "" {
newNode.IsRelay = currentNode.IsRelay
}
2021-09-18 22:33:14 +08:00
if newNode.IsRelayed == "" {
newNode.IsRelayed = currentNode.IsRelayed
2021-09-17 08:00:40 +08:00
}
2021-07-27 00:24:36 +08:00
}
2021-07-25 04:13:24 +08:00
func (currentNode *Node) Update(newNode *Node) error {
newNode.Fill(currentNode)
2021-07-25 04:13:24 +08:00
if err := newNode.Validate(true); err != nil {
return err
}
newNode.SetID()
if newNode.ID == currentNode.ID {
newNode.SetLastModified()
2021-07-25 04:13:24 +08:00
if data, err := json.Marshal(newNode); err != nil {
return err
} else {
2021-08-07 05:35:31 +08:00
return database.Insert(newNode.ID, string(data), database.NODES_TABLE_NAME)
2021-07-25 04:13:24 +08:00
}
}
return errors.New("failed to update node " + newNode.MacAddress + ", cannot change macaddress.")
2021-03-26 00:17:52 +08:00
}
func StringWithCharset(length int, charset string) string {
2021-04-25 20:18:43 +08:00
b := make([]byte, length)
for i := range b {
b[i] = charset[seededRand.Intn(len(charset))]
}
return string(b)
2021-03-26 00:17:52 +08:00
}
//Check for valid IPv4 address
//Note: We dont handle IPv6 AT ALL!!!!! This definitely is needed at some point
//But for iteration 1, lets just stick to IPv4. Keep it simple stupid.
func IsIpv4Net(host string) bool {
2021-04-25 20:18:43 +08:00
return net.ParseIP(host) != nil
2021-03-26 00:17:52 +08:00
}
2021-07-25 04:13:24 +08:00
func (node *Node) Validate(isUpdate bool) error {
v := validator.New()
_ = v.RegisterValidation("macaddress_unique", func(fl validator.FieldLevel) bool {
if isUpdate {
return true
}
isFieldUnique, _ := node.IsIDUnique()
return isFieldUnique
})
_ = v.RegisterValidation("network_exists", func(fl validator.FieldLevel) bool {
_, err := node.GetNetwork()
return err == nil
})
_ = v.RegisterValidation("in_charset", func(fl validator.FieldLevel) bool {
isgood := node.NameInNodeCharSet()
return isgood
})
_ = v.RegisterValidation("checkyesorno", func(fl validator.FieldLevel) bool {
return CheckYesOrNo(fl)
})
err := v.Struct(node)
return err
}
func (node *Node) IsIDUnique() (bool, error) {
2021-08-06 00:52:50 +08:00
_, err := database.FetchRecord(database.NODES_TABLE_NAME, node.ID)
return database.IsEmptyRecord(err), err
2021-07-25 04:13:24 +08:00
}
func (node *Node) NameInNodeCharSet() bool {
charset := "abcdefghijklmnopqrstuvwxyz1234567890-"
for _, char := range node.Name {
if !strings.Contains(charset, strings.ToLower(string(char))) {
return false
}
}
return true
}
func GetAllNodes() ([]Node, error) {
var nodes []Node
collection, err := database.FetchRecords(database.NODES_TABLE_NAME)
if err != nil {
2021-08-06 01:47:05 +08:00
if database.IsEmptyRecord(err) {
return []Node{}, nil
}
2021-07-25 04:13:24 +08:00
return []Node{}, err
}
for _, value := range collection {
var node Node
if err := json.Unmarshal([]byte(value), &node); err != nil {
return []Node{}, err
}
// add node to our array
nodes = append(nodes, node)
}
return nodes, nil
}
2021-07-27 00:24:36 +08:00
func GetNode(macaddress string, network string) (Node, error) {
var node Node
key, err := GetID(macaddress, network)
if err != nil {
return node, err
}
data, err := database.FetchRecord(database.NODES_TABLE_NAME, key)
if err != nil {
return node, err
}
if err = json.Unmarshal([]byte(data), &node); err != nil {
return node, err
}
return node, err
}
func GetID(macaddress string, network string) (string, error) {
if macaddress == "" || network == "" {
return "", errors.New("unable to get record key")
}
return macaddress + "###" + network, nil
}