mirror of https://github.com/ospab/ostp.git
feat: add transport and mtu fields to gui
This commit is contained in:
parent
f55769bae0
commit
a5a0a17cfd
|
|
@ -182,6 +182,19 @@
|
|||
<input id="in-dns" class="field-input" type="text" placeholder="1.1.1.1" />
|
||||
</div>
|
||||
|
||||
<div class="field-group">
|
||||
<label class="field-label" for="in-transport" data-i18n="label_transport">Transport Protocol</label>
|
||||
<select id="in-transport" class="field-input">
|
||||
<option value="udp">UDP (Default)</option>
|
||||
<option value="uot">TCP (UoT)</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="field-group">
|
||||
<label class="field-label" for="in-mtu" data-i18n="label_mtu">MTU Size</label>
|
||||
<input id="in-mtu" class="field-input" type="number" placeholder="1350" />
|
||||
</div>
|
||||
|
||||
<!-- Toggles -->
|
||||
<div class="toggle-row">
|
||||
<div class="toggle-text">
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@ const inServer = $('in-server');
|
|||
const inKey = $('in-key');
|
||||
const inSocks = $('in-socks');
|
||||
const inDns = $('in-dns');
|
||||
const inTransport = $('in-transport');
|
||||
const inMtu = $('in-mtu');
|
||||
const inTun = $('in-tun-mode');
|
||||
const inDebug = $('in-debug');
|
||||
const inDomains = $('in-ex-domains');
|
||||
|
|
@ -222,6 +224,8 @@ async function loadConfigIntoForm() {
|
|||
inServer.value = c.server || '';
|
||||
inKey.value = c.access_key || '';
|
||||
inSocks.value = c.socks5_bind || '127.0.0.1:1088';
|
||||
inTransport.value = c.transport?.mode || 'udp';
|
||||
inMtu.value = c.mtu || '';
|
||||
inTun.checked = !!c.tun?.enable;
|
||||
inDns.value = c.tun?.dns || '';
|
||||
inDebug.checked = !!c.debug;
|
||||
|
|
@ -251,6 +255,13 @@ async function handleSave() {
|
|||
rawConfig.socks5_bind = inSocks.value.trim() || null;
|
||||
rawConfig.debug = inDebug.checked;
|
||||
|
||||
rawConfig.transport = rawConfig.transport || {};
|
||||
rawConfig.transport.mode = inTransport.value;
|
||||
|
||||
const mtuStr = inMtu.value.trim();
|
||||
if (mtuStr) rawConfig.mtu = parseInt(mtuStr, 10);
|
||||
else delete rawConfig.mtu;
|
||||
|
||||
if (!rawConfig.tun) {
|
||||
rawConfig.tun = { wintun_path: './wintun.dll', ipv4_address: '10.1.0.2/24' };
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue