关于Clash二三事


一、关于Clash

1、Clash是一个支持多平台的代理工具,功能强大且支持多种代理协议,如Shadowsocks(SS)、ShadowsocksR(SSR)、Socks、Snell、V2Ray、Trojan等代理协议,遗憾的是原版不支持新的协议比如vless等。

项目地址:Github

2、Windows客户端推荐:Clash for Windows,项目地址:Github,不支持vless;

3、Android客户端推荐:Clash For Android,项目地址:Github,不支持vless;Clash Meta For Android,项目地址:Github,支持vless协议;

4、IOS客户端推荐:Stash,须在美区APP Store购买,价格:3.99美元。TG讨论组:https://t.me/stashnetworks

二、关于Meta内核

在IOS移动端我们有Stash,安卓移动端有Clash Meta For Android这种原生支持vless的工具,而在桌面端上我们想用Clash使用vless协议就只能手动更换Clash Meta内核。

Meta项目地址:Github

将下载的内核解压并重命名为clash-win64.exe 然后将Clash for windows安装目录下的内核覆盖即可。

默认内核文件路径:\Clash for windows\resources\static\files\win\x64

32位系统自行选择对应文件下和路径载和替换。

三、Clash 规则写法

1、Hysteria 规则(Meta专属)

- name: "hysteria"
    type: hysteria
    server: server.com
    port: 443
    auth_str: yourpassword
    #obfs: yourpassword
    alpn: h3
    protocol: udp #支持udp/wechat-video/faketcp
    up: '30 Mbps' #若不写单位,默认为Mbps
    down: '200 Mbps' #若不写单位,默认为Mbps
    #sni: server.com
    #skip-cert-verify: false
    #recv_window_conn: 12582912
    #recv_window: 52428800
    #auth_str: "yubiyubi"
    #ca: "./my.ca"
    #ca_str: "xyz"
    #disable_mtu_discovery: false

2、Vless 规则(Meta专属)

- name: "vless-tcp"
    type: vless
    server: server
    port: 443
    uuid: uuid
    network: tcp
    servername: example.com # AKA SNI
    # flow: xtls-rprx-direct # xtls-rprx-origin # enable XTLS
    # skip-cert-verify: true

- name: "vless-ws"
    type: vless
    server: server
    port: 443
    uuid: uuid
    udp: true
    tls: true
    network: ws
    servername: example.com # priority over wss host
    # skip-cert-verify: true
    ws-opts:
      path: "/"
      headers:
      Host: example.com

- name: vless-reality-vision                  # 可以自定义节点名称
    type: vless
    server: 1.2.3.4                             # 解析的域名或IP
    port: 12345                                 # 自定义端口
    uuid: f897325d-053d-45d1-899c-566692331f8   # 自定义 UUID
    network: tcp
    udp: true
    tls: true
    flow: xtls-rprx-vision
    servername: sega.com                        # 自定义回落域名
    reality-opts: 
      public-key: 4CiE7y7ZPBXIZWzMwphuSH7qdZyisNjD3CDQGjmilmI    # Reality public-key
      short-id: a8c031ce                        # Reality short-id
    client-fingerprint: chrome                  # 自定义浏览器指纹
 
- name: vless-reality-grpc                      # 可以自定义节点名称
    type: vless
    server: 1.2.3.4                               # 解析的域名或IP
    port: 12345                                   # 自定义端口
    uuid: 335ec5dd-61b1-4413-980e-5e009968f633    # 自定义 UUID
    network: grpc
    tls: true
    udp: true
    flow:
    client-fingerprint: chrome                    # 自定义浏览器指纹
    servername: sega.com                          # 自定义回落域名
    grpc-opts:
      grpc-service-name: "misaka"                 # 自定义的字符
    reality-opts:
      public-key: Aqp9oy2EFi4NNfRMZa3I3HdGhHbOIiSDZ8L28UCF73k    # Reality public-key
      short-id: 24410d1c                          # Reality short-id
 
- name: vless-xtls-rprx-vision                 # 可以自定义节点名称
    type: vless
    server: www.misaka.rest                      # 解析的域名
    port: 12345                                  # 自定义端口
    uuid: 5f74f86b-3ee8-44f4-adc4-6666be3d315    # 自定义 UUID
    network: tcp
    tls: true
    udp: true
    flow: xtls-rprx-vision
    client-fingerprint: chrome

3、Vmess规则

