2025-01-07 22:23:21 +00:00

46 lines
1.2 KiB
Go

package main
import (
"github.com/caddyserver/caddy/v2"
"github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
"github.com/caddyserver/caddy/v2/modules/caddyhttp"
//"github.com/rsp2k/caddy-websocket-proxy/telnetproxy" // Replace with your path
)
func init() {
caddy.RegisterModule(telnetproxy.TelnetProxy{})
}
// Caddyfile parsing for this module
func parseCaddyfile(h *caddyfile.Dispenser, _ interface{}) (interface{}, error) {
telnetProxy := new(telnetproxy.TelnetProxy)
for h.Next() {
if h.NextArg() {
return nil, h.ArgErr()
}
for h.NextBlock(0) {
switch h.Val() {
case "secret":
if !h.NextArg() {
return nil, h.ArgErr()
}
telnetProxy.Secret = h.Val()
default:
return nil, h.Errf("unknown subdirective: %s", h.Val())
}
}
}
return telnetProxy, nil
}
// Interface guards
var (
_ caddy.Module = (*telnetproxy.TelnetProxy)(nil)
_ caddyhttp.MiddlewareHandler = (*telnetproxy.TelnetProxy)(nil)
_ caddyfile.Unmarshaler = (*telnetproxy.TelnetProxy)(nil)
)
func main() {
caddy.Run()
}