mirror of
https://github.com/tim-beatham/smegmesh.git
synced 2025-08-26 04:25:19 +02:00
Adding aliases that automatically gets added
This commit is contained in:
15
pkg/mesh/alias.go
Normal file
15
pkg/mesh/alias.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package mesh
|
||||
|
||||
import "github.com/tim-beatham/wgmesh/pkg/hosts"
|
||||
|
||||
func AddAliases(meshid string, snapshot MeshSnapshot) {
|
||||
hosts := hosts.NewHostsManipulator(meshid)
|
||||
|
||||
for _, node := range snapshot.GetNodes() {
|
||||
if node.GetAlias() != "" {
|
||||
hosts.AddAddr(node.GetWgHost().IP, node.GetAlias())
|
||||
}
|
||||
}
|
||||
|
||||
hosts.Write()
|
||||
}
|
Reference in New Issue
Block a user