Regular Usage Mode#
Clash Client Usage Process#
- Purchase a subscription and obtain the subscription address.
- Configure the Clash client subscription.
- Configure the Clash client rules (usually not necessary, as the purchased subscription address will come with rule information).
- Start the Clash client.
- Specify the local port (usually the default for Clash client, such as 7890 or 7897).
Subscription Configuration Information
Subscription Node Information
Local Proxy Port Information
System Proxy Configuration Information
Clash client usually obtains multiple subscription nodes from the subscription address, but the client software will only use one of these nodes by default. The proxy process involves the client software generating a local port and exchanging data with the selected subscription node through that port. When we toggle the proxy switch in the client software, we are actually modifying the proxy configuration of the operating system to the local port address generated by the client, such as 7890. At this time, the proxy configuration in the operating system will be displayed as 127.0.0.1:7890.
The process of Clash proxy is as follows:
Operating system request -> Local port (7890 or 7897, specific port may vary depending on the client software) -> Clash client relay -> Clash node -> Blocked foreign website
This method is usually problem-free when using the Clash client for scientific internet access, but most of the subscribed nodes will be idle because Clash only selects one node for proxy access.
Expansion Ideas#
If we can implement a mechanism that converts all or some of the Clash subscription nodes into multiple local ports, with each port mapped to a different Clash node, then we can configure different proxies in different fingerprint browser environments, similar to purchasing multiple proxy IPs. This not only allows us to make full use of the subscribed nodes, but also increases the utilization of the nodes and reduces the cost of purchasing additional proxy IPs.
Observer Mode#
Clash provides a listener mode that can meet the above requirements without affecting the normal use of all functions of the Clash client. To achieve this, we need to make appropriate adjustments to the existing Clash client configuration based on the configuration file.
Obtain the Configuration File#
The following is an example, and the actual Clash client configuration obtained from different subscription addresses may vary, but it will include the following proxies
configuration section. We only need to focus on the configuration information in this section.
mixed-port: 7890
allow-lan: true
bind-address: '*'
mode: rule
log-level: info
external-controller: '127.0.0.1:9090'
dns:
enable: true
ipv6: false
default-nameserver: [223.5.5.5, 119.29.29.29]
enhanced-mode: fake-ip
fake-ip-range: 198.18.0.1/16
use-hosts: true
nameserver: ['https://doh.pub/dns-query', 'https://dns.alidns.com/dns-query']
fallback: ['https://doh.dns.sb/dns-query', 'https://dns.cloudflare.com/dns-query', 'https://dns.twnic.tw/dns-query', 'tls://8.8.4.4:853']
fallback-filter: { geoip: true, ipcidr: [240.0.0.0/4, 0.0.0.0/32] }
proxies:
- { name: 'China Hong Kong', type: ss, server: 2c1pxt70c3wovpi-mca.bgp.skin, port: 37007, cipher: aes-128-gcm, password: 7c83123b-dbce-4eaa-99d8-a5375e4a5e76, udp: true }
- { name: 'China Taiwan', type: ss, server: i4bmvbyi1qqmn86-mca.bgp.skin, port: 37007, cipher: aes-128-gcm, password: b12dbf40-b0f0-4ae7-b467-9770bbe417cc, udp: true }
- { name: 'Singapore', type: ss, server: 27yisychzummw6a-mca.bgp.skin, port: 37007, cipher: aes-128-gcm, password: bf01255e-7d99-4d19-bc04-f3d947d54687, udp: true }
- { name: 'Japan', type: ss, server: 2hjn0ex4v0wkush-mca.bgp.skin, port: 37007, cipher: aes-128-gcm, password: 9449285e-9301-429f-ab28-ffeb4c24e322, udp: true }
Each line in the proxies
configuration represents a node configuration. The field name name
is what we need to pay special attention to.
Add Node Listener Configuration#
mixed-port: 7890
allow-lan: true
bind-address: '*'
mode: rule
log-level: info
external-controller: '127.0.0.1:9090'
dns:
enable: true
ipv6: false
default-nameserver: [223.5.5.5, 119.29.29.29]
enhanced-mode: fake-ip
fake-ip-range: 198.18.0.1/16
use-hosts: true
nameserver: ['https://doh.pub/dns-query', 'https://dns.alidns.com/dns-query']
fallback: ['https://doh.dns.sb/dns-query', 'https://dns.cloudflare.com/dns-query', 'https://dns.twnic.tw/dns-query', 'tls://8.8.4.4:853']
fallback-filter: { geoip: true, ipcidr: [240.0.0.0/4, 0.0.0.0/32] }
proxies:
- { name: 'China Hong Kong', type: ss, server: 2c1pxt70c3wovpi-mca.bgp.skin, port: 37007, cipher: aes-128-gcm, password: 7c83123b-dbce-4eaa-99d8-a5375e4a5e76, udp: true }
- { name: 'China Taiwan', type: ss, server: i4bmvbyi1qqmn86-mca.bgp.skin, port: 37007, cipher: aes-128-gcm, password: b12dbf40-b0f0-4ae7-b467-9770bbe417cc, udp: true }
- { name: 'Singapore', type: ss, server: 27yisychzummw6a-mca.bgp.skin, port: 37007, cipher: aes-128-gcm, password: bf01255e-7d99-4d19-bc04-f3d947d54687, udp: true }
- { name: 'Japan', type: ss, server: 2hjn0ex4v0wkush-mca.bgp.skin, port: 37007, cipher: aes-128-gcm, password: 9449285e-9301-429f-ab28-ffeb4c24e322, udp: true }
listeners:
- {name: 'China Hong Kong Node Listener', type: mixed, port: 46001, proxy: 'China Hong Kong'}
- {name: 'China Taiwan Node Listener', type: mixed, port: 46002, proxy: 'China Taiwan'}
- {name: 'Singapore Node Listener', type: mixed, port: 46003, proxy: 'Singapore'}
- {name: 'Japan Node Listener', type: mixed, port: 46004, proxy: 'Japan'}
listeners:
listeners, which can listen to the specified nodes in the configuration and forward the traffic of the specified node to a local port. Each line represents a listener configuration for a node.name:
the name of the current listener (names must be unique)type:
mixed represents mixed typeport:
the local port for forwarding (port must not be in use)proxy:
the name of the proxy node to be listened to, which is thename
of a node inproxies
Reapply Configuration#
Apply the modified configuration file to the Clash client to take effect.
Verify Proxy Ports#
You can verify the proxy ports using one of the following three methods:
- Nmap
https://nmap.org/download.html
- Telnet
telnet localhost 44001
telnet localhost 44002
telnet localhost 44003
telnet localhost 44004
- Fingerprint Browser
Notes#
To disable the automatic refresh of subscriptions in the Clash client (to prevent accidental configuration loss), subscription information needs to be manually refreshed. Please note that after refreshing the subscription information, the previously modified configuration will be overwritten, so after manual refresh, manual configuration is required again. Currently, there are online tools available to help convert subscription configurations. You can copy and paste the listeners
section from the converted configuration into your own Clash configuration. This method is relatively simple. For example, you can use the following tool: https://www.kjfx.cc/c/socks.html