caddy_cloudflare_ip

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

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

Go to latest
Published: Nov 30, 2023 License: Apache-2.0 Imports: 9 Imported by: 4 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

trusted_proxy module for caddy

This module retrieves cloudflare ips from their offical website, ipv4 and ipv6. It is supported from caddy v2.6.3 onwards.

Example config

Put following config in global options under corresponding server options

trusted_proxies cloudflare {
    interval 12h
    timeout 15s
}

Defaults

Name Description Type Default
interval How often cloudflare ip lists are retrieved duration 1h
timeout Maximum time to wait to get a response from cloudflare duration no timeout

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudflareIPRange

type CloudflareIPRange struct {
	// refresh Interval
	Interval caddy.Duration `json:"interval,omitempty"`
	// request Timeout
	Timeout caddy.Duration `json:"timeout,omitempty"`
	// contains filtered or unexported fields
}

CloudflareIPRange provides a range of IP address prefixes (CIDRs) retrieved from cloudflare.

func (CloudflareIPRange) CaddyModule

func (CloudflareIPRange) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (*CloudflareIPRange) GetIPRanges

func (s *CloudflareIPRange) GetIPRanges(_ *http.Request) []netip.Prefix

func (*CloudflareIPRange) Provision

func (s *CloudflareIPRange) Provision(ctx caddy.Context) error

func (*CloudflareIPRange) UnmarshalCaddyfile

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

UnmarshalCaddyfile implements caddyfile.Unmarshaler.

cloudflare {
   interval val
   timeout val
}

Jump to

Keyboard shortcuts

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