如何解决如何将我的远程PC的IP报告给我的Cpanel?
我目前正在芝加哥的朋友家中设置一台微型PC用作服务器。这台PC将连接到我朋友的常规ISP连接,而我将通过RDP连接到它。但是我不希望它具有静态IP,因此我需要每次更改设备时都知道其IP。我是一名全职Web开发人员,因此可以为此目的建立一个控制面板网站,但是我不知道将设备IP报告给cp网站的任何线索,我的意思是应该在哪种脚本或代码上运行我的远程PC报告它的IP,有什么想法吗?谢谢!
解决方法
您可以采用以下方法:
- 拥有一个公共网站,例如-
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)); } }
- 在上面的(1)中有您的小型服务器呼叫站点
-
recordminiserverip.xyz
中有一些代码like Shiv's Answer here,用于记录小型服务器的IP地址 -
recordminiserverip.xyz/save_ip.php
中有一些代码可以从您想要的任何PC /笔记本电脑中获取IP地址
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。