mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-30 18:35:44 +00:00
Compare commits
5 Commits
1.16.2-s.2
...
chain-id
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c6f0a68947 | ||
|
|
1aced4638d | ||
|
|
874c704a39 | ||
|
|
6d7a19b0a0 | ||
|
|
6b3a6fa380 |
@@ -146,7 +146,7 @@ export async function flushSiteBandwidthToDb(): Promise<void> {
|
|||||||
// support UPDATE … FROM (VALUES …), letting us update the whole chunk
|
// support UPDATE … FROM (VALUES …), letting us update the whole chunk
|
||||||
// in a single query instead of N individual round-trips.
|
// in a single query instead of N individual round-trips.
|
||||||
const valuesList = chunk.map(([publicKey, { bytesIn, bytesOut }]) =>
|
const valuesList = chunk.map(([publicKey, { bytesIn, bytesOut }]) =>
|
||||||
sql`(${publicKey}, ${bytesIn}, ${bytesOut})`
|
sql`(${publicKey}::text, ${bytesIn}::real, ${bytesOut}::real)`
|
||||||
);
|
);
|
||||||
const valuesClause = sql.join(valuesList, sql`, `);
|
const valuesClause = sql.join(valuesList, sql`, `);
|
||||||
|
|
||||||
|
|||||||
@@ -8,13 +8,6 @@ import { sendToExitNode } from "#dynamic/lib/exitNodes";
|
|||||||
import { buildClientConfigurationForNewtClient } from "./buildConfiguration";
|
import { buildClientConfigurationForNewtClient } from "./buildConfiguration";
|
||||||
import { canCompress } from "@server/lib/clientVersionChecks";
|
import { canCompress } from "@server/lib/clientVersionChecks";
|
||||||
|
|
||||||
const inputSchema = z.object({
|
|
||||||
publicKey: z.string(),
|
|
||||||
port: z.int().positive()
|
|
||||||
});
|
|
||||||
|
|
||||||
type Input = z.infer<typeof inputSchema>;
|
|
||||||
|
|
||||||
export const handleGetConfigMessage: MessageHandler = async (context) => {
|
export const handleGetConfigMessage: MessageHandler = async (context) => {
|
||||||
const { message, client, sendToClient } = context;
|
const { message, client, sendToClient } = context;
|
||||||
const newt = client as Newt;
|
const newt = client as Newt;
|
||||||
@@ -33,16 +26,7 @@ export const handleGetConfigMessage: MessageHandler = async (context) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const parsed = inputSchema.safeParse(message.data);
|
const { publicKey, port, chainId } = message.data;
|
||||||
if (!parsed.success) {
|
|
||||||
logger.error(
|
|
||||||
"handleGetConfigMessage: Invalid input: " +
|
|
||||||
fromError(parsed.error).toString()
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { publicKey, port } = message.data as Input;
|
|
||||||
const siteId = newt.siteId;
|
const siteId = newt.siteId;
|
||||||
|
|
||||||
// Get the current site data
|
// Get the current site data
|
||||||
@@ -133,7 +117,8 @@ export const handleGetConfigMessage: MessageHandler = async (context) => {
|
|||||||
data: {
|
data: {
|
||||||
ipAddress: site.address,
|
ipAddress: site.address,
|
||||||
peers,
|
peers,
|
||||||
targets
|
targets,
|
||||||
|
chainId: chainId
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export const handleNewtPingRequestMessage: MessageHandler = async (context) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { noCloud } = message.data;
|
const { noCloud, chainId } = message.data;
|
||||||
|
|
||||||
const exitNodesList = await listExitNodes(
|
const exitNodesList = await listExitNodes(
|
||||||
site.orgId,
|
site.orgId,
|
||||||
@@ -98,7 +98,8 @@ export const handleNewtPingRequestMessage: MessageHandler = async (context) => {
|
|||||||
message: {
|
message: {
|
||||||
type: "newt/ping/exitNodes",
|
type: "newt/ping/exitNodes",
|
||||||
data: {
|
data: {
|
||||||
exitNodes: filteredExitNodes
|
exitNodes: filteredExitNodes,
|
||||||
|
chainId: chainId
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
broadcast: false, // Send to all clients
|
broadcast: false, // Send to all clients
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export const handleNewtRegisterMessage: MessageHandler = async (context) => {
|
|||||||
|
|
||||||
const siteId = newt.siteId;
|
const siteId = newt.siteId;
|
||||||
|
|
||||||
const { publicKey, pingResults, newtVersion, backwardsCompatible } =
|
const { publicKey, pingResults, newtVersion, backwardsCompatible, chainId } =
|
||||||
message.data;
|
message.data;
|
||||||
if (!publicKey) {
|
if (!publicKey) {
|
||||||
logger.warn("Public key not provided");
|
logger.warn("Public key not provided");
|
||||||
@@ -211,7 +211,8 @@ export const handleNewtRegisterMessage: MessageHandler = async (context) => {
|
|||||||
udp: udpTargets,
|
udp: udpTargets,
|
||||||
tcp: tcpTargets
|
tcp: tcpTargets
|
||||||
},
|
},
|
||||||
healthCheckTargets: validHealthCheckTargets
|
healthCheckTargets: validHealthCheckTargets,
|
||||||
|
chainId: chainId
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
|
|||||||
@@ -41,7 +41,8 @@ export const handleOlmRegisterMessage: MessageHandler = async (context) => {
|
|||||||
orgId,
|
orgId,
|
||||||
userToken,
|
userToken,
|
||||||
fingerprint,
|
fingerprint,
|
||||||
postures
|
postures,
|
||||||
|
chainId
|
||||||
} = message.data;
|
} = message.data;
|
||||||
|
|
||||||
if (!olm.clientId) {
|
if (!olm.clientId) {
|
||||||
@@ -293,7 +294,8 @@ export const handleOlmRegisterMessage: MessageHandler = async (context) => {
|
|||||||
data: {
|
data: {
|
||||||
sites: siteConfigurations,
|
sites: siteConfigurations,
|
||||||
tunnelIP: client.subnet,
|
tunnelIP: client.subnet,
|
||||||
utilitySubnet: org.utilitySubnet
|
utilitySubnet: org.utilitySubnet,
|
||||||
|
chainId: chainId
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
|
|||||||
Reference in New Issue
Block a user