From d1812162a86193ff4a50e812c70da63e53b8434f Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sat, 25 Jun 2022 11:43:16 +0200 Subject: [PATCH] Add listen directive This provides a multi-line way to list addresses. --- directives.go | 7 ++++++- tlstunnel.1.scd | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/directives.go b/directives.go index 3628fc9..830cd4b 100644 --- a/directives.go +++ b/directives.go @@ -59,7 +59,12 @@ func parseFrontend(srv *Server, d *scfg.Directive) error { frontend.Protocols = protocolDirective.Params } - for _, addr := range d.Params { + addresses := append([]string(nil), d.Params...) + for _, listenDirective := range d.Children.GetAll("listen") { + addresses = append(addresses, listenDirective.Params...) + } + + for _, addr := range addresses { host, port, err := net.SplitHostPort(addr) if err != nil { return fmt.Errorf("failed to parse frontend address %q: %v", addr, err) diff --git a/tlstunnel.1.scd b/tlstunnel.1.scd index d995250..d11243c 100644 --- a/tlstunnel.1.scd +++ b/tlstunnel.1.scd @@ -49,6 +49,9 @@ The following directives are supported: The frontend directive supports the following sub-directives: + *listen*
... + Additional addresses to listen on. + *backend* ... Backend to forward incoming connections to.