Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- log("location v-param");
- let ip = null;
- let igd = declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANIPConnection.*.ExternalIPAddress", {value: 1});
- let result = "UNKNOWN";
- if (igd.size) {
- for (let p of igd) {
- if (p.value[0] && p.value[0] !== '0.0.0.0') {
- ip = p.value[0];
- break;
- }
- }
- }
- if (ip !== null) {
- let firstTwo = ip.match(/(\\d+\\.\\d+)/)[0];
- let map = {
- '172.16': 'Tok',
- '172.17': 'Haines',
- '172.18': 'Wrangell',
- '172.19': 'Petersburg',
- '172.21': 'Craig',
- '172.22': 'Metlakatla',
- '172.27': 'Wasilla'
- };
- declare("VirtualParameters.Location", null, {value: map[firstTwo]});
- if (map[firstTwo]) {
- result = map[firstTwo];
- }
- }
- log("Location: " + result);
- return {writable: false, value: [result, "xsd:string"]};
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement