diff options
author | Matt Holt <mholt@users.noreply.github.com> | 2022-09-01 16:30:03 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-01 16:30:03 -0600 |
commit | 1edc1a45e3aee1f7d86b68c3ddaf2fd16ba8ab73 (patch) | |
tree | 70d05a7707eba64747cc6764e3378595cf946df6 /modules/caddyhttp | |
parent | cb849bd6648294feb42eac1081aece589f20eaf6 (diff) |
core: Plugins can register listener networks (#5002)
* core: Plugins can register listener networks
This can be useful for custom listeners.
This feature/API is experimental and may change!
* caddyhttp: Expose server listeners
Diffstat (limited to 'modules/caddyhttp')
-rw-r--r-- | modules/caddyhttp/server.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/caddyhttp/server.go b/modules/caddyhttp/server.go index dcf9af1..e01e7c8 100644 --- a/modules/caddyhttp/server.go +++ b/modules/caddyhttp/server.go @@ -579,6 +579,14 @@ func (s *Server) protocol(proto string) bool { return false } +// Listeners returns the server's listeners. These are active listeners, +// so calling Accept() or Close() on them will probably break things. +// They are made available here for read-only purposes (e.g. Addr()) +// and for type-asserting for purposes where you know what you're doing. +// +// EXPERIMENTAL: Subject to change or removal. +func (s *Server) Listeners() []net.Listener { return s.listeners } + // ServerLogConfig describes a server's logging configuration. If // enabled without customization, all requests to this server are // logged to the default logger; logger destinations may be |