Skip to content

Instantly share code, notes, and snippets.

@lddsb
Last active August 21, 2019 01:42
Show Gist options
  • Save lddsb/b041bb03a8c1295a77d00a5235636ec1 to your computer and use it in GitHub Desktop.
Save lddsb/b041bb03a8c1295a77d00a5235636ec1 to your computer and use it in GitHub Desktop.
run clash in docker
# 2018-10-11 00:15:14
#---------------------------------------------------#
## 配置文件需要放置在 $HOME/.config/clash/config.yml
#---------------------------------------------------#
# HTTP 代理端口
port: 7890
# SOCKS5 代理端口
socks-port: 7891
# Linux 和 macOS 的 redir 代理端口 (如需使用此功能,请取消注释)
# redir-port: 7892
# 允许局域网的连接(可用来共享代理)
allow-lan: true
# 规则模式:Rule(规则) / Global(全局代理)/ Direct(全局直连)
mode: Rule
# 设置日志输出级别 (默认级别:info,级别越高日志输出量越大,越倾向于调试)
# 四个级别:info / warning / error / debug
log-level: info
# clash 的 RESTful API
external-controller: 127.0.0.1:9090
Proxy:
# shadowsocks
# 所支持的加密方式与 go-shadowsocks2 保持一致
# 支持加密方式: AEAD_AES_128_GCM AEAD_AES_192_GCM AEAD_AES_256_GCM AEAD_CHACHA20_POLY1305 AES-128-CTR AES-192-CTR AES-256-CTR AES-128-CFB AES-192-CFB AES-256-CFB CHACHA20-IETF XCHACHA20
# clash 额外支持 chacha20 rc4-md5 xchacha20-ietf-poly1305 加密方式
- name: 'ss1'
type: ss
server: 'your-server.com'
port: 2333
cipher: rc4-md5
password: 'your-password'
# vmess
# 支持加密方式:auto / aes-128-gcm / chacha20-poly1305 / none
# - { name: "vmess1", type: vmess, server: server, port: 443, uuid: uuid, alterId: 32, cipher: auto }
# - { name: "vmess2", type: vmess, server: server, port: 443, uuid: uuid, alterId: 32, cipher: auto, tls: true }
# socks5
# - { name: "socks", type: socks5, server: server, port: 443 }
Proxy Group:
# url-test 可以自动选择与指定 URL 测速后,延迟最短的服务器
- name: 'auto'
type: url-test
proxies:
- ss1
url: 'https://www.gstatic.com/generate_204'
interval: 300
# fallback 可以尽量按照用户书写的服务器顺序,在确保服务器可用的情况下,自动选择服务器
- name: 'fallback-auto'
type: fallback
proxies: ['ss1']
url: 'https://www.gstatic.com/generate_204'
interval: 300
# select 用来允许用户手动选择 代理服务器 或 服务器组
# 您也可以使用 RESTful API 去切换服务器,这种方式推荐在 GUI 中使用
- name: 'Proxy'
type: select
proxies:
- auto
- ss1
Rule:
# your rules
version: '3.7'
services:
clash:
image: clash/clash
restart: always
container_name: clash
volomes:
- ./config.yml:/root/.config/clash/config.yml
ports:
- 7890
- 7891
network_mode: "host"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment