merge_listener_wrapper

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package merge_listener_wrapper allows Caddy to listen on multiple listeners.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ListenerProvider

type ListenerProvider lifecycler.LifeCyclable[func(net.Listener)]

ListenerProvider is implemented by modules in the "caddy.listeners.merge" namespace.

type MergeWrapper

type MergeWrapper struct {
	// ListenerRaw is a slice of JSON-encoded data representing listener configurations.
	// These configurations are used to create the actual net.Listener instances.
	// Listeners should implement [net.Listener] and be in the 'caddy.listeners.merge.listeners' namespace.
	ListenerRaw []json.RawMessage `json:"listeners" caddy:"namespace=caddy.listeners.merge inline_key=listener"`
	// contains filtered or unexported fields
}

MergeWrapper loads multiple [net.Listener]s and aggregates their [net.Conn]s into a single net.Listener. It allows caddy to accept connections from multiple sources.

func (*MergeWrapper) CaddyModule

func (p *MergeWrapper) CaddyModule() caddy.ModuleInfo

CaddyModule implements caddy.Module.

func (*MergeWrapper) Cleanup

func (p *MergeWrapper) Cleanup() (err error)

Cleanup implements caddy.CleanerUpper. All wrapped listeners are closed and the struct is cleared.

func (*MergeWrapper) Provision

func (p *MergeWrapper) Provision(ctx caddy.Context) error

Provision implements caddy.Provisioner. It loads the listeners from their configs and asserts them to net.Listener. Any failed assertions will cause a panic.

func (*MergeWrapper) UnmarshalCaddyfile

func (p *MergeWrapper) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile implements caddyfile.Unmarshaler. Must have at least one listener to aggregate with the wrapped listener. `tls` should come specifically after any `merge` directives.

```

 http caddyfile:
	{
	  servers :443 {
	    listener_wrappers {
	      merge {
	        <submodule name> <submodule config>
	      }
	      tls
	    }
	  }
	}

```

func (*MergeWrapper) WrapListener

func (p *MergeWrapper) WrapListener(ls net.Listener) net.Listener

WrapListener implements caddy.ListenerWrapper. The listener passed in is closed by MergeWrapper during cleanup.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL