• Stars
    star
    220
  • Rank 180,422 (Top 4 %)
  • Language
    Go
  • License
    GNU General Publi...
  • Created over 2 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Transparent proxy tool for Clash

Transparent proxy tool for Clash

่ฟ™ๆ˜ฏไธ€ไธช็”จไบŽ Clash Premium ็š„้€ๆ˜Žไปฃ็†่พ…ๅŠฉๅทฅๅ…ท, ็”ฑไบŽไผ—ๆ‰€ๅ‘จ็Ÿฅๅ‘จ็Ÿฅ็š„ๅŽŸๅ› (ๆ‰‹็ฌจ)่€Œๅˆ›ๅปบ็š„.

ไธ€ใ€TPClash ๆ˜ฏไป€ไนˆ

TPClash ๅฏไปฅ่‡ชๅŠจๅฎ‰่ฃ… Clash Premium/Meta, ๅนถ่‡ชๅŠจ้…็ฝฎๅŸบไบŽ Tun ็š„้€ๆ˜Žไปฃ็†.

TPClash ็š„้€ๆ˜Žไปฃ็†่ง„ๅˆ™ใ€ๆ—ฅๅฟ—้…็ฝฎใ€Dashboard(UI) ้…็ฝฎ็ญ‰ๅ…จ้ƒจไปŽๆ ‡ๅ‡†็š„ Clash ้…็ฝฎๆ–‡ไปถๅ†…่ฏปๅ–, ๅนถๅฎŒๆˆ่‡ช้€‚ๅบ”; TPClash ๆš‚ๆ—ถไธไผšๅˆ›ๅปบ่‡ชๅทฑ็š„่‡ชๅฎšไน‰ ้…็ฝฎๆ–‡ไปถ(ๅ‡่ฝปไฝฟ็”จ่ดŸๆ‹…).

ไบŒใ€TPClash ไฝฟ็”จ

2.1ใ€็›ดๆŽฅๅฏๅŠจ

TPClash ๅชๆœ‰ไธ€ไธชไบŒ่ฟ›ๅˆถๆ–‡ไปถ, ็›ดๆŽฅไปŽ Release ้กต้ขไธ‹่ฝฝไบŒ่ฟ›ๅˆถๆ–‡ไปถ่ฟ่กŒๅณๅฏ. TPClash ไบŒ่ฟ›ๅˆถๅ†…ๅตŒๅ…ฅไบ†็›ฎๆ ‡ๅนณๅฐ็š„ Clash ไบŒ่ฟ›ๅˆถๆ–‡ไปถไปฅๅŠๅ…ถไป–่ต„ๆบๆ–‡ไปถ(All in one), ๅฏๅŠจๅŽไผš่‡ชๅŠจ้‡Šๆ”พ, ๆ‰€ไปฅๆ— ้œ€ๅ†ไธ‹่ฝฝ Clash.

ๆณจๆ„: TPClash ้ป˜่ฎคไผš่ฏปๅ–ไฝไบŽ /etc/clash.yaml ็š„ clash ้…็ฝฎๆ–‡ไปถ, ๅฆ‚ๆžœ clash ้…็ฝฎๆ–‡ไปถๅœจๅ…ถไป–ไฝ็ฝฎ่ฏท่‡ช่กŒไฟฎๆ”น.

./tpclash-premium-linux-amd64-v3 -c /etc/clash.yaml

2.2ใ€Systemd ๅฎ‰่ฃ…

้™คไบ†็›ดๆŽฅ่ฟ่กŒไน‹ๅค–, ้’ˆๅฏนไบŽๆ”ฏๆŒ Systemd ็š„็ณป็ปŸ TPClash ไนŸๆ”ฏๆŒ install ๅ‘ฝไปค็”จไบŽๅฐ†่‡ช่บซๅฎ‰่ฃ…ไธบ Systemd ๆœๅŠก; ๅฎ‰่ฃ…ๆ—ถ TPClash ๅ…ˆๅฐ†่‡ช่บซๅคๅˆถ ๅˆฐ /usr/local/bin/tpclash, ็„ถๅŽๅˆ›ๅปบ /etc/systemd/system/tpclash.service ้…็ฝฎๆ–‡ไปถ, ๅนถไธ”ๅฐ†้™„ๅŠ ๅ‚ๆ•ฐไนŸๅŒๆญฅๅ†™ๅ…ฅๅˆฐ Systemd ้…็ฝฎไธญ.

root@tpclash ~ # โฏโฏโฏ ./tpclash-premium-linux-amd64-v3 install --config https://example.com/clash.yaml

โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•—      โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ•—
โ•šโ•โ•โ–ˆโ–ˆโ•”โ•โ•โ•โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘
   โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘
   โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•”โ•โ•โ•โ• โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•‘โ•šโ•โ•โ•โ•โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•‘
   โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘     โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘
   โ•šโ•โ•   โ•šโ•โ•      โ•šโ•โ•โ•โ•โ•โ•โ•šโ•โ•โ•โ•โ•โ•โ•โ•šโ•โ•  โ•šโ•โ•โ•šโ•โ•โ•โ•โ•โ•โ•โ•šโ•โ•  โ•šโ•โ•
  ๐Ÿ‘Œ TPClash ๅฎ‰่ฃ…ๅฎŒๆˆ, ๆ‚จๅฏไปฅไฝฟ็”จไปฅไธ‹ๅ‘ฝไปคๅฏๅŠจ:
     - ๅฏๅŠจๆœๅŠก: systemctl start tpclash
     - ๅœๆญขๆœๅŠก: systemctl stop tpclash
     - ้‡ๅฏๆœๅŠก: systemctl restart tpclash
     - ๅผ€ๅฏ่‡ชๅฏๅŠจ: systemctl enable tpclash
     - ๅ…ณ้—ญ่‡ชๅฏๅŠจ: systemctl disable tpclash
     - ๆŸฅ็œ‹ๆ—ฅๅฟ—: journalctl -fu tpclash
     - ้‡่ฝฝๆœๅŠก้…็ฝฎ: systemctl daemon-reload

2.3ใ€Docker ่ฟ่กŒ

ๆณจๆ„: ไปŽ v0.1.0 ็‰ˆๆœฌๅผ€ๅง‹, ๅฆ‚ๆžœไฝฟ็”จ Docker ่ฟ่กŒๆˆ–่€…ๅฎฟไธปๆœบๅฎ‰่ฃ…ไบ† Docker, TPClash ไผš่‡ชๅŠจๅฐ่ฏ•ไฝฟ็”จ nftables ่ฟ›่กŒไฟฎๅค; ๅฆ‚ๆžœๅฎฟไธปๆœบไธๆ”ฏๆŒ nftables, ่ฏท่‡ช่กŒไฝฟ็”จ iptables -I DOCKER-USER -i src_if -o dst_if -j ACCEPT ๅ‘ฝไปคไฟฎๅค.

ๅฆ‚ๆžœๆƒณ่ฆๅœจ Docker ไธญไฝฟ็”จ tpclash, ๅช้œ€่ฆๆŒ‚่ฝฝๅค–้ƒจ้…็ฝฎๆ–‡ไปถๅณๅฏ:

docker run -dt \
  --name tpclash \
  --privileged \
  --network=host \
  -v /root/clash.yaml:/etc/clash.yaml \
  mritd/tpclash

ๆญคๅ‘ฝไปคๅ‡่ฎพ้…็ฝฎๆ–‡ไปถไฝไบŽๅฎฟไธปๆœบ็š„ /root/clash.yaml ไฝ็ฝฎ, ๅ…ถไป–ไฝ็ฝฎ่ฏท่‡ช่กŒๆ›ฟๆข; ่ฏฅ้•œๅƒ้‡‡็”จ Earthly ็ผ–่ฏ‘, Earthfile ๅญ˜ๅ‚จๅœจ autobuild ไป“ๅบ“.

2.4ใ€ๅฎนๅ™จๅŒ–่™šๆ‹Ÿๆœบ้ƒจ็ฝฒ

TPClash ไธ€ๅผ€ๅง‹็š„็›ฎๆ ‡ๅฐฑๆ˜ฏไฝœไธบไธ€ไธช็จณๅฎšๅฏ้ ็š„ใ€ๅฏไปฅ็›ดๆŽฅๆ‰˜็ฎก้…็ฝฎ็š„ๅ†…็ฝ‘็ฝ‘ๅ…ณไฝฟ็”จ, ่™ฝ็„ถ TPClash ๅฏไปฅๅ…ผๅฎนๅคงๅคšๆ•ฐ็ณป็ปŸ, ไฝ†็‰นๆฎŠ็ณป็ปŸ็Žฏๅขƒไพ‹ๅฆ‚ OpenWrt ็ญ‰ๅฏ่ƒฝไผšๅ‡บ็Žฐ ไธ€ไบ›ๅ…ผๅฎนๆ€ง้—ฎ้ข˜;ไธบไบ†็ปŸไธ€้ƒจ็ฝฒ็Žฏๅขƒๅ’Œๆ›ดๆ–นไพฟไฝฟ็”จ, ็›ฎๅ‰ๅทฒๅขžๅŠ ไบ†็บฏๅฎนๅ™จๅŒ–็ณป็ปŸ Flatcar ็ณป็ปŸๆ”ฏๆŒ, ่ฏฅ็ณป็ปŸๆ”ฏๆŒ็›ดๆŽฅไฝฟ็”จๅ•ไธช้…็ฝฎๆ–‡ไปถๅฎŒๆˆๅผ•ๅฏผๅ’Œ่‡ชๅŠจๅŒ–้ƒจ็ฝฒ, ไธ”ๅŽๅฐ่‡ชๅŠจ ๆปšๅŠจๅ‡็บง; ๅฏไปฅๆŒ็ปญ็ปดๆŒ็ณป็ปŸ็š„ๆœ€ๆ–ฐ็Šถๆ€ๅนถไธ”ๅฏๅฎ‰ๅ…จๅ›žๆปš; ไปฅไธ‹ๆ˜ฏๅœจ ESXi ไธญ็›ดๆŽฅ้ƒจ็ฝฒ่ฏดๆ˜Ž:

  • 1ใ€ไธ‹่ฝฝ้กน็›ฎๅ†…็š„ flatcar.butane.yaml
  • 2ใ€่ฐƒๆ•ด้…็ฝฎๆ–‡ไปถๅ†…็š„ IP ๅœฐๅ€ๅ’Œ็ฝ‘ๅ…ณๅœฐๅ€, DNS ไธ€่ˆฌไธ้œ€่ฆไฟฎๆ”น
  • 3ใ€่ฐƒๆ•ด้…็ฝฎๆ–‡ไปถๅ†… TPClash ็š„ๅฏๅŠจๅ‘ฝไปค, ไธ€่ˆฌ้œ€่ฆๆŒ‡ๅฎš่ฟœ็จ‹ clash ้…็ฝฎๆ–‡ไปถๅœฐๅ€
  • 4ใ€ๅ‚่€ƒ butane ๅฎ˜ๆ–นๆ–‡ๆกฃๅฎ‰่ฃ… butane ๅทฅๅ…ท
  • 5ใ€ๆ‰ง่กŒ butane --pretty --strict flatcar.butane.yaml | base64 -w0 ็”Ÿๆˆ base64 ็ผ–็ ๆ ผๅผ็š„ Ignition ้…็ฝฎ(yamlๅ็งฐ่‡ช่กŒๆ›ฟๆข)
  • 6ใ€ไธ‹่ฝฝๅฏนๅบ”็ณป็ปŸ็š„ ova ็ณป็ปŸ้ƒจ็ฝฒๆ–‡ไปถ
  • 7ใ€ๅœจ ESXi ๅ†…ๅˆ›ๅปบ่™šๆ‹Ÿๆœบ้€‰ๆ‹ฉไปŽ OVA ้ƒจ็ฝฒ
  • 8ใ€้ƒจ็ฝฒๆ—ถ ๅ…ถไป–่ฎพ็ฝฎ/Options ไธญ Ignition/coreos-cloudinit data ๅกซๅ†™็ฌฌ 5 ๆญฅ็”Ÿๆˆ็š„ base64 ๅญ—็ฌฆไธฒ, Ignition/coreos-cloudinit data encoding ๅกซๅ†™ base64
  • 9ใ€ๆœ€ๅŽๅฏๅŠจๅฎŒๆˆ, ไธ€ไธชๅฎนๅ™จๅŒ–ใ€ไธๅฏๅ˜็š„ๅฏ้  TPClash ็ฝ‘ๅ…ณๅฐฑๅฏๅŠจไบ†

