Implementing a Proxy on Windows using Standalone Mihomo and MetaCubeXD

Some scripts and concepts are credited to the Linux.do community.

Mihomo Installation & Configuration

Install Mihomo via Scoop

bucket add main
scoop install main/mihomo

Create Configuration File

Example configuration (config.yaml):

ipv6: false
external-controller: 0.0.0.0:9090
external-ui: ui
geodata-mode: true  # Enable .dat mode to show rule counts on the dashboard
geo-auto-update: true
geo-update-interval: 24
geox-url:
  geoip: "[https://fastly.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geoip-lite.dat](https://fastly.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geoip-lite.dat)"  # Lite version for smaller footprint
tun:
  enable: true
  auto-route: true
  auto-detect-interface: true
  strict-route: true
  stack: system
  dns-hijack:
    - 0.0.0.0:53
dns:
  enable: true
  listen: 0.0.0.0:53
  enhanced-mode: fake-ip
  fake-ip-range: 198.18.0.1/16
  fake-ip-filter:
    - '*.lan'
    - localhost.ptlogin2.qq.com
    - +.msftconnecttest.com
    - +.msftncsi.com
  nameserver:
    - system  # Use system DNS for best compatibility and speed
proxy-providers:
  XXX:
    type: http
    url: "XXX"  # Your subscription link
    path: ./XXX.yaml
    interval: 86400
proxy-groups:
  - name: "PROXY"
    type: select
    use:
      - XXX
rule-providers:
  global:
    type: http
    path: ./global.yaml
    url: "[https://fastly.jsdelivr.net/gh/ACL4SSR/ACL4SSR@master/Clash/Providers/ProxyLite.yaml](https://fastly.jsdelivr.net/gh/ACL4SSR/ACL4SSR@master/Clash/Providers/ProxyLite.yaml)"
    interval: 86400
    proxy: DIRECT
    behavior: classical
    format: yaml
  china:
    type: http
    path: ./china.yaml
    url: "[https://fastly.jsdelivr.net/gh/ACL4SSR/ACL4SSR@master/Clash/Providers/ChinaDomain.yaml](https://fastly.jsdelivr.net/gh/ACL4SSR/ACL4SSR@master/Clash/Providers/ChinaDomain.yaml)"
    interval: 86400
    proxy: DIRECT
    behavior: classical
    format: yaml
rules:
  - GEOIP,private,DIRECT,no-resolve  # Add 'no-resolve' before GEOIP rules to prevent premature DNS resolution
  - RULE-SET,global,PROXY,no-resolve
  - RULE-SET,china,DIRECT,no-resolve
  - GEOIP,cn,DIRECT
  - MATCH,PROXY

Alternatively, refer to the official documentation or community guides for custom configurations.

Create Launch Script

You can launch the .exe directly, or use a silent mihomo.vbs script (remember to update the paths):

Option A: With logging

set mihomo = CreateObject("WScript.Shell")
mihomo.CurrentDirectory = "D:\Software\Scoop\apps\mihomo\current"
mihomo.Run "cmd /c ""D:\Software\Scoop\apps\mihomo\current\mihomo.exe -d . > D:\Software\Scoop\apps\mihomo\current\mihomo.log 2>&1""", 0, false

Option B: No logging

set mihomo = CreateObject("WScript.Shell")
mihomo.CurrentDirectory = "D:\Software\Scoop\apps\mihomo\current"
mihomo.Run "mihomo.exe -d .", 1, true

MetaCubeXD Installation & Configuration

  1. Visit the MetaCubeX/metacubexd GitHub repository.
  2. Download the latest Release and extract it.
  3. Create a .bat script in the extracted directory (to avoid typing the command every time):
@echo off
REM Switch CMD code page to UTF-8 (65001) for correct character display
chcp 65001

REM Set the path for the website root directory
set WEB_ROOT=D:\metacubexd

REM Check and switch to the target path
echo Attempting to switch to directory: %WEB_ROOT%
cd /d "%WEB_ROOT%"
if %errorlevel% neq 0 (
    echo.
    echo ERROR: Could not switch to directory %WEB_ROOT%.
    echo Please verify the path exists.
    pause
    exit /b 1
)

REM Check for Python
where python >nul 2>nul
if %errorlevel% neq 0 (
    echo.
    echo ERROR: Python command not found.
    pause
    exit /b 1
)

REM Start HTTP Server
echo.
echo ----------------------------------------------------
echo 🎉 Python HTTP Server started successfully!
echo 🌐 URL: [http://127.0.0.1:8000](http://127.0.0.1:8000)
echo 📁 Root Directory: %WEB_ROOT%
echo ----------------------------------------------------
echo.

REM Start server using default port 8000
python -m http.server 8000

REM Pause if server stops
echo.
echo HTTP Server has stopped.
pause

Summary

You are all set!

Postscript: If you prefer a graphical interface, there are two excellent alternative projects: GUI.for.Clash and GUI.for.SingBox.

No Comments

Send Comment Edit Comment


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
Previous
Next