caddy_icelandic_ip

package module
v0.0.0-...-09c5888 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

README

IPRangeSource module for caddy

This module retrieves Icelandic ips from RIX, ipv4 and ipv6.

Installation

Build Caddy using xcaddy:

xcaddy build --with github.com/Gunni/caddy-iceland-ip

Usage

Intended for use with caddy-dynamic-remoteip to match Icelandic users.

Put following config in global options under corresponding server options

:8880 {
    @not_icelandic not dynamic_remote_ip icelandic
    abort @not_icelandic

    reverse_proxy localhost:8080
}

Defaults

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IcelandicIPRange

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

IcelandicIPRange provides a range of IP address prefixes (CIDRs) retrieved from RIX.

func (IcelandicIPRange) CaddyModule

func (IcelandicIPRange) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (*IcelandicIPRange) GetIPRanges

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

func (*IcelandicIPRange) Provision

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

func (*IcelandicIPRange) UnmarshalCaddyfile

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

UnmarshalCaddyfile implements caddyfile.Unmarshaler.

icelandic {
   interval val
   timeout val
}

Jump to

Keyboard shortcuts

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