ๅ…ณไบŽ่ฟ™ไธช็ณป็ปŸไปฅๅŠๅ…ถ้…็ฝฎๆ–‡ไปถ้™ไบŽ็ฏ‡ๅน…ๆ— ๆณ•ๅš่ฟ‡ๅคš่ฏดๆ˜Ž, ๆŽจ่้˜…่ฏปๅšๅฎขๆ–‡็ซ .

2.5ใ€่ฎพ็ฝฎๆต้‡่ฝฌๅ‘

TPClash ๅฏๅŠจๆˆๅŠŸๅŽ, ๅฐ†ๅ…ถไป–ไธปๆœบ็š„็ฝ‘ๅ…ณๆŒ‡ๅ‘ๅฝ“ๅ‰ TPClash ๆœๅŠกๅ™จ IP ๅณๅฏๅฎž็Žฐ้€ๆ˜Žไปฃ็†; ๅฏนไบŽ่ขซไปฃ็†ไธปๆœบ่ฏทไฝฟ็”จๅ…ฌ็ฝ‘ DNS.

่ฏทไธ่ฆๅฐ†ๅ…ถไป–ไธปๆœบ็š„ DNS ไนŸ่ฎพ็ฝฎไธบ TPClash ๆœๅŠกๅ™จ IP, ๅ› ไธบ่ฟ™ๅฏ่ƒฝๅฏผ่‡ดไธ€ไบ›ไธๅฏ้ข„ๆต‹็š„้—ฎ้ข˜, ๅ…ทไฝ“่ฏทๅ‚่€ƒ Clash DNS ็ง‘ๆ™ฎ.

2.6ใ€ๅ‡็บง TPClash

ๅฏนไบŽไบŒ่ฟ›ๅˆถๆ–‡ไปถ้ƒจ็ฝฒ็š„็”จๆˆท, ๅฏไปฅไฝฟ็”จไปฅไธ‹ๅ‘ฝไปคๅ‡็บงๅˆฐๆœ€ๆ–ฐ็‰ˆๆœฌ:

root@tpclash ~ # โฏโฏโฏ tpclash upgrade

ๅฆ‚ๆžœๆƒณ่ฆๅ‡็บงๅˆฐ็‰นๅฎš็‰ˆๆœฌไนŸๅฏไปฅๆŒ‡ๅฎš็‰ˆๆœฌๅท:

root@tpclash ~ # โฏโฏโฏ tpclash upgrade v0.1.10

ๅ‡็บงๅ‰่ฏท็กฎไฟๅ…ณ้—ญไบ† tpclash ๆœๅŠก, ๅ‡็บงๆ—ถ้ป˜่ฎคไฝฟ็”จ https://ghproxy.com ่ฟ›่กŒๅŠ ้€Ÿ, ๅฆ‚ๆžœไธๆƒณไฝฟ็”จๅฏไปฅ้€š่ฟ‡ --with-ghproxy=false ้€‰้กนๅ…ณ้—ญ.

ไธ‰ใ€TPClash ้…็ฝฎ

