mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-05 10:16:41 +00:00
Pull up downstream changes
This commit is contained in:
@@ -20,10 +20,10 @@ export type PickSiteDefaultsResponse = {
|
||||
name: string;
|
||||
listenPort: number;
|
||||
endpoint: string;
|
||||
subnet: string;
|
||||
subnet: string; // TODO: make optional?
|
||||
newtId: string;
|
||||
newtSecret: string;
|
||||
clientAddress: string;
|
||||
clientAddress?: string;
|
||||
};
|
||||
|
||||
registry.registerPath({
|
||||
@@ -86,7 +86,7 @@ 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
|
||||
let subnets = sitesQuery.map((site) => site.subnet);
|
||||
let subnets = sitesQuery.map((site) => site.subnet).filter((subnet) => subnet !== null);
|
||||
// exclude the exit node address by replacing after the / with a site block size
|
||||
subnets.push(
|
||||
exitNode.address.replace(
|
||||
@@ -108,17 +108,17 @@ export async function pickSiteDefaults(
|
||||
);
|
||||
}
|
||||
|
||||
const newClientAddress = await getNextAvailableClientSubnet(orgId);
|
||||
if (!newClientAddress) {
|
||||
return next(
|
||||
createHttpError(
|
||||
HttpCode.INTERNAL_SERVER_ERROR,
|
||||
"No available subnet found"
|
||||
)
|
||||
);
|
||||
}
|
||||
// const newClientAddress = await getNextAvailableClientSubnet(orgId);
|
||||
// if (!newClientAddress) {
|
||||
// return next(
|
||||
// createHttpError(
|
||||
// HttpCode.INTERNAL_SERVER_ERROR,
|
||||
// "No available subnet found"
|
||||
// )
|
||||
// );
|
||||
// }
|
||||
|
||||
const clientAddress = newClientAddress.split("/")[0];
|
||||
// const clientAddress = newClientAddress.split("/")[0];
|
||||
|
||||
const newtId = generateId(15);
|
||||
const secret = generateId(48);
|
||||
@@ -133,7 +133,7 @@ export async function pickSiteDefaults(
|
||||
endpoint: exitNode.endpoint,
|
||||
// subnet: `${newSubnet.split("/")[0]}/${config.getRawConfig().gerbil.block_size}`, // we want the block size of the whole subnet
|
||||
subnet: newSubnet,
|
||||
clientAddress: clientAddress,
|
||||
// clientAddress: clientAddress,
|
||||
newtId,
|
||||
newtSecret: secret
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user