perf: ipv6支持

pull/243/head
xiaojunnuo 2024-11-13 23:37:35 +08:00
parent a38ff69cbd
commit da6ac1626b
4 changed files with 16 additions and 0 deletions

View File

@ -30,6 +30,7 @@ export class SysPrivateSettings extends BaseSettings {
httpsProxy? = ''; httpsProxy? = '';
httpProxy? = ''; httpProxy? = '';
dnsResultOrder? = '';
removeSecret() { removeSecret() {
const clone = cloneDeep(this); const clone = cloneDeep(this);

View File

@ -7,6 +7,7 @@ import { BaseSettings, SysInstallInfo, SysPrivateSettings, SysPublicSettings, Sy
import * as _ from 'lodash-es'; import * as _ from 'lodash-es';
import { BaseService } from '../../../basic/index.js'; import { BaseService } from '../../../basic/index.js';
import { logger, setGlobalProxy } from '@certd/basic'; import { logger, setGlobalProxy } from '@certd/basic';
import * as dns from 'node:dns';
/** /**
* *
*/ */
@ -131,6 +132,10 @@ export class SysSettingsService extends BaseService<SysSettingsEntity> {
httpsProxy: bean.httpsProxy, httpsProxy: bean.httpsProxy,
}; };
setGlobalProxy(opts); setGlobalProxy(opts);
if (bean.dnsResultOrder) {
dns.setDefaultResultOrder(bean.dnsResultOrder as any);
}
} }
async updateByKey(key: string, setting: any) { async updateByKey(key: string, setting: any) {

View File

@ -13,6 +13,7 @@ export type SysPublicSetting = {
export type SysPrivateSetting = { export type SysPrivateSetting = {
httpProxy?: string; httpProxy?: string;
httpsProxy?: string; httpsProxy?: string;
dnsResultOrder?: string;
}; };
export const SettingKeys = { export const SettingKeys = {

View File

@ -39,6 +39,15 @@
</div> </div>
<div class="helper">一般这两个代理填一样的</div> <div class="helper">一般这两个代理填一样的</div>
</a-form-item> </a-form-item>
<a-form-item label="双栈网络" :name="['private', 'dnsResultOrder']">
<a-select v-model:value="formState.private.dnsResultOrder">
<a-select-option value="verbatim">默认</a-select-option>
<a-select-option value="ipv4first">IPV4优先</a-select-option>
<a-select-option value="ipv6first">IPV6优先</a-select-option>
</a-select>
<div class="helper">如果选择IPv6优先需要在docker-compose.yaml中启用ipv6</div>
</a-form-item>
<a-form-item :wrapper-col="{ offset: 8, span: 16 }"> <a-form-item :wrapper-col="{ offset: 8, span: 16 }">
<a-button :loading="saveLoading" type="primary" html-type="submit">保存</a-button> <a-button :loading="saveLoading" type="primary" html-type="submit">保存</a-button>
</a-form-item> </a-form-item>