้ป˜่ฎคๆƒ…ๅ†ตไธ‹ TPClash ไผš่ฏปๅ– /etc/clash.yaml ้…็ฝฎๆ–‡ไปถๅฏๅŠจ Clash; TPClash ้ฆ–ๅ…ˆไผš่ฏปๅ–่ฏฅๆ–‡ไปถๅนถ่ฟ›่กŒๆจก็‰ˆ่งฃๆž, ่งฃๆžๆˆๅŠŸๅŽ TPClash ไผšๅฐ†ๅ…ถๅ†™ๅ…ฅๅˆฐ Home ็›ฎๅฝ•็š„ xclash.yaml ไธญ (้ป˜่ฎคไธบ /data/clash/xclash.yaml), ็„ถๅŽๅ†ไฝฟ็”จ่ฏฅ้…็ฝฎๅฏๅŠจ Clash. ็”ฑไบŽ TPClash ๅชๆ˜ฏไธ€ไธช่พ…ๅŠฉๅทฅๅ…ท, ๅฎž้™…ไปฃ็†ๅค„็†่ฟ˜ๆ˜ฏ็”ฑ Clash ๅฎŒๆˆ, ไธบไบ†้ฟๅ…้”™่ฏฏ้…็ฝฎๅฏผ่‡ดไปฃ็†ไธๅทฅไฝœ, TPClash ๅฏน Clash ้…็ฝฎๆ–‡ไปถ่ฟ›่กŒไบ†ๅฟ…่ฆๆ€ง็š„้…็ฝฎๆฃ€ๆต‹. ไธ‹้ขๆ˜ฏไธ€ไบ›ๆŽจ่็š„้…็ฝฎๆ ทไพ‹:

3.1ใ€TUN ๆจกๅผ้…็ฝฎ

# ้œ€่ฆๅผ€ๅฏ TUN ้…็ฝฎ
tun:
  enable: true
  stack: system
  dns-hijack:
    - any:53
  #   - 8.8.8.8:53
  #   - tcp://8.8.8.8:53
  auto-route: true
  auto-redir: true
  auto-detect-interface: true

# ๅผ€ๅฏ DNS ้…็ฝฎ, ไธ”ไฝฟ็”จ fake-ip ๆจกๅผ
dns:
  enable: true
  listen: 0.0.0.0:1053
  enhanced-mode: fake-ip
  fake-ip-range: 198.18.0.1/16
  default-nameserver:
    - 223.5.5.5
    - 119.29.29.29
  nameserver:
    - 223.5.5.5
    - 119.29.29.29

3.2ใ€TUN ้…ๅˆ eBPF ้…็ฝฎ

# ่ฏทๆŒ‡ๅฎš่‡ชๅทฑๅฎž้™…็š„ๆŽฅๅฃๅ็งฐ(ip a ่Žทๅ–)
interface-name: ens160

tun:
  enable: true
  stack: system
  dns-hijack:
    - any:53
  #   - 8.8.8.8:53
  #   - tcp://8.8.8.8:53
  # auto-route ไธŽ ebpf ๅ†ฒ็ช, ไธ่ƒฝๅŒๆ—ถไฝฟ็”จ
  #auto-route: true
  #auto-redir: true
  #auto-detect-interface: true

# ebpf ้œ€่ฆๆŒ‡ๅฎš็‰ฉ็†็ฝ‘ๅก
ebpf:
  redirect-to-tun:
    - ens160

# ebpf ้œ€่ฆ้…็ฝฎ mark
routing-mark: 666

# ๅผ€ๅฏ DNS ้…็ฝฎ, ไธ”ไฝฟ็”จ fake-ip ๆจกๅผ
dns:
  enable: true
  listen: 0.0.0.0:1053
  enhanced-mode: fake-ip
  fake-ip-range: 198.18.0.1/16
  default-nameserver:
    - 223.5.5.5
    - 119.29.29.29
  nameserver:
    - 223.5.5.5
    - 119.29.29.29

3.3ใ€Meta ็”จๆˆท

ๆณจๆ„: Meta ็‰ˆๆœฌๆš‚ๆ—ถๆฒกๆœ‰็ป่ฟ‡ไธฅๆ ผ็š„ๆต‹่ฏ•, ไฝœ่€…ๅนถๆฒกๆœ‰ไฝฟ็”จ Meta ็‰ˆๆœฌ็š„้œ€ๆฑ‚.

ไปŽ v0.0.16 ็‰ˆๆœฌๅผ€ๅง‹ๆ”ฏๆŒ Clash Meta ๅˆ†ๆ”ฏ็‰ˆๆœฌ, Meta ็”จๆˆท้œ€่ฆๅœจ้…็ฝฎๆ–‡ไปถไธญๅ…ณ้—ญ iptables ้…็ฝฎ, ๅ…ถไป–้…็ฝฎไธŽ้ป˜่ฎค็š„ Permium ็‰ˆๆœฌ็›ธๅŒ:

iptables:
  enable: false

ๅ››ใ€้ซ˜็บง้…็ฝฎ

4.1ใ€่ฟœ็จ‹้…็ฝฎๅŠ ่ฝฝ

