Fix subnet issues

This commit is contained in:
Owen 2025-02-24 20:21:57 -05:00
parent 8ee6a3f134
commit 733e0e07c3
No known key found for this signature in database
GPG key ID: 8271FDFFD9E0CCBD
4 changed files with 8 additions and 4 deletions

View file

@ -130,7 +130,8 @@ export async function pickClientDefaults(
name: site.name, name: site.name,
listenPort: listenPort, listenPort: listenPort,
endpoint: endpoint, endpoint: endpoint,
subnet: `${newSubnet.split("/")[0]}/${config.getRawConfig().newt.block_size}`, // we want the block size of the whole subnet // subnet: `${newSubnet.split("/")[0]}/${config.getRawConfig().newt.block_size}`, // we want the block size of the whole subnet
subnet: newSubnet,
olmId: olmId, olmId: olmId,
olmSecret: secret olmSecret: secret
}, },

View file

@ -46,7 +46,9 @@ export async function getAllRelays(
const sitesRes = await db.select().from(sites).where(eq(sites.exitNodeId, exitNode.exitNodeId)); const sitesRes = await db.select().from(sites).where(eq(sites.exitNodeId, exitNode.exitNodeId));
if (sitesRes.length === 0) { if (sitesRes.length === 0) {
return next(createHttpError(HttpCode.NOT_FOUND, "No sites found for this exit node")); return {
mappings: {}
}
} }
// get the clients on each site and map them to the site // get the clients on each site and map them to the site

View file

@ -105,7 +105,7 @@ export const handleOlmRegisterMessage: MessageHandler = async (context) => {
endpoint: site.endpoint, endpoint: site.endpoint,
publicKey: site.publicKey, publicKey: site.publicKey,
serverIP: site.address!.split("/")[0], serverIP: site.address!.split("/")[0],
tunnelIP: client.subnet tunnelIP: `${client.subnet.split("/")[0]}/${site.address!.split("/")[1]}`, // put the client ip in the same subnet as the site. TODO: Is this right? Maybe we need th make .subnet work properly!
} }
}, },
broadcast: false, // Send to all olms broadcast: false, // Send to all olms

View file

@ -84,7 +84,8 @@ export async function pickSiteDefaults(
name: exitNode.name, name: exitNode.name,
listenPort: exitNode.listenPort, listenPort: exitNode.listenPort,
endpoint: exitNode.endpoint, endpoint: exitNode.endpoint,
subnet: `${newSubnet.split("/")[0]}/${config.getRawConfig().gerbil.block_size}`, // we want the block size of the whole subnet // subnet: `${newSubnet.split("/")[0]}/${config.getRawConfig().gerbil.block_size}`, // we want the block size of the whole subnet
subnet: newSubnet,
newtId, newtId,
newtSecret: secret newtSecret: secret
}, },