> For the complete documentation index, see [llms.txt](https://surge.mitsea.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://surge.mitsea.com/rule/domain-based.md).

# 域名规则

共有三种基于域名的规则类型。

#### DOMAIN

`DOMAIN,www.apple.com,Proxy`

如果请求的域名完全匹配，则触发该规则。

#### DOMAIN-SUFFIX

`DOMAIN-SUFFIX,apple.com,Proxy`

如果请求的域名匹配该后缀，则触发该规则。例如：'google.com' 会匹配 '[www.google.com'、'mail.google.com](http://www.google.com'、'mail.google.com)' 和 'google.com'，但**不**匹配 'content-google.com'。

#### DOMAIN-KEYWORD

`DOMAIN-KEYWORD,google,Proxy`

如果请求的域名包含该关键字，则触发该规则。

#### DOMAIN-SET

专为大量域名设计，支持数千条记录的快速搜索。文件中的每一行都是一个域名，如果一行以 `.` 开头，则匹配所有子域名以及该域名本身。这可用于广告过滤。

### 基于域名的规则参数

#### extended-matching iOS 5.8.0+ Mac 5.4.0+

当启用此参数时，规则将尝试同时匹配 SNI 和 HTTP Host 请求头 (或 `:authority`)。

此参数仅适用于 `DOMAIN`、`DOMAIN-SUFFIX`、`DOMAIN-KEYWORD` 规则，你可以通过将该参数追加到相应的 `RULE-SET`/`DOMAIN-SET` 规则行，将其传播到 `DOMAIN-SET` 的条目中。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://surge.mitsea.com/rule/domain-based.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