# 加密支持 auto/aes-128-gcm/chacha20-poly1305/none
- name: "vmess"
    type: vmess
    server: server
    port: 443
    uuid: uuid
    alterId: 32
    cipher: auto
    # udp: true
    # tls: true
    # skip-cert-verify: true
    # servername: example.com # priority over wss host
    # network: ws
    # ws-opts:
    # path: /path
    # headers:
    # Host: v2ray.com
    # max-early-data: 2048
    # early-data-header-name: Sec-WebSocket-Protocol

- name: "vmess-h2"
    type: vmess
    server: server
    port: 443
    uuid: uuid
    alterId: 32
    cipher: auto
    network: h2
    tls: true
    h2-opts:
      host:
        - http.example.com
        - http-alt.example.com
    path: /

- name: "vmess-http"
    type: vmess
    server: server
    port: 443
    uuid: uuid
    alterId: 32
    cipher: auto
    # udp: true
    # network: http
    # http-opts:
      # # method: "GET"
      # # path:
      # # - '/'
      # # - '/video'
      # # headers:
      # # Connection:
      # # - keep-alive

- name: vmess-grpc
    server: server
    port: 443
    type: vmess
    uuid: uuid
    alterId: 32
    cipher: auto
    network: grpc
    tls: true
    servername: example.com
    # skip-cert-verify: true
    grpc-opts:
      grpc-service-name: "example"

4、Shadowsocks规则

# 加密支持:
# aes-128-gcm aes-192-gcm aes-256-gcm
# aes-128-cfb aes-192-cfb aes-256-cfb
# aes-128-ctr aes-192-ctr aes-256-ctr
# rc4-md5 chacha20-ietf xchacha20
# chacha20-ietf-poly1305 xchacha20-ietf-poly1305
#【Meta专属】支持SS2022加密:
# 2022-blake3-aes-128-gcm
# 2022-blake3-aes-256-gcm
# 2022-blake3-chacha20-poly1305
- name: "ss1"
    type: ss
    server: server
    port: 443
    cipher: chacha20-ietf-poly1305
    password: "password"
    # udp: true

- name: "ss2"
    type: ss
    server: server
    port: 443
    cipher: chacha20-ietf-poly1305
    password: "password"
    plugin: obfs
    plugin-opts:
      mode: tls # or http
      # host: bing.com

- name: "ss3"
    type: ss
    server: server
    port: 443
    cipher: chacha20-ietf-poly1305
    password: "password"
    plugin: v2ray-plugin
    plugin-opts:
    mode: websocket # no QUIC now
    # tls: true # wss
    # skip-cert-verify: true
    # host: bing.com
    # path: "/"
    # mux: true
    # headers:
    # custom: value

5、Trojan规则

- name: "trojan"
    type: trojan
    server: server
    port: 443
    password: password
    # udp: true
    # sni: example.com # aka server name
    # alpn:
    # - h2
    # - http/1.1
    # skip-cert-verify: true

- name: trojan-grpc
    server: server
    port: 443
    type: trojan
    password: "example"
    network: grpc
    sni: example.com
    # skip-cert-verify: true
    udp: true
    grpc-opts:
      grpc-service-name: "example"

- name: trojan-ws
    server: server
    port: 443
    type: trojan
    password: "example"
    network: ws
    sni: example.com
    # skip-cert-verify: true
    udp: true
    # ws-opts:
      # path: /path
      # headers:
      # Host: example.com

6、其他协议规则

# socks5
- name: "socks"
    type: socks5
    server: server
    port: 443
    # username: username
    # password: password
    # tls: true
    # skip-cert-verify: true
    # udp: true

# http
- name: "http"
    type: http
    server: server
    port: 443
    # username: username
    # password: password
    # tls: true # https
    # skip-cert-verify: true
    # sni: custom.com
    # headers: #【Meta专属】
    # X-T5-Auth: "1962xxxxx709"
    # User-Agent: "okhttp/3.11.0 Dalvik/2.1.0 ...... "

# Snell
# 不支持UDP
- name: "snell"
    type: snell
    server: server
    port: 44046
    psk: yourpsk
    # version: 2
    # obfs-opts:
    # mode: http # or tls
    # host: bing.com

声明:科先森's Blog|版权所有,违者必究|如未注明,均为原创|本网站采用BY-NC-SA协议进行授权

转载:转载请注明原文链接 - 关于Clash二三事


一个小白的记录