+
diff --git a/ostp-gui/src/main.js b/ostp-gui/src/main.js
index b0182b5..2c4eba7 100644
--- a/ostp-gui/src/main.js
+++ b/ostp-gui/src/main.js
@@ -29,6 +29,8 @@ const serverBadgeTxt = $('server-badge-text');
const metricDown = $('metric-down');
const metricUp = $('metric-up');
const metricMode = $('metric-mode');
+const metricPing = $('metric-ping');
+const pingIconBlock = $('ping-icon-block');
const toast = $('toast');
const btnGoSettings = $('btn-go-settings');
@@ -159,11 +161,29 @@ async function poll() {
if (metrics) {
metricDown.textContent = fmtBytes(metrics.bytes_recv);
metricUp.textContent = fmtBytes(metrics.bytes_sent);
-
+
const isTun = rawConfig?.tun?.enable;
- const modeStr = isTun ? 'TUN' : 'SOCKS5';
- const pingStr = metrics.rtt_ms > 0 ? ` (${metrics.rtt_ms} ms)` : '';
- metricMode.textContent = modeStr + pingStr;
+ metricMode.textContent = isTun ? 'TUN' : 'SOCKS5';
+
+ const rtt = metrics.rtt_ms || 0;
+ if (rtt > 0) {
+ metricPing.textContent = rtt + ' ms';
+ // Color code: green < 80ms, yellow < 200ms, red >= 200ms
+ if (rtt < 80) {
+ metricPing.style.color = 'var(--ping-good, #4ade80)';
+ pingIconBlock.style.color = 'var(--ping-good, #4ade80)';
+ } else if (rtt < 200) {
+ metricPing.style.color = 'var(--ping-mid, #facc15)';
+ pingIconBlock.style.color = 'var(--ping-mid, #facc15)';
+ } else {
+ metricPing.style.color = 'var(--ping-bad, #f87171)';
+ pingIconBlock.style.color = 'var(--ping-bad, #f87171)';
+ }
+ } else {
+ metricPing.textContent = '— ms';
+ metricPing.style.color = '';
+ pingIconBlock.style.color = '';
+ }
}
} catch {
setState('disconnected');
diff --git a/test.json b/test.json
new file mode 100644
index 0000000..cab5795
--- /dev/null
+++ b/test.json
@@ -0,0 +1,56 @@
+{
+ // OSTP Server Configuration
+ "mode": "server",
+ "log_level": "info",
+
+ // The address and port the server listens on for incoming OSTP connections.
+ "listen": "0.0.0.0:50000",
+
+ // List of valid keys. Clients must use one of these to connect.
+ "access_keys": [
+ "07702b35e2062ac40eb4e46a7708dbf6"
+ ],
+
+ // Optional proxy for outbound traffic.
+ "outbound": {
+ "enabled": false,
+ "protocol": "socks5",
+ "address": "127.0.0.1",
+ "port": 9050,
+ // default_action: 'proxy' (all through proxy) or 'direct' (bypass proxy by default).
+ "default_action": "proxy",
+ "rules": [
+ {
+ "domain_suffix": [".onion"],
+ "action": "proxy"
+ }
+ ]
+ },
+
+ // Management REST API for third-party panels.
+ "api": {
+ "enabled": false,
+ "bind": "127.0.0.1:9090",
+ // Set a strong token for authentication. Leave empty to disable auth.
+ "token": ""
+ },
+
+ // Fallback TCP proxy: unrecognized connections are proxied to a web server (anti-DPI).
+ "fallback": {
+ "enabled": false,
+ "listen": "0.0.0.0:443",
+ // Target web server (e.g., local nginx or caddy)
+ "target": "127.0.0.1:8080"
+ },
+
+ // Reality (XTLS) / UoT Masquerade parameters
+ "reality": {
+ "enabled": false,
+ "dest": "www.microsoft.com:443",
+ "private_key": "",
+ "pbk": "",
+ "sid": "",
+ "sni_list": ["www.microsoft.com"]
+ },
+ "debug": false
+}
\ No newline at end of file
diff --git a/test2.json b/test2.json
new file mode 100644
index 0000000..db5075d
--- /dev/null
+++ b/test2.json
@@ -0,0 +1,56 @@
+{
+ // OSTP Server Configuration
+ "mode": "server",
+ "log_level": "info",
+
+ // The address and port the server listens on for incoming OSTP connections.
+ "listen": "0.0.0.0:50000",
+
+ // List of valid keys. Clients must use one of these to connect.
+ "access_keys": [
+ "faa4ed2bb00f5df012f5708d86f9541c"
+ ],
+
+ // Optional proxy for outbound traffic.
+ "outbound": {
+ "enabled": false,
+ "protocol": "socks5",
+ "address": "127.0.0.1",
+ "port": 9050,
+ // default_action: 'proxy' (all through proxy) or 'direct' (bypass proxy by default).
+ "default_action": "proxy",
+ "rules": [
+ {
+ "domain_suffix": [".onion"],
+ "action": "proxy"
+ }
+ ]
+ },
+
+ // Management REST API for third-party panels.
+ "api": {
+ "enabled": false,
+ "bind": "127.0.0.1:9090",
+ // Set a strong token for authentication. Leave empty to disable auth.
+ "token": ""
+ },
+
+ // Fallback TCP proxy: unrecognized connections are proxied to a web server (anti-DPI).
+ "fallback": {
+ "enabled": false,
+ "listen": "0.0.0.0:443",
+ // Target web server (e.g., local nginx or caddy)
+ "target": "127.0.0.1:8080"
+ },
+
+ // Reality (XTLS) / UoT Masquerade parameters
+ "reality": {
+ "enabled": false,
+ "dest": "www.microsoft.com:443",
+ "private_key": "lAapk0V5dG1xSD3CWZ0Ac3c_GKbJU0hVsRjiQ6VrCEY",
+ "pbk": "Md5jDEfpPmaMW5ggNSL7jA0LZi4eKsyfgMwseFQ0TyQ",
+ "sid": "db806ac3c8bf9417",
+ "sni_list": ["www.microsoft.com"]
+ },
+ "debug": false
+}
\ No newline at end of file