Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/imgk/caddy-trojan
Caddy module for trojan proxy
https://github.com/imgk/caddy-trojan
caddy caddy-trojan trojan-gfw
Last synced: about 8 hours ago
JSON representation
Caddy module for trojan proxy
- Host: GitHub
- URL: https://github.com/imgk/caddy-trojan
- Owner: imgk
- License: gpl-3.0
- Created: 2020-10-15T01:09:22.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-01-08T03:23:37.000Z (10 days ago)
- Last Synced: 2025-01-10T20:09:51.367Z (7 days ago)
- Topics: caddy, caddy-trojan, trojan-gfw
- Language: Go
- Homepage:
- Size: 309 KB
- Stars: 208
- Watchers: 9
- Forks: 47
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Caddy-Trojan
## Build with xcaddy
```
$ xcaddy build --with github.com/imgk/caddy-trojan
```## Config (Caddyfile)
```
{
order trojan before file_server
servers :443 {
listener_wrappers {
trojan
}
}
trojan {
no_proxy
caddy
users pass1234 word5678
}
}
:443, example.com {
tls [email protected] #optional,recommended
trojan {
connect_method
websocket
}
file_server {
root /var/www/html
}
}
```
## Config (JSON)
```
{
"apps": {
"http": {
"servers": {
"srv0": {
"listen": [":443"],
"listener_wrappers": [{
"wrapper": "trojan"
}],
"routes": [{
"handle": [{
"handler": "trojan",
"connect_method": true,
"websocket": true
},
{
"handler": "file_server",
"root": "/var/www/html"
}]
}]
}
}
},
"trojan": {
"proxy": {
"proxy": "no_proxy"
},
"upstream": {
"upstream": "caddy"
},
"users": ["pass1234","word5678"]
},
"tls": {
"certificates": {
"automate": ["example.com"]
},
"automation": {
"policies": [{
"issuers": [{
"module": "acme",
"email": "[email protected]" //optional,recommended
},
{
"module": "acme",
"ca": "https://acme.zerossl.com/v2/DV90",
"email": "[email protected]" //optional,recommended
}]
}]
}
}
}
}
```## Manage Users
1. Add user.
```
curl -X POST -H "Content-Type: application/json" -d '{"password": "test1234"}' http://localhost:2019/trojan/users/add
```## Docker
```
git clone https://github.com/imgk/caddy-trojan
cd caddy-trojan/Dockerfiles
docker build -t caddy-trojan .
docker run --env MYPASSWD=MY_PASSWORD --env MYDOMAIN=MY_DOMAIN.COM -itd --name caddy-trojan --restart always -p 80:80 -p 443:443 caddy-trojan
```