Skip to content

Commit 7075ade

Browse files
committed
add Hop Limit settings and update TTL management scripts
1 parent 749392c commit 7075ade

File tree

3 files changed

+251
-41
lines changed

3 files changed

+251
-41
lines changed

CHANGELOG.md

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
1-
# QuecManager BETA 2.3.8 Changelog
1+
# QuecManager BETA 2.3.9 Changelog
22

3-
1. Fixed profile dialog script which was caused by an incorrect expected uci entries
4-
2. Fixed memory storage card's localstorage logic
5-
3. Fixed home-traffic parsing for SA network mode
6-
4. Added force http to https settings
7-
5. Added minor UI changes for features' title and descriptions
8-
6. Changed speedtest puffer color to match the theme
9-
7. Added FPLMN Settings to help users clear forbidden network list
10-
8. Added QuecWatch's network refresh events to Network Insights
11-
9. Fixed Custom DNS disable functionality
12-
10. Added restore previous IMEI to IMEI settings
13-
11. Added auth-token checker
14-
12. Added Settings for Live Bandwidth to enable or disable it
15-
16-
Note: Using https is now recommended
3+
1. Added Ethernet Speed Limit
4+
2. Added dedicated init script for TTL
5+
3. Added Hop Limit settings

app/dashboard/advanced-settings/ttl-settings/page.tsx

Lines changed: 62 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { LockIcon } from "lucide-react";
1919
// Define interfaces for the API responses
2020
interface TTLData {
2121
currentValue: number;
22+
hlValue: number;
2223
isEnabled: boolean;
2324
success?: boolean;
2425
error?: string;
@@ -52,6 +53,8 @@ interface ProfilesResponse {
5253

5354
const TTLSettingsPage = () => {
5455
const [ttlValue, setTtlValue] = useState<string>("0");
56+
const [hlValue, setHlValue] = useState<string>("0");
57+
const [syncHl, setSyncHl] = useState<boolean>(true);
5558
const [ttlState, setTtlState] = useState<boolean>(false);
5659
const [loading, setLoading] = useState<boolean>(true);
5760
const [error, setError] = useState<string>("");
@@ -95,8 +98,14 @@ const TTLSettingsPage = () => {
9598
// Handle active profile with TTL
9699
let isControlled = false;
97100
let finalTtlValue = ttlData.currentValue.toString();
101+
let finalHlValue = ttlData.hlValue?.toString() || ttlData.currentValue.toString();
98102
let finalTtlState = ttlData.isEnabled;
99103

104+
// Check if TTL and HL are different
105+
if (finalTtlValue !== finalHlValue) {
106+
setSyncHl(false);
107+
}
108+
100109
// Check if there's an active profile with TTL settings
101110
if (
102111
profileData.status === "success" &&
@@ -124,13 +133,15 @@ const TTLSettingsPage = () => {
124133
setActiveProfile(active);
125134
isControlled = true;
126135
finalTtlValue = active.ttl;
136+
finalHlValue = active.ttl;
127137
finalTtlState = true;
128138
}
129139
}
130140
}
131141
}
132142

133143
setTtlValue(finalTtlValue);
144+
setHlValue(finalHlValue);
134145
setTtlState(finalTtlState);
135146
setIsProfileControlled(isControlled);
136147
} catch (err) {
@@ -157,16 +168,17 @@ const TTLSettingsPage = () => {
157168
setError("");
158169
setSuccess("");
159170

160-
// Only send TTL value if state is enabled
161-
const valueToSend = ttlState ? ttlValue : "0";
171+
// Only send values if state is enabled
172+
const ttlToSend = ttlState ? ttlValue : "0";
173+
const hlToSend = ttlState ? (syncHl ? ttlValue : hlValue) : "0";
162174

163175
try {
164176
const response = await fetch("/cgi-bin/quecmanager/advance/ttl.sh", {
165177
method: "POST",
166178
headers: {
167179
"Content-Type": "application/x-www-form-urlencoded",
168180
},
169-
body: `ttl=${valueToSend}`,
181+
body: `ttl=${ttlToSend}&hl=${hlToSend}`,
170182
});
171183

172184
if (!response.ok) {
@@ -223,26 +235,68 @@ const TTLSettingsPage = () => {
223235
<form onSubmit={handleSubmit} className="space-y-8">
224236
<div className="space-y-6">
225237
<div>
226-
<label className="text-sm font-medium">TTL Value</label>
238+
<label className="text-sm font-medium">TTL Value (IPv4)</label>
227239
<Input
228240
type="number"
229241
min="0"
230242
max="255"
231243
value={ttlValue}
232-
onChange={(e) => setTtlValue(e.target.value)}
244+
onChange={(e) => {
245+
setTtlValue(e.target.value);
246+
if (syncHl) {
247+
setHlValue(e.target.value);
248+
}
249+
}}
233250
disabled={!ttlState || isProfileControlled || loading}
234251
className="mt-1"
235252
/>
236253
<p className="text-sm text-gray-500 mt-1">
237-
Set the TTL value for your connection (0-255).
254+
Set the TTL value for IPv4 packets (0-255).
238255
</p>
239256
</div>
240257

241258
<div className="flex items-center justify-between rounded-lg border p-4">
242259
<div>
243-
<label className="text-base font-medium">TTL State</label>
260+
<label className="text-base font-medium">Sync HL with TTL</label>
261+
<p className="text-sm text-gray-500">
262+
Use the same value for both IPv4 (TTL) and IPv6 (HL)
263+
</p>
264+
</div>
265+
<Switch
266+
checked={syncHl}
267+
onCheckedChange={(checked) => {
268+
setSyncHl(checked);
269+
if (checked) {
270+
setHlValue(ttlValue);
271+
}
272+
}}
273+
disabled={!ttlState || isProfileControlled || loading}
274+
/>
275+
</div>
276+
277+
{!syncHl && (
278+
<div>
279+
<label className="text-sm font-medium">HL Value (IPv6)</label>
280+
<Input
281+
type="number"
282+
min="0"
283+
max="255"
284+
value={hlValue}
285+
onChange={(e) => setHlValue(e.target.value)}
286+
disabled={!ttlState || isProfileControlled || loading}
287+
className="mt-1"
288+
/>
289+
<p className="text-sm text-gray-500 mt-1">
290+
Set the Hop Limit value for IPv6 packets (0-255).
291+
</p>
292+
</div>
293+
)}
294+
295+
<div className="flex items-center justify-between rounded-lg border p-4">
296+
<div>
297+
<label className="text-base font-medium">TTL/HL State</label>
244298
<p className="text-sm text-gray-500">
245-
Toggle to enable or disable TTL mangling
299+
Toggle to enable or disable TTL/HL mangling
246300
</p>
247301
</div>
248302
<Switch

0 commit comments

Comments
 (0)