caddy_ask_redis

package module
v0.0.0-...-d504fbb Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2023 License: MIT Imports: 10 Imported by: 0

README

caddy-ask-redis

Caddy Server v2 module for use in tls_on_demand ask property. The module will check if requested domain is a member of the Redis set defined by key.

Installation

xcaddy build \
    --with github.com/CruGlobal/caddy-ask-redis

Usage

Caddyfile

# Global config
{
   	on_demand_tls {
		ask http://localhost:1111
	}
}

http://localhost:1111 {
    route {
        skip_log
        ask_redis {
            host {$REDIS_HOST}
            port {$REDIS_PORT}
            db {$REDIS_DB_INDEX}
            key certificates:domain_allowlist
        }
    }
}

Documentation

Index

Constants

View Source
const (
	DefaultRedisHost = "127.0.0.1"
	DefaultRedisPort = "6379"
	DefaultRedisDB   = 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Middleware

type Middleware struct {
	Client *redis.Client

	Host string `json:"host"`
	Port string `json:"port"`
	DB   int    `json:"db"`
	Key  string `json:"key"`
	// contains filtered or unexported fields
}

func (Middleware) CaddyModule

func (Middleware) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (*Middleware) Provision

func (m *Middleware) Provision(ctx caddy.Context) error

Provision implements the caddy.Provisioner interface.

func (Middleware) ServeHTTP

func (m Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error

ServeHTTP implements the caddy.Handler interface.

func (*Middleware) UnmarshalCaddyfile

func (m *Middleware) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile implements caddyfile.Unmarshaler. Syntax:

ask_redis <secret>

func (*Middleware) Validate

func (m *Middleware) Validate() error

Jump to

Keyboard shortcuts

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