mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-25 06:16:40 +00:00
Update formatting to work with ipv6
This commit is contained in:
@@ -33,6 +33,8 @@ import {
|
||||
generateAliasConfig,
|
||||
generateRemoteSubnets,
|
||||
generateSubnetProxyTargets,
|
||||
parseEndpoint,
|
||||
formatEndpoint
|
||||
} from "@server/lib/ip";
|
||||
import {
|
||||
addPeerData,
|
||||
@@ -541,6 +543,13 @@ export async function updateClientSiteDestinations(
|
||||
continue;
|
||||
}
|
||||
|
||||
// Parse the endpoint properly for both IPv4 and IPv6
|
||||
const parsedEndpoint = parseEndpoint(site.clientSitesAssociationsCache.endpoint);
|
||||
if (!parsedEndpoint) {
|
||||
logger.warn(`Failed to parse endpoint ${site.clientSitesAssociationsCache.endpoint}, skipping`);
|
||||
continue;
|
||||
}
|
||||
|
||||
// find the destinations in the array
|
||||
let destinations = exitNodeDestinations.find(
|
||||
(d) => d.reachableAt === site.exitNodes?.reachableAt
|
||||
@@ -552,13 +561,8 @@ export async function updateClientSiteDestinations(
|
||||
exitNodeId: site.exitNodes?.exitNodeId || 0,
|
||||
type: site.exitNodes?.type || "",
|
||||
name: site.exitNodes?.name || "",
|
||||
sourceIp:
|
||||
site.clientSitesAssociationsCache.endpoint.split(":")[0] ||
|
||||
"",
|
||||
sourcePort:
|
||||
parseInt(
|
||||
site.clientSitesAssociationsCache.endpoint.split(":")[1]
|
||||
) || 0,
|
||||
sourceIp: parsedEndpoint.ip,
|
||||
sourcePort: parsedEndpoint.port,
|
||||
destinations: [
|
||||
{
|
||||
destinationIP: site.sites.subnet.split("/")[0],
|
||||
|
||||
Reference in New Issue
Block a user