Skip to content

Commit

Permalink
feat(config): add more config related fields
Browse files Browse the repository at this point in the history
  • Loading branch information
kunish committed Jun 3, 2023
1 parent 5f116da commit df3ed8b
Show file tree
Hide file tree
Showing 6 changed files with 272 additions and 47 deletions.
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const App = () => {
withGlobalStyles
withNormalizeCSS
>
<Notifications />
<Notifications limit={5} />
<Router />
</MantineProvider>
</ColorSchemeProvider>
Expand Down
70 changes: 68 additions & 2 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,80 @@ export enum DialMode {
domainPP = 'domain++',
}

export enum TcpCheckHttpMethod {
CONNECT = 'CONNECT',
HEAD = 'HEAD',
OPTIONS = 'OPTIONS',
TRACE = 'TRACE',
GET = 'GET',
POST = 'POST',
DELETE = 'DELETE',
PATCH = 'PATCH',
PUT = 'PUT',
}

export enum TLSImplementation {
tls = 'tls',
utls = 'utls',
}

export enum UTLSImitate {
randomized = 'randomized',
randomizedalpn = 'randomizedalpn',
randomizednoalpn = 'randomizednoalpn',
firefox_auto = 'firefox_auto',
firefox_55 = 'firefox_55',
firefox_56 = 'firefox_56',
firefox_63 = 'firefox_63',
firefox_65 = 'firefox_65',
firefox_99 = 'firefox_99',
firefox_102 = 'firefox_102',
firefox_105 = 'firefox_105',
chrome_auto = 'chrome_auto',
chrome_58 = 'chrome_58',
chrome_62 = 'chrome_62',
chrome_70 = 'chrome_70',
chrome_72 = 'chrome_72',
chrome_83 = 'chrome_83',
chrome_87 = 'chrome_87',
chrome_96 = 'chrome_96',
chrome_100 = 'chrome_100',
chrome_102 = 'chrome_102',
ios_auto = 'ios_auto',
ios_11_1 = 'ios_11_1',
ios_12_1 = 'ios_12_1',
ios_13 = 'ios_13',
ios_14 = 'ios_14',
android_11_okhttp = 'android_11_okhttp',
edge_auto = 'edge_auto',
edge_85 = 'edge_85',
edge_106 = 'edge_106',
safari_auto = 'safari_auto',
safari_16_0 = 'safari_16_0',
utls_360_auto = '360_auto',
utls_360_7_5 = '360_7_5',
utls_360_11_0 = '360_11_0',
qq_auto = 'qq_auto',
qq_11_1 = 'qq_11_1',
}

export const DEFAULT_LOG_LEVEL = LogLevel.info
export const DEFAULT_TPROXY_PORT = 7890
export const DEFAULT_ALLOW_INSECURE = true
export const DEFAULT_CHECK_INTERVAL = '10s'
export const DEFAULT_CHECK_TOLERANCE = '1000ms'
export const DEFAULT_UDP_CHECK_DNS = '1.1.1.1'
export const DEFAULT_TCP_CHECK_URL = 'http://keep-alv.google.com/generate_204'
export const DEFAULT_UDP_CHECK_DNS = ['dns.google.com:53', '8.8.8.8', '2001:4860:4860:8888', '1.1.1.1']
export const DEFAULT_TCP_CHECK_URL = [
'http://cp.cloudflare.com',
'1.1.1.1',
'2606:4700:4700::1111',
'http://keep-alv.google.com/generate_204',
]
export const DEFAULT_DIAL_MODE = DialMode.domain
export const DEFAULT_TCP_CHECK_HTTP_METHOD = TcpCheckHttpMethod.CONNECT
export const DEFAULT_DISABLE_WAITING_NETWORK = false
export const DEFAULT_AUTO_CONFIG_KERNEL_PARAMETER = false
export const DEFAULT_TLS_IMPLEMENTATION = TLSImplementation.tls

export const DEFAULT_CONFIG_WITH_INTERFACE = (interfaceName?: string): GlobalInput => ({
logLevel: DEFAULT_LOG_LEVEL,
Expand Down
6 changes: 6 additions & 0 deletions src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
},
"address": "address",
"allowInsecure": "allowInsecure",
"autoConfigKernelParameter": "autoConfigKernelParameter",
"checkInterval": "checkInterval",
"checkTolerance": "checkTolerance",
"collapse": "collapse",
Expand All @@ -29,6 +30,7 @@
"dark mode": "Dark Mode",
"debug": "debug",
"dialMode": "dialMode",
"disableWaitingNetwork": "disableWaitingNetwork",
"disconnected": "disconnected",
"dns": "DNS",
"dnsUpstream": "dnsUpstream",
Expand Down Expand Up @@ -60,14 +62,18 @@
"seconds": "seconds",
"select": "select",
"selected": "selected",
"sniffingTimeout": "sniffingTimeout",
"subscription": "Subscription",
"success": "Success",
"tag": "tag",
"tcpCheckHttpMethod": "tcpCheckHttpMethod",
"tcpCheckUrl": "tcpCheckUrl",
"tlsImplementation": "tlsImplementation",
"tproxyPort": "tproxyPort",
"trace": "trace",
"udpCheckDns": "udpCheckDns",
"username": "username",
"utlsImitate": "utlsImitate",
"value": "value",
"wanInterface": "wanInterface",
"warn": "warn",
Expand Down
6 changes: 6 additions & 0 deletions src/i18n/locales/zh-Hans.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
},
"address": "地址",
"allowInsecure": "允许不安全",
"autoConfigKernelParameter": "自动配置内核参数",
"checkInterval": "检测间隔",
"checkTolerance": "检测公差",
"collapse": "折叠",
Expand All @@ -29,6 +30,7 @@
"dark mode": "暗黑模式",
"debug": "调试",
"dialMode": "拨号模式",
"disableWaitingNetwork": "禁用网络等待",
"disconnected": "未连接",
"dns": "DNS",
"dnsUpstream": "DNS 上游",
Expand Down Expand Up @@ -60,14 +62,18 @@
"seconds": "",
"select": "选择",
"selected": "已选中",
"sniffingTimeout": "嗅探超时",
"subscription": "订阅",
"success": "成功",
"tag": "标签",
"tcpCheckHttpMethod": "TCP 检测 HTTP 方式",
"tcpCheckUrl": "TCP 检测链接",
"tlsImplementation": "TLS 实现",
"tproxyPort": "透明代理端口",
"trace": "跟踪",
"udpCheckDns": "UDP 检测 DNS",
"username": "用户名",
"utlsImitate": "uTLS 模仿",
"value": "",
"wanInterface": "WAN 接口",
"warn": "警告",
Expand Down
Loading

0 comments on commit df3ed8b

Please sign in to comment.