Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
xishang0128 committed Aug 18, 2024
1 parent 0197b4b commit 0a9b454
Show file tree
Hide file tree
Showing 5 changed files with 231 additions and 11 deletions.
27 changes: 19 additions & 8 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,27 @@ export default defineConfig({
'guides/install/linux-arch',
'guides/install/linux-other'
]
},
}
]
},
{
label: '常见问题', items: [
'guides/issue/general',
'guides/issue/windows',
'guides/issue/macos',
'guides/issue/linux'
]
},
{
label: '使用教程', items: [
{
label: '覆写', items: [
'guides/function/override/yaml',
'guides/function/override/js',
]
}
]
},

{ label: '常见问题', items: [
'guides/issue/general',
'guides/issue/windows',
'guides/issue/macos',
'guides/issue/linux'
] },
],
}
],
Expand Down
16 changes: 16 additions & 0 deletions src/content/docs/guides/function/override/js.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: JavaScript
---

使用 `JavaScript` 对配置进行修改

程序的入口为 `main` 函数,接受一个 `config` 参数 (名称不限制),并返回修改后的该参数

下方演示为在 `rules` 开头插入一条规则

```js
function main(config) {
config.rules.unshift("DOMAIN,google.com,DIRECT");
return config;
}
```
193 changes: 193 additions & 0 deletions src/content/docs/guides/function/override/yaml.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
---
title: YAML
---

import { Tabs, TabItem } from '@astrojs/starlight/components';

使用 `深度合并` 对原配置进行覆写,优先级低于应用常用配置覆写

如果目标是是简单值或者数组,将直接覆盖

如果遇到嵌套的对象,函数会进一步递归合并这些嵌套的对象

如果是[rules](https://wiki.metacubex.one/config/rules/)/[proxies](https://wiki.metacubex.one/config/proxies/),则在数组开头进行填充


<Tabs>
<TabItem label="覆写前内容">

```yaml
mixed-port: 7890

dns:
enable: true
ipv6: true
enhanced-mode: fake-ip
fake-ip-range: 28.0.0.1/8
nameserver: [https://dns.alidns.com/dns-query]

proxies:
- name: ss
type: ss
server: 127.0.0.1
port: 443
password: mihomo
cipher: none

proxy-groups:
- name: "国内"
type: select
proxies:
- DIRECT

rules:
- GEOIP,CN,DIRECT
- MATCH,home
```
</TabItem>
<TabItem label="要覆写的内容">
```yaml
mixed-port: 7895
external-ui: ui


sniffer:
enable: true
override-destination: false
sniff:
HTTP:
ports: [80, 8080-8880]
override-destination: true
TLS:
ports: [443, 8443]
QUIC:
ports: [443, 8443]

tun:
enable: true
stack: mixed
auto-route: true
auto-detect-interface: true
strict-route: false
dns-hijack:
- any:53

dns:
enable: true
listen: :1053
ipv6: true
enhanced-mode: fake-ip
fake-ip-filter:
- "*"
- "+.lan"
- "+.local"
- live-push.bilivideo.com
default-nameserver:
- https://223.5.5.5/dns-query
nameserver:
- https://dns.alidns.com/dns-query
- https://doh.pub/dns-query

proxies:
- name: 直连
type: direct

rule-providers:
cn_domain:
type: http
interval: 86400
behavior: domain
format: mrs
url: "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/cn.mrs"

rules:
- RULE-SER,cn_domain,CN

proxy-groups:
- name: CN
type: select
proxies:
- DIRECT

```

</TabItem>
<TabItem label="输出内容">

```yaml
mixed-port: 7895
external-ui: ui

sniffer:
enable: true
override-destination: false
sniff:
HTTP:
ports: [80, 8080-8880]
override-destination: true
TLS:
ports: [443, 8443]
QUIC:
ports: [443, 8443]

tun:
enable: true
stack: mixed
auto-route: true
auto-detect-interface: true
strict-route: false
dns-hijack:
- any:53


dns:
enable: true
listen: :1053
ipv6: true
enhanced-mode: fake-ip
fake-ip-range: 28.0.0.1/8
fake-ip-filter:
- "*"
- "+.lan"
- "+.local"
- live-push.bilivideo.com
default-nameserver:
- https://223.5.5.5/dns-query
nameserver:
- https://dns.alidns.com/dns-query
- https://doh.pub/dns-query

proxies:
- name: 直连
type: direct
- name: ss
type: ss
server: 127.0.0.1
port: 443
password: mihomo
cipher: none

proxy-groups:
- name: CN
type: select
proxies:
- DIRECT

rules:
- RULE-SET,cn_domain,CN
- GEOIP,CN,DIRECT
- MATCH,home

rule-providers:
cn_domain:
type: http
interval: 86400
behavior: domain
format: mrs
url: https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/cn.mrs
```
</TabItem>
</Tabs>
2 changes: 1 addition & 1 deletion src/content/docs/guides/install/linux-debian.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ sudo apt install -y /path/to/mihomo-party-linux-xxx.deb
</TabItem>
<TabItem label="dpkg">

```sh
```shell
sudo dpkg -i /path/to/mihomo-party-linux-xxx.deb
```

Expand Down
4 changes: 2 additions & 2 deletions src/content/docs/guides/install/linux-redhat.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ sudo rpm -ih /path/to/mihomo-party-linux-xxx.rpm
</TabItem>
<TabItem label="dnf">

```sh
```shell
sudo dnf install /path/to/mihomo-party-linux-xxx.rpm
```

</TabItem>
<TabItem label="yum">

```sh
```shell
sudo yum localinstall /path/to/mihomo-party-linux-xxx.rpm
```

Expand Down

0 comments on commit 0a9b454

Please sign in to comment.