mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-11 13:16:38 +00:00
Merge branch 'hp-multi-client' into auth-providers-clients
This commit is contained in:
@@ -54,13 +54,17 @@ export const handleGetConfigMessage: MessageHandler = async (context) => {
|
|||||||
logger.warn("handleGetConfigMessage: Site not found");
|
logger.warn("handleGetConfigMessage: Site not found");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// todo check if the public key has changed
|
|
||||||
// we need to wait for hole punch success
|
// we need to wait for hole punch success
|
||||||
if (!existingSite.endpoint) {
|
if (!existingSite.endpoint) {
|
||||||
logger.warn(`Site ${existingSite.siteId} has no endpoint, skipping`);
|
logger.warn(`Site ${existingSite.siteId} has no endpoint, skipping`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (existingSite.publicKey !== publicKey) {
|
||||||
|
// TODO: somehow we should make sure a recent hole punch has happened if this occurs (hole punch could be from the last restart if done quickly)
|
||||||
|
}
|
||||||
|
|
||||||
if (existingSite.lastHolePunch && now - existingSite.lastHolePunch > 6) {
|
if (existingSite.lastHolePunch && now - existingSite.lastHolePunch > 6) {
|
||||||
logger.warn(
|
logger.warn(
|
||||||
`Site ${existingSite.siteId} last hole punch is too old, skipping`
|
`Site ${existingSite.siteId} last hole punch is too old, skipping`
|
||||||
@@ -129,7 +133,7 @@ export const handleGetConfigMessage: MessageHandler = async (context) => {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
publicKey: client.clients.pubKey!,
|
publicKey: client.clients.pubKey!,
|
||||||
allowedIps: [client.clients.subnet!],
|
allowedIps: [`${client.clients.subnet.split('/')[0]}/32`], // we want to only allow from that client
|
||||||
endpoint: client.clientSites.isRelayed
|
endpoint: client.clientSites.isRelayed
|
||||||
? ""
|
? ""
|
||||||
: client.clients.endpoint! // if its relayed it should be localhost
|
: client.clients.endpoint! // if its relayed it should be localhost
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ export const handleOlmRegisterMessage: MessageHandler = async (context) => {
|
|||||||
);
|
);
|
||||||
await addPeer(site.siteId, {
|
await addPeer(site.siteId, {
|
||||||
publicKey: publicKey,
|
publicKey: publicKey,
|
||||||
allowedIps: [client.subnet],
|
allowedIps: [`${client.subnet.split('/')[0]}/32`], // we want to only allow from that client
|
||||||
endpoint: client.endpoint
|
endpoint: client.endpoint
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user