dulli / caddy-wol

Caddy plugin that sends wake-on-lan magic packets to remote hosts to wake up e.g. reverse proxy targets.
Apache License 2.0
27 stars 5 forks source link

Error at start #6

Closed bibitocarlos closed 1 year ago

bibitocarlos commented 1 year ago

Hi,

Thanks for your Caddy module. I get this error at launch, any idea :

Error: adapting config using caddyfile: parsing caddyfile tokens for 'order': /etc/caddy/Caddyfile:17 - Error during parsing: wake_on_lan is not a registered directive

My caddyfile

{ order wake_on_lan before respond } jellyfin.bibitocarlos.eu { reverse_proxy 192.168.1.11:8096 handle_errors { @502 expression {err.status_code} == 502 handle @502 { wake_on_lan 70:85:c2:83:63:f5 reverse_proxy 192.168.1.11:8096 { lb_try_duration 120s } } } log { output file /var/log/caddy/access.log format console } header { Strict-Transport-Security "max-age=63072000;includeSubDomains;preload" X-Content-Type-Options nosniff X-XSS-Protection "1;mode=block" X-Robots-Tag none Content-Security-Policy "upgrade-insecure-requests" Cache-Control "public, max-age=15, must-revalidate" X-Frame-Options SAMEORIGIN Referrer-Policy no-referrer Permissions-Policy "geolocation=(self), microphone=()" } }

bibitocarlos commented 1 year ago

caddy-wol install `xcaddy build \ --with github.com/dulli/caddy-wol 2023/05/12 19:10:28 [INFO] Temporary folder: /tmp/buildenv_2023-05-12-1910.3605085705 2023/05/12 19:10:28 [INFO] Writing main module: /tmp/buildenv_2023-05-12-1910.3605085705/main.go package main

import ( caddycmd "github.com/caddyserver/caddy/v2/cmd"

// plug in Caddy modules here
_ "github.com/caddyserver/caddy/v2/modules/standard"
_ "github.com/dulli/caddy-wol"

)

func main() { caddycmd.Main() } 2023/05/12 19:10:28 [INFO] Initializing Go module 2023/05/12 19:10:28 [INFO] exec (timeout=-2562047h47m16.854775808s): /usr/local/go/bin/go mod init caddy go: creating new go.mod: module caddy go: to add module requirements and sums: go mod tidy 2023/05/12 19:10:28 [INFO] Pinning versions 2023/05/12 19:10:28 [INFO] exec (timeout=-2562047h47m16.854775808s): /usr/local/go/bin/go get -d -v github.com/caddyserver/caddy/v2 go: added github.com/beorn7/perks v1.0.1 go: added github.com/caddyserver/caddy/v2 v2.6.4 go: added github.com/caddyserver/certmagic v0.17.2 go: added github.com/cespare/xxhash/v2 v2.1.2 go: added github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 go: added github.com/golang/mock v1.6.0 go: added github.com/golang/protobuf v1.5.2 go: added github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 go: added github.com/google/uuid v1.3.0 go: added github.com/klauspost/cpuid/v2 v2.2.3 go: added github.com/libdns/libdns v0.2.1 go: added github.com/matttproud/golang_protobuf_extensions v1.0.1 go: added github.com/mholt/acmez v1.1.0 go: added github.com/miekg/dns v1.1.50 go: added github.com/onsi/ginkgo/v2 v2.2.0 go: added github.com/prometheus/client_golang v1.14.0 go: added github.com/prometheus/client_model v0.3.0 go: added github.com/prometheus/common v0.37.0 go: added github.com/prometheus/procfs v0.8.0 go: added github.com/quic-go/qpack v0.4.0 go: added github.com/quic-go/qtls-go1-18 v0.2.0 go: added github.com/quic-go/qtls-go1-19 v0.2.0 go: added github.com/quic-go/qtls-go1-20 v0.1.0 go: added github.com/quic-go/quic-go v0.32.0 go: added go.uber.org/atomic v1.9.0 go: added go.uber.org/multierr v1.6.0 go: added go.uber.org/zap v1.24.0 go: added golang.org/x/crypto v0.5.0 go: added golang.org/x/exp v0.0.0-20221205204356-47842c84f3db go: added golang.org/x/mod v0.6.0 go: added golang.org/x/net v0.7.0 go: added golang.org/x/sys v0.5.0 go: added golang.org/x/term v0.5.0 go: added golang.org/x/text v0.7.0 go: added golang.org/x/tools v0.2.0 go: added google.golang.org/protobuf v1.28.1 2023/05/12 19:10:31 [INFO] exec (timeout=-2562047h47m16.854775808s): /usr/local/go/bin/go get -d -v github.com/dulli/caddy-wol github.com/caddyserver/caddy/v2 go: added github.com/dulli/caddy-wol v1.0.0 go: upgraded github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 => v0.0.0-20210720184732-4bb14d4b1be1 2023/05/12 19:10:35 [INFO] exec (timeout=-2562047h47m16.854775808s): /usr/local/go/bin/go get -d -v
2023/05/12 19:10:39 [INFO] Build environment ready 2023/05/12 19:10:39 [INFO] Building Caddy 2023/05/12 19:10:39 [INFO] exec (timeout=-2562047h47m16.854775808s): /usr/local/go/bin/go mod tidy 2023/05/12 19:10:39 [INFO] exec (timeout=-2562047h47m16.854775808s): /usr/local/go/bin/go build -o /home/pi/caddy -ldflags -w -s -trimpath 2023/05/12 19:10:44 [INFO] Build complete: ./caddy 2023/05/12 19:10:44 [INFO] Cleaning up temporary folder: /tmp/buildenv_2023-05-12-1910.3605085705 `

bibitocarlos commented 1 year ago

` caddy list-modules ... Standard modules: 100

http.handlers.wake_on_lan

Non-standard modules: 1 `

bibitocarlos commented 1 year ago

Ok, i made it worked, on a pi :

dulli commented 1 year ago

Thanks for the update and great to hear that you got it to work for you!