config

package
v0.0.0-...-82b5ac7 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GuardEndpointEU = "https://guard.aikido.dev/"
	GuardEndpointUS = "https://guard.us.aikido.dev/"
	GuardEndpointME = "https://guard.me.aikido.dev/"
	RuntimeEndpoint = "https://runtime.aikido.dev/"
)
View Source
const (
	Version = "0.0.0"
)

Variables

View Source
var CollectAPISchema bool

Functions

func GetCloudConfigUpdatedAt

func GetCloudConfigUpdatedAt() time.Time

func Init

func Init(environmentConfig *aikido_types.EnvironmentConfigData, aikidoConfig *aikido_types.AikidoConfigData) error

Init initializes the configuration system, extracting region from token to determine default endpoint URL if not set. Returns an error if setting the log level fails.

func IsBlockingEnabled

func IsBlockingEnabled() bool

func IsIPAllowed

func IsIPAllowed(ip string) bool

IsIPAllowed checks that the IP is allowed if the global allowed IP list is set. Private/local IP addresses are always allowed, even when an allow list is configured.

func IsIPBlocked

func IsIPBlocked(ip string) (bool, string)

IsIPBlocked function checks the cloud config mutex for blocked IP addresses.

func IsIPBypassed

func IsIPBypassed(ip string) bool

func IsUserAgentBlocked

func IsUserAgentBlocked(userAgent string) (bool, string)

IsUserAgentBlocked returns true if we block (e.g. bot blocking), and a string with the reason why.

func IsUserBlocked

func IsUserBlocked(userID string) bool

func IsZenDisabled

func IsZenDisabled() bool

func IsZenLoaded

func IsZenLoaded() bool

func SetBlocking

func SetBlocking(blocking bool)

func SetUserBlocked

func SetUserBlocked(userID string)

func SetZenDisabled

func SetZenDisabled(disabled bool)

func SetZenLoaded

func SetZenLoaded(loaded bool)

func ShouldBlockHostname

func ShouldBlockHostname(hostname string) bool

func ShouldProtect

func ShouldProtect() bool

ShouldProtect returns true if protection should run. Protection runs when zen is not disabled AND has been loaded successfully.

func Uninit

func Uninit()

func UpdateServiceConfig

func UpdateServiceConfig(cloudConfig *aikido_types.CloudConfigData, blockListConfig *aikido_types.ListsConfigData)

Types

type Endpoint

type Endpoint struct {
	Method             string                    `json:"method"`
	Route              string                    `json:"route"`
	ForceProtectionOff bool                      `json:"forceProtectionOff"`
	Graphql            any                       `json:"graphql"`
	AllowedIPAddresses ipaddr.MatchList          `json:"allowedIPAddresses"`
	RateLimiting       aikido_types.RateLimiting `json:"rateLimiting"`
}

func GetEndpoints

func GetEndpoints() []Endpoint

type EndpointKey

type EndpointKey struct {
	Method string
	Route  string
}

type RateLimiting

type RateLimiting struct {
	Enabled        bool
	MaxRequests    int
	WindowSizeInMS int
}

type ServiceConfigData

type ServiceConfigData struct {
	ConfigUpdatedAt          time.Time
	Endpoints                []Endpoint
	BlockedUserIDs           map[string]bool
	BypassedIPs              ipaddr.MatchList
	AllowedIPs               map[string]ipaddr.MatchList
	BlockedIPs               map[string]ipaddr.MatchList
	BlockedUserAgents        *regexp.Regexp
	Block                    bool
	BlockNewOutgoingRequests bool
	Domains                  []aikido_types.OutboundDomain
}

Jump to

Keyboard shortcuts

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