ไธบไบ†ๆ–นไพฟไฝฟ็”จ, ๅœจ v0.0.19 ็‰ˆๆœฌๅผ€ๅง‹ๆ”ฏๆŒ่ฟœ็จ‹้…็ฝฎๅŠ ่ฝฝ; ไปŽ v0.0.22 ็‰ˆๆœฌๅผ€ๅง‹่ฟ›ไธ€ๆญฅไผ˜ๅŒ–่ฟœ็จ‹้…็ฝฎๅŠ ่ฝฝๅŠŸ่ƒฝ, ็›ฎๅ‰ไฝฟ็”จๆ–นๅผๅฆ‚ไธ‹:

  • 1ใ€ไฝฟ็”จ -c ๅ‚ๆ•ฐๆŒ‡ๅฎš http(s) ่ฟœ็จ‹้…็ฝฎๆ–‡ไปถๅœฐๅ€, ไพ‹ๅฆ‚ -c https://example.com/clash.yaml
  • 2ใ€ไฝฟ็”จ -i ๅ‚ๆ•ฐๆŒ‡ๅฎšๆฃ€ๆŸฅ้—ด้š”ๆ—ถ้—ด, TPClash ไผšๆŒ‰็…ง่ฟ™ไธชๆ—ถ้—ด้ข‘็Ž‡ๅŽปๆฃ€ๆŸฅ่ฟœ็จ‹้…็ฝฎๆ˜ฏๅฆไธŽๆœฌๅœฐไธ€่‡ด, ไธไธ€่‡ดๅˆ™ๆ›ดๆ–ฐๅนถ่‡ชๅŠจ้‡่ฝฝ
  • 3ใ€ไฝฟ็”จ --http-header ๅ‚ๆ•ฐ่ฎพ็ฝฎไธ‹่ฝฝ่ฟœ็จ‹้…็ฝฎ็š„ http ่ฏทๆฑ‚ๅคด, ็”จไบŽๆ”ฏๆŒไธ‹่ฝฝๅ…ฌ็ฝ‘ๅธฆ่ฎค่ฏ็š„ๆ‰˜็ฎก้…็ฝฎ, ไพ‹ๅฆ‚ --http-header "Authorization=Basic YWRtaW46MTIz"
  • 4ใ€ไฝฟ็”จ --config-password ๅ‚ๆ•ฐ่ฎพ็ฝฎ้…็ฝฎๆ–‡ไปถ็š„ๅฏ†็ , ๆ”นๅฏ†็ ็”จไบŽ่งฃๅฏ†้…็ฝฎๆ–‡ไปถ, ไธป่ฆ็”จไบŽๅฐ†้…็ฝฎๆ–‡ไปถๅญ˜ๅ‚จๅœจๅฏๅ…ฌๅ…ฑ่ฎฟ้—ฎ็š„ๅœฐๅ€(้˜ฒๆญขๆณ„ๅฏ†)

ๆณจๆ„: ๅฆ‚ๆžœ่ฟœ็จ‹้…็ฝฎไฟฎๆ”นไบ†็ซฏๅฃ็ญ‰้…็ฝฎ, ้‚ฃไนˆไป้œ€่ฆ้‡ๆ–ฐๅฏๅŠจ TPClash, ๅ› ไธบ TPClash ้‡่ฝฝๆ— ๆณ•็…ง้กพๅˆฐๅบ•ๅฑ‚็š„็ซฏๅฃๅ˜ๆ›ด.

4.2ใ€ไฝฟ็”จๅŠ ๅฏ†็š„้…็ฝฎๆ–‡ไปถ

ไปŽ v0.1.6 ็‰ˆๆœฌๅผ€ๅง‹ๆ”ฏๆŒ้…็ฝฎๆ–‡ไปถๅŠ ๅฏ†, ็Žฐๅœจๅฏไปฅไฝฟ็”จไปฅไธ‹ๅ‘ฝไปคๅฏนๆ˜Žๆ–‡็š„ yaml ้…็ฝฎ่ฟ›่กŒๅŠ ๅฏ†:

./tpclash enc --config-password YOUR_PASSWORD clash.yaml

ๅŠ ๅฏ†ๅฎŒๆˆๅŽๅฐ†ๅœจๆœฌๅœฐ็”Ÿๆˆไธ€ไธช่ขซๅŠ ๅฏ†่ฟ‡็š„ clash.yaml.enc ๆ–‡ไปถ, ่ฏฅๆ–‡ไปถๅฏไปฅ็›ดๆŽฅๆ‰˜็ฎกๅˆฐไปปไฝ•ๅฏๅ…ฌๅ…ฑ่ฎฟ้—ฎ็š„ http ๅœฐๅ€(ไนŸๅฏไปฅๆœฌๅœฐไฝฟ็”จ).

ๅฝ“ TPClash ๆŒ‡ๅฎšไบ†่ฟœ็จ‹ http ้…็ฝฎ, ๅŒๆ—ถ --config-password ้€‰้กนไธไธบ็ฉบ็š„ๆƒ…ๅ†ตไธ‹, ๅˆ™่ฎคไธบ่ฟœ็จ‹ๅœฐๅ€็š„้…็ฝฎๆ–‡ไปถๆ˜ฏ่ขซๅŠ ๅฏ†็š„, TPClash ๅฐ†ไผš่‡ชๅŠจๅฎŒๆˆ่งฃๅฏ†ๅนถๅŠ ่ฝฝ:

