Skip to content

Commit

Permalink
Remove unneeded stop values
Browse files Browse the repository at this point in the history
  • Loading branch information
NHAS committed Oct 16, 2024
1 parent abf59ba commit 53fbfa5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
2 changes: 2 additions & 0 deletions internal/router/wireguard.go
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,8 @@ func (f *Firewall) _addPeerToMaps(public wgtypes.Key, address, username string,
address: addressNetAddr,
associatedNode: node,
username: username,
lastPacketTime: time.Time{},
sessionExpiry: time.Time{}, // Todo take this from db
}

addressesMap[address] = &device
Expand Down
22 changes: 2 additions & 20 deletions internal/routetypes/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,15 @@ import (
)

const (
MAX_POLICIES = 128

ICMP = 1 // Internet Control Message
TCP = 6 // Transmission Control
UDP = 17 // User Datagram
)

type Rule struct {
//We may have multiple keys in the instance where a domain with multiple A/AAA records is passed in
Keys []Key

NumPolicies int
Values []Policy
Keys []Key
Values []Policy
}

var (
Expand Down Expand Up @@ -129,20 +125,6 @@ func ParseRules(mfa, public, deny []string) (result []Rule, errs []error) {

}

for i := range result {
if len(result[i].Values) > MAX_POLICIES {
errs = append(errs, errors.New("number of policies defined was greather than max"))
return nil, errs
}

temp := make([]Policy, 0, MAX_POLICIES)
temp = append(temp, result[i].Values...)

result[i].NumPolicies = len(result[i].Values)

result[i].Values = temp[:cap(temp)]
}

// Dont add a cache entry if there was an error parsing
if len(errs) == 0 {
rwLock.Lock()
Expand Down

0 comments on commit 53fbfa5

Please sign in to comment.