From 53fbfa5bacef833472d6437fe2d3aec36efc8053 Mon Sep 17 00:00:00 2001 From: NHAS Date: Wed, 16 Oct 2024 17:19:06 +1300 Subject: [PATCH] Remove unneeded stop values --- internal/router/wireguard.go | 2 ++ internal/routetypes/parser.go | 22 ++-------------------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/internal/router/wireguard.go b/internal/router/wireguard.go index 590884d0..514be36a 100644 --- a/internal/router/wireguard.go +++ b/internal/router/wireguard.go @@ -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 diff --git a/internal/routetypes/parser.go b/internal/routetypes/parser.go index beeb253b..21f564c8 100644 --- a/internal/routetypes/parser.go +++ b/internal/routetypes/parser.go @@ -16,8 +16,6 @@ import ( ) const ( - MAX_POLICIES = 128 - ICMP = 1 // Internet Control Message TCP = 6 // Transmission Control UDP = 17 // User Datagram @@ -25,10 +23,8 @@ const ( 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 ( @@ -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()