# 服务器插件

服务器插件接收来自客户端的请求，转交给可执行插件处理。可执行插件生成应答对应的请求。服务器插件将应答返回客户端。

可执行插件列表见：

{% content-ref url="/pages/VqNBFSilZJASwrqMIFlN" %}
[可执行插件](/mosdns-wiki/mosdns-v5/ru-he-pei-zhi-mosdns/ke-zhi-xing-cha-jian.md)
{% endcontent-ref %}

错误处理: 如果可执行插件抛出了错误，则服务器会返回 SEVFAIL 应答。

## udp\_server

初始化参数说明:

```yaml
tag: ""
type: "udp_server"
args:
  entry: executable_tag  # 可执行插件的 tag。
  listen: 127.0.0.1:5353 # 监听地址。
```

## tcp\_server

初始化参数说明:

```yaml
tag: ""
type: "tcp_server"
args:
  entry: executable_tag  # 可执行插件的 tag。
  listen: 127.0.0.1:5353 # 监听地址。
  cert: "./path/to/cert" # 配置 cert 和 key 后会启用 TLS (DoT)。
  key: "./path/to/key" 
  idle_timeout: 10       # 空连接超时。单位秒。默认 10。
```

(v5.3+) 监听地址以 @ 开头会监听 Unix abstract domain socket 。

## quic\_server

(实验性)

```yaml
tag: ""
type: "quic_server"
args:
  entry: executable_tag  # 可执行插件的 tag。
  listen: 127.0.0.1:853 # 监听地址。
  cert: "./path/to/cert"
  key: "./path/to/key" 
  idle_timeout: 30       # 空连接超时。单位秒。默认 30。
```

## http\_server

初始化参数说明:

```yaml
tag: ""
type: "http_server"
args:
  entries:                 # []extry
    - path: /dns-query     # 本路径执行   
      exec: executable_tag # 可执行插件的 tag。  
  src_ip_header: "X-Forwarded-For"  # 从 HTTP 头获取用户 IP。
  listen: 127.0.0.1:443  # 监听地址。
  cert: "./path/to/cert" # 留空 cert 和 key 后会禁用 TLS。
  key: "./path/to/key" 
  idle_timeout: 10       # 空连接超时。单位秒。默认 30。
```

(v5.3+) 监听地址以 @ 开头会监听 Unix abstract domain socket 。


---

# Agent Instructions: 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:

```
GET https://irine-sistiana.gitbook.io/mosdns-wiki/mosdns-v5/ru-he-pei-zhi-mosdns/fu-wu-qi-cha-jian.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
