mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-05 16:57:51 +08:00
comment changes
This commit is contained in:
@@ -8,17 +8,17 @@ import (
|
|||||||
|
|
||||||
// == type functions ==
|
// == type functions ==
|
||||||
|
|
||||||
// ACL.AllowNode - allows a node by ID in memory
|
// ACL.Allow - allows access by ID in memory
|
||||||
func (acl ACL) Allow(ID AclID) {
|
func (acl ACL) Allow(ID AclID) {
|
||||||
acl[ID] = Allowed
|
acl[ID] = Allowed
|
||||||
}
|
}
|
||||||
|
|
||||||
// ACL.DisallowNode - disallows a node access by ID in memory
|
// ACL.DisallowNode - disallows access by ID in memory
|
||||||
func (acl ACL) Disallow(ID AclID) {
|
func (acl ACL) Disallow(ID AclID) {
|
||||||
acl[ID] = NotAllowed
|
acl[ID] = NotAllowed
|
||||||
}
|
}
|
||||||
|
|
||||||
// ACL.Remove - removes a node from a ACL
|
// ACL.Remove - removes a node from a ACL in memory
|
||||||
func (acl ACL) Remove(ID AclID) {
|
func (acl ACL) Remove(ID AclID) {
|
||||||
delete(acl, ID)
|
delete(acl, ID)
|
||||||
}
|
}
|
||||||
@@ -73,7 +73,7 @@ func (aclContainer ACLContainer) Get(containerID ContainerID) (ACLContainer, err
|
|||||||
|
|
||||||
// == private ==
|
// == private ==
|
||||||
|
|
||||||
// fetchACLContainer - fetches all current node rules in given network ACL
|
// fetchACLContainer - fetches all current rules in given ACL container
|
||||||
func fetchACLContainer(containerID ContainerID) (ACLContainer, error) {
|
func fetchACLContainer(containerID ContainerID) (ACLContainer, error) {
|
||||||
aclJson, err := fetchACLContainerJson(ContainerID(containerID))
|
aclJson, err := fetchACLContainerJson(ContainerID(containerID))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -86,7 +86,7 @@ func fetchACLContainer(containerID ContainerID) (ACLContainer, error) {
|
|||||||
return currentNetworkACL, nil
|
return currentNetworkACL, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// fetchACLContainerJson - fetch the current ACL of given network except in json string
|
// fetchACLContainerJson - fetch the current ACL of given container except in json string
|
||||||
func fetchACLContainerJson(containerID ContainerID) (ACLJson, error) {
|
func fetchACLContainerJson(containerID ContainerID) (ACLJson, error) {
|
||||||
currentACLs, err := database.FetchRecord(database.NODE_ACLS_TABLE_NAME, string(containerID))
|
currentACLs, err := database.FetchRecord(database.NODE_ACLS_TABLE_NAME, string(containerID))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -106,7 +106,7 @@ func upsertACL(containerID ContainerID, ID AclID, acl ACL) (ACL, error) {
|
|||||||
return acl, err
|
return acl, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// upsertACLContainer - Inserts or updates a network ACL given the json string of the ACL and the network name
|
// upsertACLContainer - Inserts or updates a network ACL given the json string of the ACL and the container ID
|
||||||
// if nil, create it
|
// if nil, create it
|
||||||
func upsertACLContainer(containerID ContainerID, aclContainer ACLContainer) (ACLContainer, error) {
|
func upsertACLContainer(containerID ContainerID, aclContainer ACLContainer) (ACLContainer, error) {
|
||||||
if aclContainer == nil {
|
if aclContainer == nil {
|
||||||
|
Reference in New Issue
Block a user