./tpclash --config-password YOUR_PASSWORD -c https://exmaple.com/clash.yaml.enc

4.3ใ€ไฝฟ็”จๆจก็‰ˆๅผ•ๆ“Ž

ไธบไบ†ๅบ”ๅฏนๅ•้…็ฝฎๆ–‡ไปถๅคšๅฎžไพ‹็š„้ƒจ็ฝฒๆƒ…ๅ†ต, TPClash ๅ†…็ฝฎไบ†ไธ€ไบ›ๆจก็‰ˆๅ‡ฝๆ•ฐ, ่ฟ™ไบ›ๅ‡ฝๆ•ฐๅฏไปฅ่พ…ๅŠฉ้…็ฝฎ็”ŸๆˆๅฎŒๆˆ่‡ชๅŠจๅŒ–้…็ฝฎ:

  • {{IfName}}: ่‡ชๅŠจ่งฃๆžไธบๅฝ“ๅ‰ไธปๆœบ็š„ไธป็ฝ‘ๅก
  • {{DefaultDNS}}: ่‡ชๅŠจ่Žทๅ–ๅฝ“ๅ‰ไธปๆœบ้ป˜่ฎค็š„ไธŠๆธธ DNS

ๆจก็‰ˆๅ‡ฝๆ•ฐๅฏ่ƒฝ้šๅŽ็ปญๆ›ดๆ–ฐ็ปง็ปญๆทปๅŠ , ไฝฟ็”จๆ–นๆณ•่ฏทๅ‚่€ƒ้กน็›ฎๅ†…็š„ example.yaml ้…็ฝฎ.

4.4ใ€Premium Tracing

ไปŽ v0.1.8 ็‰ˆๆœฌๅผ€ๅง‹ๆไพ› Premium ๆ ธๅฟƒ็š„ Tracing Dashboard ่‡ชๅŠจ้ƒจ็ฝฒ, ๆญคๅŠŸ่ƒฝ้œ€่ฆๅฎฟไธปๆœบๅฎ‰่ฃ…ๆœ‰ Docker, TPClash ไผš่ฐƒ็”จ Docker API ่‡ชๅŠจๅˆ›ๅปบๅฎนๅ™จ.

ๅฏนไบŽ้‡‡็”จ Systemd ้ƒจ็ฝฒ็š„็”จๆˆท, ๅฎฟไธปๆœบๅฎ‰่ฃ…ๅฅฝ Docker ๅŽๆ— ้œ€ๅ…ถไป–็‰นๆฎŠๆ“ไฝœ; ๅฏนไบŽ้‡‡็”จ Docker ้ƒจ็ฝฒ็š„็”จๆˆท, ้œ€่ฆๅขžๅŠ ไธ€ไธชๆŒ‚่ฝฝ:

docker run -dt \
  --name tpclash \
  --privileged \
  --network=host \
  -v /root/clash.yaml:/etc/clash.yaml \
+ -v /var/run/docker.sock:/var/run/docker.sock \
  mritd/tpclash

็„ถๅŽ้œ€่ฆๅœจ้…็ฝฎๆ–‡ไปถไธญๅผ€ๅฏ Tracing:

profile:
    tracing: true

ๆœ€ๅŽๅฏๅŠจ TPClash ๆ—ถๅขžๅŠ  Tracing ้€‰้กนๅณๅฏ:

./tpclash-premium-linux-amd64-v3 --enable-tracing -c /etc/clash.yaml

ๅฏๅŠจๅฎŒๆˆๅŽๅฏ่ฎฟ้—ฎ http://TPCLASH_IP:3000 ๆŸฅ็œ‹ Tracing Dashboard, ๅ…ถ้ป˜่ฎค่ดฆๆˆทๅฏ†็ ๅ‡ไธบ admin.

ไบ”ใ€TPClash ๅšไบ†ไป€ไนˆ

TPClash ๅœจๅฏๅŠจๅŽไผš่ฟ›่กŒๅฆ‚ไธ‹ๅŠจไฝœ:

  • 1ใ€ๅˆ›ๅปบ /data/clash ็›ฎๅฝ•(ๅฏ่‡ช่กŒๆŒ‡ๅฎšๆˆๅ…ถไป–็›ฎๅฝ•), ๅนถๅฐ†ๅ…ถไฝœไธบ Clash ็š„ Home Dir
  • 2ใ€ๅฐ† Clash ไบŒ่ฟ›ๅˆถๆ–‡ไปถใ€Dashboard(ๅฎ˜ๆ–น+yacd)ใ€ๅฟ…่ฆ็š„ rulesetใ€Country.mmdb ้‡Šๆ”พๅˆฐ /data/clash ็›ฎๅฝ•
  • 3ใ€ไปŽๆœฌๅœฐๆˆ–่ฟœ็จ‹่ฏปๅ–้…็ฝฎ, ่ฟ›่กŒๆจก็‰ˆ่งฃๆžๅŽๅคๅˆถๅˆฐ /data/clash/xclash.yaml
  • 4ใ€ๅฏๅŠจๅฎ˜ๆ–น็š„ Clash, ๅนถ่ฎพ็ฝฎๅฟ…่ฆๅ‚ๆ•ฐ, ๆฏ”ๅฆ‚ -ext-uiใ€-d ็ญ‰
  • 5ใ€้€‰ๆ‹ฉๆ€ง่ฟ›่กŒ็ฝ‘็ปœ้…็ฝฎ, ไพ‹ๅฆ‚ไธบ Docker ็”จๆˆท่‡ชๅŠจ่ฎพ็ฝฎ nftables
  • 6ใ€ๅœจๅŽๅฐๆŒ็ปญ็›‘่ง†ๆœฌๅœฐๆˆ–่ฟœ็จ‹้…็ฝฎๆ–‡ไปถๅ˜ๅŠจ, ็„ถๅŽ่‡ชๅŠจ้‡่ฝฝ

ๅ…ญใ€ๅฆ‚ไฝ•็ผ–่ฏ‘ TPClash

็”ฑไบŽ TPClash ๆ˜ฏไธ€ไธช้›†ๆˆๅทฅๅ…ท, ๆ‰€ไปฅๅœจ็ผ–่ฏ‘ๅ‰่ฏทๅฎ‰่ฃ…ๅฅฝไปฅไธ‹ๅทฅๅ…ท้“พ:

  • git
  • curl
  • jq
  • tar
  • gzip
  • nodejs(็”จไบŽ็ผ–่ฏ‘ Dashboard)
  • pnpm(Dashboard ็ผ–่ฏ‘ๆ‰€้œ€ไพ่ต–ๅทฅๅ…ท, ๅฏ้€š่ฟ‡ npm i -g xxx ๅฎ‰่ฃ…)
  • golang 1.20+
  • go-task(็ฑปไผผ Makefile ็š„ๆ›ฟไปฃๅทฅๅ…ท)

TPClash ้กน็›ฎๅ†…็š„ Taskfile.yaml ๅ†…ๅทฒ็ปๅ†™ๅฅฝไบ†่‡ชๅŠจ็ผ–่ฏ‘่„šๆœฌ, ๅช้œ€่ฆๆ‰ง่กŒ task ๅ‘ฝไปคๅณๅฏ:

git clone https://github.com/mritd/tpclash.git
cd tpclash
task # go-task ๅฎ‰่ฃ…ๆˆๅŠŸๅŽไผšๅŒ…ๅซๆญคๅ‘ฝไปค

ๅ…ถไป–้ซ˜็บง็ผ–่ฏ‘(ไพ‹ๅฆ‚ๅ•็‹ฌ็ผ–่ฏ‘็‰นๅฎšๅนณๅฐ)่ฏทๆ‰ง่กŒ task --list ๆŸฅ็œ‹.

ไธƒใ€ๅ…ถไป–่ฏดๆ˜Ž

TPClash ้ป˜่ฎค้‡Šๆ”พ็š„ๆ–‡ไปถๅŒ…ๅซไบ† Loyalsoldier/clash-rules ็›ธๅ…ณๆ–‡ไปถ, ๅฏๅœจ่ง„ๅˆ™ไธญ็›ดๆŽฅไฝฟ็”จ;

TPClash ๅŒๆ—ถไนŸ้‡Šๆ”พไบ† Hackl0us/GeoIP2-CN ้กน็›ฎ็š„ Country.mmdb ๆ–‡ไปถ, ่ฏฅ GeoIP ๆ•ฐๆฎๅบ“ ไป…ๅŒ…ๅซไธญๅ›ฝๅคง้™†ๅœฐๅŒบ IP, ๆ‰€ไปฅๅฆ‚ๆžœไฝฟ็”จ GEOIP,US,PROXY ็ญ‰ๅ…ถไป–ๅ›ฝๅฎถ่ง„ๅˆ™ไผšๅคฑ่ดฅ.

ๅ…ซใ€ๅฎ˜ๆ–น่ฎจ่ฎบ็พค

Telegram: https://t.me/tpclash

More Repositories

1

dockerfile

some personally made dockerfile
HTML
2,070
star
2

mmh

Nothing, just a simple ssh tool.
Go
325
star
3

gitflow-toolkit

A simple toolkit for GitFlow.
Go
215
star
4

idgen

ไธ€ไธชไฝฟ็”จ golang ็ผ–ๅ†™็š„ๅคง้™†่บซไปฝ่ฏ็”Ÿๆˆๅ™จ
Go
183
star
5

imgsync

Docker image sync tool.
Go
135
star
6

docker-library

kubernetes ็›ธๅ…ณ images ๅŒๆญฅ
Dockerfile
127
star
7

shell_scripts

ๅธธ็”จ็š„ไธ€ไบ› shell ่„šๆœฌ
Shell
125
star
8

composes

ๅธธ็”จ็š„ docker-compose ๆ–‡ไปถ
Smarty
110
star
9

gcr

Google container registry sync repo
107
star
10

rime

Rime config
88
star
11

bubbles

TUI components for Bubble Tea(Similar to the official bubbles ๐Ÿ˜Š)
Go
82
star
12

ginmvc

Gin mvc template
Go
53
star
13

goadmission

Go
33
star
14

koolshare-gdddns

koolshare ๅ›บไปถ Godaddy ddns ๆ’ไปถ
ASP
32
star
15

ktool

Shell
28
star
16

autobuild

Earthly Auto Build Repo
Earthly
25
star
17

mritd.me

ๅๅญ—่ทฏๅฃ,็นๅŽ่ก—ๅคด......
HTML
22
star
18

chinaid

China ID card and other information generation library(ไธญๅ›ฝๅคง้™†่บซไปฝ่ฏๅท็ญ‰ไฟกๆฏ็”Ÿๆˆๅบ“)
Go
16
star
19

wol

A simple WOL tool(ไธ€ไธช็ฎ€ๅ•ๅœฐๅ‘ฝไปค่กŒ WOL ๅทฅๅ…ท)
Go
16
star
20

s2h

A simple tool to convert socket5 proxy protocol to http proxy protocol
Go
13
star
21

touchid

macOS touchid authentication library
Go
9
star
22

promptx

A simple terminal prompt library
Go
9
star
23

swns

A simple plugin for kubectl to switch current context namespace.
Go
7
star
24

SSLCertTool

ไธ€ไธช็”จไบŽ็”Ÿๆˆ Java SSL ไฟกไปปๆ–‡ไปถ็š„ๅฐๅทฅๅ…ท,็”จไบŽๅฐ†ๆŒ‡ๅฎšๅœฐๅ€ SSL ่ฏไนฆๅŠ ๅ…ฅๅˆฐ Java ไฟกไปปๅˆ—่กจไธญ
Java
6
star
25

pre-receive

A simple gitlab commit message check hook.
Go
6
star
26

etcd-pack

build the deb package for etcd.
Shell
6
star
27

ddns

ไธ€ไธช go ็ผ–ๅ†™็š„็ฎ€ๅ•ๅœฐ DDNS ๅทฅๅ…ท, ็›ฎๅ‰ๆ”ฏๆŒ gandiใ€godaddyใ€namecom.
Go
6
star
28

consul-rpm

consul rpm
Shell
6
star
29

manjaro-rpi4

build manjaro system img for rpi4
Shell
5
star
30

poetbot

Telegram auto change name bot.
Go
5
star
31

init

Shell
5
star
32

tgsend

ไธ€ไธช Telegram ๆŽจ้€็š„ๅฐๅทฅๅ…ท๏ผŒ็”จไบŽ่ฐƒ็”จ Bot API ๅ‘้€ๅ‘Š่ญฆ็ญ‰
Go
5
star
33

csi-archetype

kubernetes csi archetype
Go
5
star
34

ttsoft-gdddns

Koolshare Tomato ๅ›บไปถ่ฝฏไปถไธญๅฟƒ Godaddy DDNS ๆ’ไปถ
Shell
4
star
35

GitLabCI-TestProject

GitLabCI-TestProject
Java
4
star
36

mritd.com

่ฟ™ๆ˜ฏไธชไบบๅšๅฎข็š„ๅทฒๅ‘ๅธƒ้™ๆ€ๆ–‡ไปถไป“ๅบ“
HTML
3
star
37

kube-apiserver-proxy-pack

kubernetes api server proxy tool
Shell
3
star
38

crxdl

A simple chrome crx download tool
JavaScript
3
star
39

cfssl-pack

The cfssl installation package is built by makeself.
Shell
3
star
40

sshutils

ssh utils
Go
3
star
41

kubeadm-config-pack

kubeadm config
Shell
3
star
42

pd

ไธ€ไธช็ฎ€ๅ•็š„ Parallels Desktop ๅ‘ฝไปค่กŒ็š„ๅŒ…่ฃ…ๅทฅๅ…ท
Go
3
star
43

kubeadm-config

kubeadm config for set up Kubernetes HA cluster
Makefile
3
star
44

dnsacme

Simple tool to manage ACME Cert(Only Supported DNS-01)
Go
2
star
45

aidlock

Go
2
star
46

aidunlock

Go
2
star
47

SpringBootGracefulShutdownExample

Java
2
star
48

httpcmd

Run local commands via http
Go
2
star
49

etcdhosts-client

Client for coredns etcdhosts plugin
Go
2
star
50

caddybuilder

A simple build tool for caddy
Go
2
star
51

sgdict

ๆœ็‹—่ฏๅบ“่‡ชๅŠจๆŠ“ๅ–ๅนถ่ฝฌๆข RIME ๆ ผๅผๅทฅๅ…ท
Go
2
star
52

logger

Go
1
star
53

kubectl-plugins

kubectl custom plugins
Shell
1
star
54

bandwagonmon

Go
1
star
55

certmonitor

A simple website certificate monitor tool.
Go
1
star
56

linux-rpi4

rpi4 kernel
Shell
1
star
57

mmh-otp

simple otp command line tool
Go
1
star
58

httpprint

simple http request print tool
Go
1
star
59

DDNS_Tool

ๅŸบไบŽๅŸŸๅๆœๅŠกๅ•†็š„ DDNS ๅทฅๅ…ท
Java
1
star
60

toq

๐Ÿ˜‚๐Ÿ˜‚๐Ÿ˜‚
1
star
61

kubetool

Kubernetes toolkit.
Go
1
star
62

trojan-kubernetes

Kubernetes configuration templates for deploying trojan to a Kubernetes cluster.
1
star
63

socket2tcp

A simple tool for socket forwarding to remote tcp address
Go
1
star
64

dnsbot

Telegram Bot for etcdhosts
Go
1
star