mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-03 17:44:44 +02:00
Test & fix the get defaults for sites
This commit is contained in:
parent
7feb21e727
commit
edcae190b2
3 changed files with 8 additions and 5 deletions
|
@ -66,8 +66,10 @@ export async function pickSiteDefaults(
|
|||
.where(eq(sites.exitNodeId, exitNode.exitNodeId));
|
||||
|
||||
// TODO: we need to lock this subnet for some time so someone else does not take it
|
||||
const subnets = sitesQuery.map((site) => site.subnet);
|
||||
const newSubnet = findNextAvailableCidr(subnets, 28, exitNode.address);
|
||||
let subnets = sitesQuery.map((site) => site.subnet);
|
||||
// exclude the exit node address by replacing after the / with a /28
|
||||
subnets.push(exitNode.address.replace(/\/\d+$/, "/29"));
|
||||
const newSubnet = findNextAvailableCidr(subnets, 29, exitNode.address);
|
||||
if (!newSubnet) {
|
||||
return next(
|
||||
createHttpError(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue