✨ ini批量端口
This commit is contained in:
parent
60fbc354d0
commit
e4cd09d1dc
@ -33,6 +33,13 @@ const getFrpcVersionWorkerPath = (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isRangePort = (m: Proxy) => {
|
||||||
|
return (
|
||||||
|
(m.localPort.indexOf("-") !== -1 || m.localPort.indexOf(",") !== -1) &&
|
||||||
|
(m.type === "tcp" || m.type === "udp")
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成toml配置文件
|
* 生成toml配置文件
|
||||||
* @param config
|
* @param config
|
||||||
@ -40,9 +47,7 @@ const getFrpcVersionWorkerPath = (
|
|||||||
*/
|
*/
|
||||||
export const genTomlConfig = (config: FrpConfig, proxys: Proxy[]) => {
|
export const genTomlConfig = (config: FrpConfig, proxys: Proxy[]) => {
|
||||||
const proxyToml = proxys.map(m => {
|
const proxyToml = proxys.map(m => {
|
||||||
const rangePort =
|
const rangePort = isRangePort(m);
|
||||||
(m.localPort.indexOf("-") !== -1 || m.localPort.indexOf(",") !== -1) &&
|
|
||||||
(m.type === "tcp" || m.type === "udp");
|
|
||||||
let toml = `
|
let toml = `
|
||||||
${
|
${
|
||||||
rangePort
|
rangePort
|
||||||
@ -197,8 +202,9 @@ ${proxyToml.join("")}
|
|||||||
*/
|
*/
|
||||||
export const genIniConfig = (config: FrpConfig, proxys: Proxy[]) => {
|
export const genIniConfig = (config: FrpConfig, proxys: Proxy[]) => {
|
||||||
const proxyIni = proxys.map(m => {
|
const proxyIni = proxys.map(m => {
|
||||||
|
const rangePort = isRangePort(m);
|
||||||
let ini = `
|
let ini = `
|
||||||
[${m.name}]
|
[${rangePort ? 'range:' : ''}${m.name}]
|
||||||
type = "${m.type}"
|
type = "${m.type}"
|
||||||
`;
|
`;
|
||||||
switch (m.type) {
|
switch (m.type) {
|
||||||
|
Loading…
Reference in New Issue
Block a user