config

package
v0.0.0-...-9c9dde5 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Context

func Context(ctx context.Context, conf *Config) context.Context

Creates a context.Context which includes the specified config.

func Middleware

func Middleware(conf *Config) func(http.Handler) http.Handler

Types

type Config

type Config struct {
	Bind    string `scfg:"bind"`
	Storage string `scfg:"storage"`

	Auth struct {
		User []struct {
			Name     string   `scfg:",param"`
			Key      string   `scfg:"key"`
			Networks []string `scfg:"networks"`
		} `scfg:"user"`
		Trust struct {
			Subnet []string `scfg:",param"`
		} `scfg:"trust"`
	} `scfg:"auth"`

	Federate struct{} `scfg:"federate"`

	ThirdParty struct {
		Cloudflare struct {
			Bearer string `scfg:"bearer"`
		} `scfg:"cloudflare"`
	} `scfg:"third-party"`

	Rules struct {
		BlockTorExit        *struct{} `scfg:"block-tor-exit"`
		BlockDomains        *struct{} `scfg:"block-domains"`
		BlockNetworks       *struct{} `scfg:"block-networks"`
		BlockDEP            *struct{} `scfg:"block-dep"`
		BlockRateLimit      *struct{} `scfg:"block-ratelimit"`
		BlockCommercialISPs *struct{} `scfg:"block-commercial-isp"`
	} `scfg:"rules"`

	RateLimit struct {
		Bucket []struct {
			Name    string  `scfg:",param"`
			LimitBy *string `scfg:"limit-by"`
			Rate    string  `scfg:"rate"`
		} `scfg:"bucket"`
	} `scfg:"ratelimit"`

	CommercialNetworks struct {
		AS []struct {
			Param int `scfg:",param"`
		} `scfg:"AS"`
	} `scfg:"commercial-networks"`
}

func ForContext

func ForContext(ctx context.Context) *Config

Returns the config associated with this context.

func Load

func Load() (*Config, error)

Attempts to load the abused config file from known paths.

Jump to

Keyboard shortcuts

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