Question: How do I write a module and directive to wrap net.Listener #3394
Labels
feature ⚙️
New feature or request
good first issue 🐤
Good for newcomers
question ❔
Help is being requested
Thank you so much for this project. I started playing with it over the weekend and decided to build custom modules and directives to simulate failures. It's made me excited to write code in my personal time all over again!
Background
I want to build a suite of modules that plug in to Caddy and allow it to inject failures for the purpose of testing failure recovery. For example, I would deploy a Caddy reverse proxy in front of some API and add directives to delay the response or rate limit agressively.
Question
The current problem I'm facing is that I've written a module that implements
caddy.ListenerWrapper
and injects a long pause before accepting connections. I want to have it controlled by a directive like somiasma_tarpit 10s
. I can't seem to understand how to usehttpcaddyfile.RegisterDirective
to register the directive. In particular, I'm not understanding what sort of []ConfigValue I should be returning. I'm not sure what value forClass
I should pass. Can you help understand what I'm doing wrong?Code
The module:
The text was updated successfully, but these errors were encountered: