From 39a776a39a53aebc4bf8d5f82112cf68c1ff9d08 Mon Sep 17 00:00:00 2001
From: echicken <echicken@bbs.electronicchicken.com>
Date: Wed, 22 Feb 2023 19:13:30 +0000
Subject: [PATCH] Use client.ip_address instead of user.ip_address; check if
 protocol is Telnet or SSH

---
 xtrn/wttr.in/locator.js | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xtrn/wttr.in/locator.js b/xtrn/wttr.in/locator.js
index ffaa4a3ff7..0390fe0e82 100644
--- a/xtrn/wttr.in/locator.js
+++ b/xtrn/wttr.in/locator.js
@@ -82,11 +82,11 @@ function wsrsGetIPAddress() {
 }
 
 function getAddress() {
-	log(LOG_DEBUG, 'user.ip_address is ' + user.ip_address);
+	log(LOG_DEBUG, 'client.ip_address is ' + client.ip_address);
 	const addrRe = /(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^169\.254\.)|(^::1$)|(^[fF][cCdD])/;
-	if (user.ip_address.search(addrRe) > -1) {
+	if (client.ip_address.search(addrRe) > -1) {
 		var addr;
-		if (client.protocol === 'Telnet') {
+		if (client.protocol === 'Telnet' || client.protocol === 'SSH') {
 			log(LOG_DEBUG, 'Trying wsts method');
 			addr = wstsGetIPAddress();
 			log(LOG_DEBUG, 'wsts result: ' + addr);
@@ -99,8 +99,8 @@ function getAddress() {
 		log(LOG_DEBUG, 'returning: ' + addr);
 		return addr;
 	}
-	log(LOG_DEBUG, 'returning: ' + user.ip_address);
-	return user.ip_address;
+	log(LOG_DEBUG, 'returning: ' + client.ip_address);
+	return client.ip_address;
 }
 
 this;
\ No newline at end of file
-- 
GitLab