mirror of
https://github.com/pompurin404/mihomo-party.git
synced 2024-11-16 11:42:19 +08:00
control all port
This commit is contained in:
parent
a7a8578c41
commit
14d7335caf
|
@ -12,6 +12,10 @@ export const defaultControledMihomoConfig: Partial<IMihomoConfig> = {
|
||||||
ipv6: false,
|
ipv6: false,
|
||||||
mode: 'rule',
|
mode: 'rule',
|
||||||
'mixed-port': 7890,
|
'mixed-port': 7890,
|
||||||
|
'socks-port': 7891,
|
||||||
|
port: 7892,
|
||||||
|
'redir-port': 0,
|
||||||
|
'tproxy-port': 0,
|
||||||
'allow-lan': false,
|
'allow-lan': false,
|
||||||
'unified-delay': false,
|
'unified-delay': false,
|
||||||
'log-level': 'info',
|
'log-level': 'info',
|
||||||
|
|
|
@ -4,6 +4,7 @@ import SettingCard from '@renderer/components/base/base-setting-card'
|
||||||
import SettingItem from '@renderer/components/base/base-setting-item'
|
import SettingItem from '@renderer/components/base/base-setting-item'
|
||||||
import { useAppConfig } from '@renderer/hooks/use-app-config'
|
import { useAppConfig } from '@renderer/hooks/use-app-config'
|
||||||
import { useControledMihomoConfig } from '@renderer/hooks/use-controled-mihomo-config'
|
import { useControledMihomoConfig } from '@renderer/hooks/use-controled-mihomo-config'
|
||||||
|
import { platform } from '@renderer/utils/init'
|
||||||
import { patchMihomoConfig, restartCore } from '@renderer/utils/ipc'
|
import { patchMihomoConfig, restartCore } from '@renderer/utils/ipc'
|
||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
|
|
||||||
|
@ -24,10 +25,18 @@ const Mihomo: React.FC = () => {
|
||||||
'find-process-mode': mode = 'strict',
|
'find-process-mode': mode = 'strict',
|
||||||
'allow-lan': lan,
|
'allow-lan': lan,
|
||||||
'unified-delay': delay,
|
'unified-delay': delay,
|
||||||
'mixed-port': mixedPort = 7890
|
'mixed-port': mixedPort = 7890,
|
||||||
|
'socks-port': socksPort = 7891,
|
||||||
|
port: httpPort = 7892,
|
||||||
|
'redir-port': redirPort = 0,
|
||||||
|
'tproxy-port': tproxyPort = 0
|
||||||
} = controledMihomoConfig || {}
|
} = controledMihomoConfig || {}
|
||||||
|
|
||||||
const [mixedPortInput, setMixedPortInput] = useState(mixedPort)
|
const [mixedPortInput, setMixedPortInput] = useState(mixedPort)
|
||||||
|
const [socksPortInput, setSocksPortInput] = useState(socksPort)
|
||||||
|
const [httpPortInput, setHttpPortInput] = useState(httpPort)
|
||||||
|
const [redirPortInput, setRedirPortInput] = useState(redirPort)
|
||||||
|
const [tproxyPortInput, setTproxyPortInput] = useState(tproxyPort)
|
||||||
const [externalControllerInput, setExternalControllerInput] = useState(externalController)
|
const [externalControllerInput, setExternalControllerInput] = useState(externalController)
|
||||||
const [secretInput, setSecretInput] = useState(secret)
|
const [secretInput, setSecretInput] = useState(secret)
|
||||||
|
|
||||||
|
@ -86,6 +95,122 @@ const Mihomo: React.FC = () => {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</SettingItem>
|
</SettingItem>
|
||||||
|
<SettingItem title="Socks端口" divider>
|
||||||
|
<div className="flex">
|
||||||
|
{socksPortInput !== socksPort && (
|
||||||
|
<Button
|
||||||
|
size="sm"
|
||||||
|
color="primary"
|
||||||
|
className="mr-2"
|
||||||
|
onPress={() => {
|
||||||
|
onChangeNeedRestart({ 'socks-port': socksPortInput })
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
确认
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<Input
|
||||||
|
size="sm"
|
||||||
|
type="number"
|
||||||
|
className="w-[100px]"
|
||||||
|
value={socksPortInput.toString()}
|
||||||
|
max={65535}
|
||||||
|
min={0}
|
||||||
|
onValueChange={(v) => {
|
||||||
|
setSocksPortInput(parseInt(v))
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</SettingItem>
|
||||||
|
<SettingItem title="Http端口" divider>
|
||||||
|
<div className="flex">
|
||||||
|
{httpPortInput !== httpPort && (
|
||||||
|
<Button
|
||||||
|
size="sm"
|
||||||
|
color="primary"
|
||||||
|
className="mr-2"
|
||||||
|
onPress={() => {
|
||||||
|
onChangeNeedRestart({ port: httpPortInput })
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
确认
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<Input
|
||||||
|
size="sm"
|
||||||
|
type="number"
|
||||||
|
className="w-[100px]"
|
||||||
|
value={httpPortInput.toString()}
|
||||||
|
max={65535}
|
||||||
|
min={0}
|
||||||
|
onValueChange={(v) => {
|
||||||
|
setHttpPortInput(parseInt(v))
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</SettingItem>
|
||||||
|
{platform !== 'win32' && (
|
||||||
|
<SettingItem title="Redir端口" divider>
|
||||||
|
<div className="flex">
|
||||||
|
{redirPortInput !== redirPort && (
|
||||||
|
<Button
|
||||||
|
size="sm"
|
||||||
|
color="primary"
|
||||||
|
className="mr-2"
|
||||||
|
onPress={() => {
|
||||||
|
onChangeNeedRestart({ 'redir-port': redirPortInput })
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
确认
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<Input
|
||||||
|
size="sm"
|
||||||
|
type="number"
|
||||||
|
className="w-[100px]"
|
||||||
|
value={redirPortInput.toString()}
|
||||||
|
max={65535}
|
||||||
|
min={0}
|
||||||
|
onValueChange={(v) => {
|
||||||
|
setRedirPortInput(parseInt(v))
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</SettingItem>
|
||||||
|
)}
|
||||||
|
{platform === 'linux' && (
|
||||||
|
<SettingItem title="TProxy端口" divider>
|
||||||
|
<div className="flex">
|
||||||
|
{tproxyPortInput !== tproxyPort && (
|
||||||
|
<Button
|
||||||
|
size="sm"
|
||||||
|
color="primary"
|
||||||
|
className="mr-2"
|
||||||
|
onPress={() => {
|
||||||
|
onChangeNeedRestart({ 'tproxy-port': tproxyPortInput })
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
确认
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<Input
|
||||||
|
size="sm"
|
||||||
|
type="number"
|
||||||
|
className="w-[100px]"
|
||||||
|
value={tproxyPortInput.toString()}
|
||||||
|
max={65535}
|
||||||
|
min={0}
|
||||||
|
onValueChange={(v) => {
|
||||||
|
setTproxyPortInput(parseInt(v))
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</SettingItem>
|
||||||
|
)}
|
||||||
<SettingItem title="外部控制" divider>
|
<SettingItem title="外部控制" divider>
|
||||||
<div className="flex">
|
<div className="flex">
|
||||||
{externalControllerInput !== externalController && (
|
{externalControllerInput !== externalController && (
|
||||||
|
@ -127,6 +252,7 @@ const Mihomo: React.FC = () => {
|
||||||
|
|
||||||
<Input
|
<Input
|
||||||
size="sm"
|
size="sm"
|
||||||
|
type="password"
|
||||||
value={secretInput}
|
value={secretInput}
|
||||||
onValueChange={(v) => {
|
onValueChange={(v) => {
|
||||||
setSecretInput(v)
|
setSecretInput(v)
|
||||||
|
|
2
src/shared/types.d.ts
vendored
2
src/shared/types.d.ts
vendored
|
@ -185,6 +185,8 @@ interface IMihomoConfig {
|
||||||
'log-level': LogLevel
|
'log-level': LogLevel
|
||||||
'find-process-mode': FindProcessMode
|
'find-process-mode': FindProcessMode
|
||||||
'socks-port'?: number
|
'socks-port'?: number
|
||||||
|
'redir-port'?: number
|
||||||
|
'tproxy-port'?: number
|
||||||
port?: number
|
port?: number
|
||||||
proxies?: []
|
proxies?: []
|
||||||
'proxy-groups'?: []
|
'proxy-groups'?: []
|
||||||
|
|
Loading…
Reference in New Issue
Block a user