如何将我的远程PC的IP报告给我的Cpanel?

问题描述

我目前正在芝加哥的朋友家中设置一台微型PC用作服务器。这台PC将连接到我朋友的常规ISP连接,而我将通过RDP连接到它。但是我不希望它具有静态IP,因此我需要每次更改设备时都知道其IP。我是一名全职Web开发人员,因此可以为此目的建立一个控制面板网站,但是我不知道将设备IP报告给cp网站的任何线索,我的意思是应该在哪种脚本或代码上运行我的远程PC报告它的IP,有什么想法吗?谢谢!

解决方法

您可以采用以下方法:

  1. 拥有一个公共网站,例如-async function onConnect() { try { console.log('Requesting any Bluetooth Device...'); const device = await navigator.bluetooth.requestDevice({ acceptAllDevices: true,optionalServices: ['generic_access'] }); console.log('Connecting to GATT Server...'); const server = await device.gatt.connect(); console.log('Getting Service...'); const service = await server.getPrimaryService('generic_access'); console.log('Getting Characteristics...'); const characteristics = await service.getCharacteristics(); for (const characteristic of characteristics) { switch (characteristic.uuid) { // characteristic.uuid case '00002a00-0000-1000-8000-00805f9b34fb': // device name await readValue1(characteristic); break; case '00002a01-0000-1000-8000-00805f9b34fb': // Appearance await readAppearanceValue2(characteristic); break; case '00002a04-0000-1000-8000-00805f9b34fb': // Manufacturer Name String await readValue3(characteristic); break; case '00002aa6-0000-1000-8000-00805f9b34fb': await readValue4(characteristic); // Central Address Resolution break; default: console.log('Unknown Characteristic: ' + characteristic.uuid); } } } catch (error) { console.log(error) } async function readValue1(characteristic) { const value = await characteristic.readValue(); $('#dataset1').text(new TextDecoder().decode(value)); console.log(new TextDecoder().decode(value)); } async function readAppearanceValue2(characteristic) { const value = await characteristic.readValue(); $('#dataset2').text(new TextDecoder().decode(value)); console.log(new TextDecoder().decode(value)); } async function readValue3(characteristic) { const value = await characteristic.readValue(); $('#dataset3').text(new TextDecoder().decode(value)); console.log(new TextDecoder().decode(value)); } async function readValue4(characteristic) { const value = await characteristic.readValue(); $('#dataset4').text(new TextDecoder().decode(value)); console.log(new TextDecoder().decode(value)); } }
  2. 在上面的(1)中有您的小型服务器呼叫站点
  3. recordminiserverip.xyz中有一些代码like Shiv's Answer here,用于记录小型服务器的IP地址
  4. recordminiserverip.xyz/save_ip.php中有一些代码可以从您想要的任何PC /笔记本电脑中获取IP地址