refåctor: remove files

This commit is contained in:
Mauricio Siu
2024-12-14 23:06:54 -06:00
parent fc2b0abdb1
commit c6e512bec1
8 changed files with 24 additions and 595 deletions
+23
View File
@@ -1,4 +1,5 @@
import os from "node:os";
import { publicIpv4, publicIpv6 } from "public-ip";
export const getShell = () => {
switch (os.platform()) {
@@ -10,3 +11,25 @@ export const getShell = () => {
return "bash";
}
};
export const getPublicIpWithFallback = async () => {
// @ts-ignore
let ip = null;
try {
ip = await publicIpv4();
} catch (error) {
console.log(
"Error to obtain public IPv4 address, falling back to IPv6",
// @ts-ignore
error.message,
);
try {
ip = await publicIpv6();
} catch (error) {
// @ts-ignore
console.error("Error to obtain public IPv6 address", error.message);
ip = null;
}
}
return ip;
};