mirror of https://github.com/ospab/ostp.git
Update flutter and gui apps to support XTLS-Reality and UoT config parameters
This commit is contained in:
parent
7a9c32969c
commit
270cd91d71
|
|
@ -190,6 +190,21 @@
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="field-group">
|
||||||
|
<label class="field-label" for="in-stealth-sni" data-i18n="label_sni">Stealth SNI</label>
|
||||||
|
<input id="in-stealth-sni" class="field-input" type="text" placeholder="www.microsoft.com" spellcheck="false" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field-group">
|
||||||
|
<label class="field-label" for="in-pbk" data-i18n="label_pbk">Reality PublicKey (pbk)</label>
|
||||||
|
<input id="in-pbk" class="field-input" type="text" placeholder="Leave empty to disable Reality" spellcheck="false" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field-group">
|
||||||
|
<label class="field-label" for="in-sid" data-i18n="label_sid">Reality ShortId (sid)</label>
|
||||||
|
<input id="in-sid" class="field-input" type="text" placeholder="Optional" spellcheck="false" />
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="field-group">
|
<div class="field-group">
|
||||||
<label class="field-label" for="in-mtu" data-i18n="label_mtu">MTU Size</label>
|
<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" />
|
<input id="in-mtu" class="field-input" type="number" placeholder="1350" />
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,9 @@ const inKey = $('in-key');
|
||||||
const inSocks = $('in-socks');
|
const inSocks = $('in-socks');
|
||||||
const inDns = $('in-dns');
|
const inDns = $('in-dns');
|
||||||
const inTransport = $('in-transport');
|
const inTransport = $('in-transport');
|
||||||
|
const inSni = $('in-stealth-sni');
|
||||||
|
const inPbk = $('in-pbk');
|
||||||
|
const inSid = $('in-sid');
|
||||||
const inMtu = $('in-mtu');
|
const inMtu = $('in-mtu');
|
||||||
const inTun = $('in-tun-mode');
|
const inTun = $('in-tun-mode');
|
||||||
const inDebug = $('in-debug');
|
const inDebug = $('in-debug');
|
||||||
|
|
@ -225,6 +228,9 @@ async function loadConfigIntoForm() {
|
||||||
inKey.value = c.access_key || '';
|
inKey.value = c.access_key || '';
|
||||||
inSocks.value = c.socks5_bind || '127.0.0.1:1088';
|
inSocks.value = c.socks5_bind || '127.0.0.1:1088';
|
||||||
inTransport.value = c.transport?.mode || 'udp';
|
inTransport.value = c.transport?.mode || 'udp';
|
||||||
|
inSni.value = c.transport?.stealth_sni || '';
|
||||||
|
inPbk.value = c.reality?.pbk || '';
|
||||||
|
inSid.value = c.reality?.sid || '';
|
||||||
inMtu.value = c.mtu || '';
|
inMtu.value = c.mtu || '';
|
||||||
inTun.checked = !!c.tun?.enable;
|
inTun.checked = !!c.tun?.enable;
|
||||||
inDns.value = c.tun?.dns || '';
|
inDns.value = c.tun?.dns || '';
|
||||||
|
|
@ -257,6 +263,21 @@ async function handleSave() {
|
||||||
|
|
||||||
rawConfig.transport = rawConfig.transport || {};
|
rawConfig.transport = rawConfig.transport || {};
|
||||||
rawConfig.transport.mode = inTransport.value;
|
rawConfig.transport.mode = inTransport.value;
|
||||||
|
rawConfig.transport.stealth_sni = inSni.value.trim() || undefined;
|
||||||
|
|
||||||
|
const pbk = inPbk.value.trim();
|
||||||
|
if (pbk) {
|
||||||
|
rawConfig.reality = {
|
||||||
|
enabled: true,
|
||||||
|
dest: '',
|
||||||
|
private_key: '',
|
||||||
|
pbk: pbk,
|
||||||
|
sid: inSid.value.trim(),
|
||||||
|
sni_list: []
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
delete rawConfig.reality;
|
||||||
|
}
|
||||||
|
|
||||||
const mtuStr = inMtu.value.trim();
|
const mtuStr = inMtu.value.trim();
|
||||||
if (mtuStr) rawConfig.mtu = parseInt(mtuStr, 10);
|
if (mtuStr) rawConfig.mtu = parseInt(mtuStr, 10);
|
||||||
|
|
@ -299,6 +320,14 @@ function handleImport() {
|
||||||
if (!key || !host) throw new Error('Incomplete link parameters');
|
if (!key || !host) throw new Error('Incomplete link parameters');
|
||||||
inServer.value = host;
|
inServer.value = host;
|
||||||
inKey.value = key;
|
inKey.value = key;
|
||||||
|
inSni.value = url.searchParams.get('sni') || '';
|
||||||
|
inPbk.value = url.searchParams.get('pbk') || '';
|
||||||
|
inSid.value = url.searchParams.get('sid') || '';
|
||||||
|
|
||||||
|
const type = url.searchParams.get('type');
|
||||||
|
if (type === 'tcp' || type === 'http') inTransport.value = 'uot';
|
||||||
|
else inTransport.value = 'udp';
|
||||||
|
|
||||||
importInput.value = '';
|
importInput.value = '';
|
||||||
showToast(t('toast_imported'), 'ok');
|
showToast(t('toast_imported'), 'ok');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue