[Q&A] some confusing points about TUN mode in the new version ab2f0ec

Open
#480 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
linux, shell
Domain
cli, networking

Research direction

Start by reproducing the reported behavior on commit ab2f0ec with clashoff, clashon, clashsub update, and clashstatus. Inspect the shell logic behind these commands and the interactive-shell http_proxy check; done means TUN state remains consistent after restarts and updates, and startup notifications match the selected mode.

Written by the indexing model from the issue text.

Description

documentation
前置确认
  • 我已查阅 常见问题,但仍未找到解决方案
  • 我已使用关键字查询相关 Issues,但仍未找到解决方案
使用的分支

master

Commit ID

ab2f0ec

Shell 环境

zsh

问题描述

[Q&A] some confusing points about TUN mode in the new version ab2f0ec

I recently upgraded to ab2f0ec from a version from about one year ago. There are a couple of unexpected things. I want to ask:

1. Assumptions

From what I understand mihomo has two modes, system-proxy and TUN. And it is recommended to only enable one mode and disable the other.

I have TUN mode on and system-proxy mode off.

2. TUN mode consistency questions

Image

Suppose system-proxy is off and TUN is on. If I restart clash by first running clashoff and then running clashon, TUN mode will be off.

A similar case occurs for TUN mode, after running clashsub update. TUN mode is on before running the command but off after running it.

In the last version I used, TUN mode behaves consistently (always on when set so). In the latest version (ab2f0ec), it is not. Is this intended or a bug?

In daily use, I have to turn off and on TUN mode manually in order to have "Internet access". When clashstatus returns three processes (like in step 3 in the above screenshot), it works. And when clashstatus returns only one process (like in step 7 in the above screenshot), it doesn't work. Why?

3. Repetitive start-of-interactive-shell notifications potentially related to TUN mode

Image

The script checks if http_proxy is empty. If it is, clashon is called.

It seems this logic only accounts for clashproxy mode, where http_proxy is non-empty; in clashtun mode, http_proxy is still empty, in which case I get the 已开启代理环境 notifications in every interactive shell session.

Is this intended or a bug?

Dominant language
Shell
Stars
15.2k
Forks
1.7k
Avg merge
1d 9h
Merged PRs (30d)
2

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nelvko/clashctl

All issues in nelvko/clashctl

Similar issues

More Shell/Bash issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.