mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-22 21:06:37 +00:00
Format
This commit is contained in:
@@ -120,11 +120,13 @@ function bigIntToIp(num: bigint, version: IPVersion): string {
|
|||||||
* Parses an endpoint string (ip:port) handling both IPv4 and IPv6 addresses.
|
* Parses an endpoint string (ip:port) handling both IPv4 and IPv6 addresses.
|
||||||
* IPv6 addresses may be bracketed like [::1]:8080 or unbracketed like ::1:8080.
|
* IPv6 addresses may be bracketed like [::1]:8080 or unbracketed like ::1:8080.
|
||||||
* For unbracketed IPv6, the last colon-separated segment is treated as the port.
|
* For unbracketed IPv6, the last colon-separated segment is treated as the port.
|
||||||
*
|
*
|
||||||
* @param endpoint The endpoint string to parse (e.g., "192.168.1.1:8080" or "[::1]:8080" or "2607:fea8::1:8080")
|
* @param endpoint The endpoint string to parse (e.g., "192.168.1.1:8080" or "[::1]:8080" or "2607:fea8::1:8080")
|
||||||
* @returns An object with ip and port, or null if parsing fails
|
* @returns An object with ip and port, or null if parsing fails
|
||||||
*/
|
*/
|
||||||
export function parseEndpoint(endpoint: string): { ip: string; port: number } | null {
|
export function parseEndpoint(
|
||||||
|
endpoint: string
|
||||||
|
): { ip: string; port: number } | null {
|
||||||
if (!endpoint) return null;
|
if (!endpoint) return null;
|
||||||
|
|
||||||
// Check for bracketed IPv6 format: [ip]:port
|
// Check for bracketed IPv6 format: [ip]:port
|
||||||
@@ -138,7 +140,7 @@ export function parseEndpoint(endpoint: string): { ip: string; port: number } |
|
|||||||
|
|
||||||
// Check if this looks like IPv6 (contains multiple colons)
|
// Check if this looks like IPv6 (contains multiple colons)
|
||||||
const colonCount = (endpoint.match(/:/g) || []).length;
|
const colonCount = (endpoint.match(/:/g) || []).length;
|
||||||
|
|
||||||
if (colonCount > 1) {
|
if (colonCount > 1) {
|
||||||
// This is IPv6 - the port is after the last colon
|
// This is IPv6 - the port is after the last colon
|
||||||
const lastColonIndex = endpoint.lastIndexOf(":");
|
const lastColonIndex = endpoint.lastIndexOf(":");
|
||||||
@@ -163,7 +165,7 @@ export function parseEndpoint(endpoint: string): { ip: string; port: number } |
|
|||||||
/**
|
/**
|
||||||
* Formats an IP and port into a consistent endpoint string.
|
* Formats an IP and port into a consistent endpoint string.
|
||||||
* IPv6 addresses are wrapped in brackets for proper parsing.
|
* IPv6 addresses are wrapped in brackets for proper parsing.
|
||||||
*
|
*
|
||||||
* @param ip The IP address (IPv4 or IPv6)
|
* @param ip The IP address (IPv4 or IPv6)
|
||||||
* @param port The port number
|
* @param port The port number
|
||||||
* @returns Formatted endpoint string
|
* @returns Formatted endpoint string
|
||||||
|
|||||||
@@ -84,14 +84,11 @@ LQIDAQAB
|
|||||||
-----END PUBLIC KEY-----`;
|
-----END PUBLIC KEY-----`;
|
||||||
|
|
||||||
constructor(private hostMeta: HostMeta) {
|
constructor(private hostMeta: HostMeta) {
|
||||||
setInterval(
|
setInterval(async () => {
|
||||||
async () => {
|
this.doRecheck = true;
|
||||||
this.doRecheck = true;
|
await this.check();
|
||||||
await this.check();
|
this.doRecheck = false;
|
||||||
this.doRecheck = false;
|
}, 1000 * this.phoneHomeInterval);
|
||||||
},
|
|
||||||
1000 * this.phoneHomeInterval
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public listKeys(): LicenseKeyCache[] {
|
public listKeys(): LicenseKeyCache[] {
|
||||||
@@ -242,7 +239,9 @@ LQIDAQAB
|
|||||||
// First failure: fail silently
|
// First failure: fail silently
|
||||||
logger.error("Error communicating with license server:");
|
logger.error("Error communicating with license server:");
|
||||||
logger.error(e);
|
logger.error(e);
|
||||||
logger.error(`Allowing failure. Will retry one more time at next run interval.`);
|
logger.error(
|
||||||
|
`Allowing failure. Will retry one more time at next run interval.`
|
||||||
|
);
|
||||||
// return last known good status
|
// return last known good status
|
||||||
return this.statusCache.get(
|
return this.statusCache.get(
|
||||||
this.statusKey
|
this.statusKey
|
||||||
|
|||||||
@@ -177,7 +177,13 @@ const CredenzaFooter = ({ className, children, ...props }: CredenzaProps) => {
|
|||||||
const CredenzaFooter = isDesktop ? DialogFooter : SheetFooter;
|
const CredenzaFooter = isDesktop ? DialogFooter : SheetFooter;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CredenzaFooter className={cn("mt-8 md:mt-0 -mx-6 px-6 pt-6 border-t border-border", className)} {...props}>
|
<CredenzaFooter
|
||||||
|
className={cn(
|
||||||
|
"mt-8 md:mt-0 -mx-6 px-6 pt-6 border-t border-border",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
{children}
|
{children}
|
||||||
</CredenzaFooter>
|
</CredenzaFooter>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user