mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-27 05:00:30 +08:00
feat: add IPv6 loopback addresses to skip-auth-prefixes
This commit is contained in:
parent
84c89105b4
commit
1da82c1b3b
@ -272,7 +272,13 @@ async function migration(): Promise<void> {
|
|||||||
}
|
}
|
||||||
// add default skip auth prefix
|
// add default skip auth prefix
|
||||||
if (!skipAuthPrefixes) {
|
if (!skipAuthPrefixes) {
|
||||||
await patchControledMihomoConfig({ 'skip-auth-prefixes': ['127.0.0.1/32'] })
|
await patchControledMihomoConfig({ 'skip-auth-prefixes': ['127.0.0.1/32', '::1/128'] })
|
||||||
|
} else if (skipAuthPrefixes.length >= 1 && skipAuthPrefixes[0] === '127.0.0.1/32') {
|
||||||
|
const filteredPrefixes = skipAuthPrefixes.filter(ip => ip !== '::1/128')
|
||||||
|
const newPrefixes = [filteredPrefixes[0], '::1/128', ...filteredPrefixes.slice(1)]
|
||||||
|
if (JSON.stringify(newPrefixes) !== JSON.stringify(skipAuthPrefixes)) {
|
||||||
|
await patchControledMihomoConfig({ 'skip-auth-prefixes': newPrefixes })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// add default authentication
|
// add default authentication
|
||||||
if (!authentication) {
|
if (!authentication) {
|
||||||
|
|||||||
@ -65,7 +65,7 @@ export const defaultControledMihomoConfig: Partial<IMihomoConfig> = {
|
|||||||
'lan-allowed-ips': ['0.0.0.0/0', '::/0'],
|
'lan-allowed-ips': ['0.0.0.0/0', '::/0'],
|
||||||
'lan-disallowed-ips': [],
|
'lan-disallowed-ips': [],
|
||||||
authentication: [],
|
authentication: [],
|
||||||
'skip-auth-prefixes': ['127.0.0.1/32'],
|
'skip-auth-prefixes': ['127.0.0.1/32', '::1/128'],
|
||||||
tun: {
|
tun: {
|
||||||
enable: false,
|
enable: false,
|
||||||
device: process.platform === 'darwin' ? 'utun1500' : 'Mihomo',
|
device: process.platform === 'darwin' ? 'utun1500' : 'Mihomo',
|
||||||
|
|||||||
@ -48,7 +48,7 @@ const Mihomo: React.FC = () => {
|
|||||||
'external-controller': externalController = '',
|
'external-controller': externalController = '',
|
||||||
secret,
|
secret,
|
||||||
authentication = [],
|
authentication = [],
|
||||||
'skip-auth-prefixes': skipAuthPrefixes = ['127.0.0.1/32'],
|
'skip-auth-prefixes': skipAuthPrefixes = ['127.0.0.1/32', '::1/128'],
|
||||||
'log-level': logLevel = 'info',
|
'log-level': logLevel = 'info',
|
||||||
'find-process-mode': findProcessMode = 'strict',
|
'find-process-mode': findProcessMode = 'strict',
|
||||||
'allow-lan': allowLan,
|
'allow-lan': allowLan,
|
||||||
@ -743,7 +743,7 @@ const Mihomo: React.FC = () => {
|
|||||||
return (
|
return (
|
||||||
<div key={index} className="flex mb-2">
|
<div key={index} className="flex mb-2">
|
||||||
<Input
|
<Input
|
||||||
disabled={index === 0}
|
disabled={index === 0 || index === 1}
|
||||||
size="sm"
|
size="sm"
|
||||||
fullWidth
|
fullWidth
|
||||||
placeholder={t('mihomo.ipSegment.placeholder')}
|
placeholder={t('mihomo.ipSegment.placeholder')}
|
||||||
@ -758,7 +758,7 @@ const Mihomo: React.FC = () => {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{index < skipAuthPrefixesInput.length && index !== 0 && (
|
{index < skipAuthPrefixesInput.length && index !== 0 && index !== 1 && (
|
||||||
<Button
|
<Button
|
||||||
className="ml-2"
|
className="ml-2"
|
||||||
size="sm"
|
size="sm"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user