介绍
在本章中, 我们将介绍 Clash 的常见功能以及如何使用和配置它们.
Clash 使用 YAML (YAML Ain't Markup Language) 作为配置文件格式. YAML 旨在易于阅读、编写和解析, 通常用于配置文件.
了解 Clash 的工作原理
在继续之前, 有必要了解 Clash 的工作原理, 其中有两个关键部分:
Inbound 入站
Inbound 入站是在本地端监听的部分, 它通过打开一个本地端口并监听传入的连接来工作. 当连接进来时, Clash 会查询配置文件中配置的规则, 并决定连接应该去哪个 Outbound 出站.
Outbound 出站
Outbound 出站是连接到远程端的部分. 根据配置的不同, 它可以是一个特定的网络接口、一个代理服务器或一个 策略组.
基于规则的路由
Clash 支持基于规则的路由, 这意味着您可以根据各种规则将数据包路由到不同的出站. 规则可以在配置文件的 rules 部分中定义.
有许多可用的规则类型, 每种规则类型都有自己的语法. 规则的一般语法是:
# 类型,参数,策略(,no-resolve)
TYPE,ARGUMENT,POLICY(,no-resolve)在下一步指南中, 您将了解有关如何配置规则的更多信息.
Introduction
In this chapter, we will introduce common Clash features and how to use and configure them.
Clash uses YAML (YAML Ain't Markup Language) as its configuration file format. YAML is designed to be easy to read, write, and parse, and is commonly used for configuration files.
How Clash Works
Before proceeding, it's important to understand how Clash works. There are two key parts:
Inbound
The Inbound is the part that listens locally. It works by opening a local port and listening for incoming connections. When a connection comes in, Clash queries the rules configured in the configuration file and decides which Outbound the connection should go to.
Outbound
The Outbound is the part that connects to the remote end. Depending on the configuration, it can be a specific network interface, a proxy server, or a policy group.
Rule-Based Routing
Clash supports rule-based routing, meaning you can route packets to different outbounds based on various rules. Rules can be defined in the rules section of the configuration file.
There are many rule types available, each with its own syntax. The general syntax for a rule is:
# TYPE,ARGUMENT,POLICY(,no-resolve)
TYPE,ARGUMENT,POLICY(,no-resolve)In the next guide, you will learn more about how to configure rules.