Skip to content

Commit

Permalink
Use YAML only.
Browse files Browse the repository at this point in the history
  • Loading branch information
sbruens committed Oct 16, 2024
1 parent 6763e8d commit ce8af88
Show file tree
Hide file tree
Showing 7 changed files with 534 additions and 182 deletions.
2 changes: 1 addition & 1 deletion caddy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ Prometheus metrics are available on http://localhost:9091/metrics.
From the repo's root directory, run the Caddy module directly from Go:

```sh
go run ./cmd/caddy run --config caddy/examples/config_example.json --watch
go run ./cmd/caddy run --adapter yaml --config caddy/examples/simple.yml --watch
```
145 changes: 0 additions & 145 deletions caddy/examples/config_example.json

This file was deleted.

36 changes: 22 additions & 14 deletions caddy/examples/simple.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,34 @@ apps:
- udp/[::]:9000
routes:
- handle:
- handler: shadowsocks
keys:
- id: user-0
cipher: chacha20-ietf-poly1305
secret: Secret0
- id: user-1
cipher: chacha20-ietf-poly1305
secret: Secret1
- handler: outline
connection_handler: ss1
'2':
listen:
- tcp/[::]:9001
- udp/[::]:9001
routes:
- handle:
- handler: shadowsocks
keys:
- id: user-2
cipher: chacha20-ietf-poly1305
secret: Secret2

- handler: outline
connection_handler: ss2
outline:
shadowsocks:
replay_history: 10000
connection_handlers:
- name: ss1
handle:
handler: shadowsocks
keys:
- id: user-0
cipher: chacha20-ietf-poly1305
secret: Secret0
- id: user-1
cipher: chacha20-ietf-poly1305
secret: Secret1
- name: ss2
handle:
handler: shadowsocks
keys:
- id: user-2
cipher: chacha20-ietf-poly1305
secret: Secret2
63 changes: 41 additions & 22 deletions caddy/examples/websocket.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,36 +34,55 @@ apps:
handle:
- disable_openmetrics: true
handler: metrics
'1':
listen:
- ":8000"
routes:
- match:
- path:
- "/tcp"
header:
Connection:
- "*Upgrade*"
Upgrade:
- websocket
handle:
- handler: ws2outline
type: stream
connection_handler: ss1
- match:
- path:
- "/udp"
header:
Connection:
- "*Upgrade*"
Upgrade:
- websocket
handle:
- handler: ws2outline
type: packet
connection_handler: ss1
layer4:
servers:
'1':
listen:
- tcp/[::]:9000
- udp/[::]:9000
routes:
- match:
- http:
- path:
- "/ws"
header:
Connection:
- "*Upgrade*"
Upgrade:
- websocket
handle:
- handler: websocket
- handler: shadowsocks
keys:
- id: user-1
cipher: chacha20-ietf-poly1305
secret: Secret1
- handle:
- handler: shadowsocks
keys:
- id: user-1
cipher: chacha20-ietf-poly1305
secret: Secret1

- handler: outline
connection_handler: ss1
outline:
shadowsocks:
replay_history: 10000
connection_handlers:
- name: ss1
handle:
handler: shadowsocks
keys:
- id: user-0
cipher: chacha20-ietf-poly1305
secret: Secret0
- id: user-1
cipher: chacha20-ietf-poly1305
secret: Secret1
1 change: 1 addition & 0 deletions cmd/caddy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

_ "github.com/Jigsaw-Code/outline-ss-server/caddy"
_ "github.com/caddyserver/caddy/v2/modules/standard"
_ "github.com/iamd3vil/caddy_yaml_adapter"
_ "github.com/mholt/caddy-l4"
_ "github.com/mholt/caddy-l4/layer4"
_ "github.com/mholt/caddy-l4/modules/l4http"
Expand Down
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require (
github.com/google/addlicense v1.1.1
github.com/google/go-licenses v1.6.0
github.com/goreleaser/goreleaser v1.18.2
github.com/iamd3vil/caddy_yaml_adapter v0.0.0-20200503183711-d479c29b475a
github.com/lmittmann/tint v1.0.5
github.com/mholt/caddy-l4 v0.0.0-20241012124037-5764d700c21c
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7
Expand Down Expand Up @@ -140,6 +141,7 @@ require (
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/fxamacker/cbor/v2 v2.6.0 // indirect
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 // indirect
github.com/go-chi/chi/v5 v5.0.12 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.5.0 // indirect
Expand Down Expand Up @@ -367,6 +369,7 @@ require (
gopkg.in/src-d/go-billy.v4 v4.3.2 // indirect
gopkg.in/src-d/go-git.v4 v4.13.1 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
howett.net/plist v1.0.0 // indirect
k8s.io/klog/v2 v2.110.1 // indirect
mvdan.cc/sh/v3 v3.7.0 // indirect
Expand Down
Loading

0 comments on commit ce8af88

Please sign in to comment.