api

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckBlackListCountry added in v0.8.0

func CheckBlackListCountry(blacklist *types.CountryList, mu *sync.Mutex) func(*gin.Context)

CheckBlackListCountry godoc

@Summary		Check blacklisted country
@Description	check if a country is blacklisted
@Tags			blacklist
@Produce		json
@Param			country	path		string	true	"country to check"
@Success		200		{object}	CheckCountryResp
@Router			/v1/blacklist/countries/{country} [get]

func CheckBlackListSubnet added in v0.5.0

func CheckBlackListSubnet(blacklist *types.SubnetList, mu *sync.Mutex) func(*gin.Context)

CheckBlackListSubnet godoc

@Summary		Check blacklisted subnet
@Description	check if a subnet is blacklisted
@Tags			blacklist
@Produce		json
@Param			subnet	path		string	true	"subnet to check"
@Success		200		{object}	CheckSubnetResp
@Failure		400
@Router			/v1/blacklist/subnets/{subnet} [get]

func CheckWhiteListSubnet added in v0.5.0

func CheckWhiteListSubnet(whitelist *types.SubnetList, mu *sync.Mutex) func(*gin.Context)

CheckWhiteListSubnet godoc

@Summary		Check whitelisted subnet
@Description	check if a subnet is whitelisted
@Tags			whitelist
@Produce		json
@Param			subnet	path		string	true	"subnet to check"
@Success		200		{object}	CheckSubnetResp
@Failure		400
@Router			/v1/whitelist/subnets/{subnet} [get]

func GetBlackListCountries added in v0.8.0

func GetBlackListCountries(blacklist *types.CountryList, mu *sync.Mutex) func(*gin.Context)

GetBlackListCountries godoc

@Summary		Get blacklisted countries
@Description	get all blacklisted countries
@Tags			blacklist
@Produce		json
@Success		200	{object}	GetCountriesResp
@Router			/v1/blacklist/countries [get]

func GetBlackListSubnets added in v0.5.0

func GetBlackListSubnets(blacklist *types.SubnetList, mu *sync.Mutex) func(*gin.Context)

GetBlackListSubnets godoc

@Summary		Get blacklisted subnets
@Description	get all blacklisted subnets
@Tags			blacklist
@Produce		json
@Success		200	{object}	GetSubnetsResp
@Router			/v1/blacklist/subnets [get]

func GetWhiteListSubnets added in v0.5.0

func GetWhiteListSubnets(whitelist *types.SubnetList, mu *sync.Mutex) func(*gin.Context)

GetWhiteListSubnets godoc

@Summary		Get whitelisted subnets
@Description	get all whitelisted subnets
@Tags			whitelist
@Produce		json
@Success		200	{object}	GetSubnetsResp
@Router			/v1/whitelist/subnets [get]

func Register

func Register(
	r *gin.Engine,
	db *database.Database,
	subnetWhiteList *types.SubnetList,
	subnetBlackList *types.SubnetList,
	countryBlackList *types.CountryList,
)

func RemoveBlackListCountries added in v0.8.0

func RemoveBlackListCountries(blacklist *types.CountryList, mu *sync.Mutex, db *database.Database) func(*gin.Context)

RemoveBlackListCountries godoc

@Summary		Remove blacklisted countries
@Description	remove countries from blacklist
@Tags			blacklist
@Accept			json
@Param			body	body	RemoveCountriesReq	true	"countries to remove"
@Success		202
@Failure		400
@Failure		422
@Failure		500
@Router			/v1/blacklist/countries [delete]

func RemoveBlackListSubnets added in v0.5.0

func RemoveBlackListSubnets(blacklist *types.SubnetList, mu *sync.Mutex, db *database.Database) func(*gin.Context)

RemoveBlackListSubnets godoc

@Summary		Remove blacklisted subnets
@Description	remove subnets from blacklist
@Tags			blacklist
@Accept			json
@Param			body	body	RemoveSubnetsReq	true	"subnets to remove"
@Success		202
@Failure		400
@Failure		422
@Failure		500
@Router			/v1/blacklist/subnets [delete]

func RemoveWhiteListSubnets added in v0.5.0

func RemoveWhiteListSubnets(whitelist *types.SubnetList, mu *sync.Mutex, db *database.Database) func(*gin.Context)

RemoveWhiteListSubnets godoc

@Summary		Remove whitelisted subnets
@Description	remove subnets from whitelist
@Tags			whitelist
@Accept			json
@Param			body	body	RemoveSubnetsReq	true	"subnets to remove"
@Success		202
@Failure		400
@Failure		422
@Failure		500
@Router			/v1/whitelist/subnets [delete]

func UpsertBlackListCountries added in v0.8.0

func UpsertBlackListCountries(blacklist *types.CountryList, mu *sync.Mutex, db *database.Database) func(*gin.Context)

UpsertCountriesReq godoc

@Summary		Upsert blacklisted countries
@Description	upsert countries to blacklist
@Tags			blacklist
@Accept			json
@Param			body	body	UpsertCountriesReq	true	"countries to add"
@Success		202
@Failure		400
@Failure		422
@Failure		500
@Router			/v1/blacklist/countries [post]

func UpsertBlackListSubnets added in v0.5.0

func UpsertBlackListSubnets(blacklist *types.SubnetList, mu *sync.Mutex, db *database.Database) func(*gin.Context)

UpsertBlackListSubnets godoc

@Summary		Upsert blacklisted subnets
@Description	upsert subnets to blacklist
@Tags			blacklist
@Accept			json
@Param			body	body	UpsertSubnetsReq	true	"subnets to add"
@Success		202
@Failure		400
@Failure		422
@Failure		500
@Router			/v1/blacklist/subnets [post]

func UpsertWhiteListSubnets added in v0.5.0

func UpsertWhiteListSubnets(whitelist *types.SubnetList, mu *sync.Mutex, db *database.Database) func(*gin.Context)

UpsertWhiteListSubnets godoc

@Summary		Upsert whitelisted subnets
@Description	upsert subnets to whitelist
@Tags			whitelist
@Accept			json
@Param			body	body	UpsertSubnetsReq	true	"subnets to add"
@Success		202
@Failure		400
@Failure		422
@Failure		500
@Router			/v1/whitelist/subnets [post]

Types

type CheckCountryResp added in v0.8.0

type CheckCountryResp struct {
	Found bool `json:"found"`
}

type CheckSubnetResp added in v0.5.0

type CheckSubnetResp struct {
	Found bool `json:"found"`
}

type GetCountriesResp added in v0.8.0

type GetCountriesResp struct {
	Countries []string `json:"countries" example:"fr,de"`
}

type GetSubnetsResp added in v0.5.0

type GetSubnetsResp struct {
	Subnets []string `json:"subnets" example:"100.100.100.100/32,200.200.200.0/24"`
}

type RemoveCountriesReq added in v0.8.0

type RemoveCountriesReq struct {
	Countries []string `json:"countries" example:"fr,de"`
}

type RemoveSubnetsReq added in v0.5.0

type RemoveSubnetsReq struct {
	Subnets []string `json:"subnets" example:"100.100.100.100,200.200.200.0/24"`
}

type UpsertCountriesReq added in v0.8.0

type UpsertCountriesReq struct {
	Countries []string `json:"countries" example:"fr,de"`
}

type UpsertSubnetsReq added in v0.5.0

type UpsertSubnetsReq struct {
	Subnets []string `json:"subnets" example:"100.100.100.100,200.200.200.0/24"`
}

Jump to

Keyboard shortcuts

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