api

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ASNExcludeListCheck added in v1.2.0

func ASNExcludeListCheck(exclude *types.MapList[uint32], mu *sync.Mutex) func(*gin.Context)

ASNExcludeListCheck godoc

@Summary		Check excluded ASN
@Description	check if an ASN is excluded
@Tags			ASNs
@Produce		json
@Param			asn	path		string	true	"ASN to check"
@Success		200	{object}	CheckASNResp
@Failure		400
@Router			/v1/asns/blocklist/exclude/{asn} [get]

func ASNExcludeListGet added in v1.2.0

func ASNExcludeListGet(exclude *types.MapList[uint32], mu *sync.Mutex) func(*gin.Context)

ASNExcludeListGet godoc

@Summary		Get excluded ASNs
@Description	get all excluded ASNs
@Tags			ASNs
@Produce		json
@Success		200	{object}	GetASNsResp
@Router			/v1/asns/blocklist/exclude [get]

func ASNExcludeListRemove added in v1.2.0

func ASNExcludeListRemove(include *types.MapList[uint32], mu *sync.Mutex, db *database.Database) func(*gin.Context)

ASNExcludeListRemove godoc

@Summary		Remove excluded ASNs
@Description	remove ASNs from excludelist
@Tags			ASNs
@Accept			json
@Param			body	body	RemoveASNsReq	true	"ASNs to remove"
@Success		202
@Failure		400
@Failure		422
@Failure		500
@Router			/v1/asns/blocklist/exclude [delete]

func ASNExcludeListUpsert added in v1.2.0

func ASNExcludeListUpsert(include *types.MapList[uint32], mu *sync.Mutex, db *database.Database) func(*gin.Context)

ASNExcludeListUpsert godoc

@Summary		Upsert excluded ASNs
@Description	upsert ASNs to excludelist
@Tags			ASNs
@Accept			json
@Param			body	body	UpsertASNsReq	true	"ASNs to add"
@Success		202
@Failure		400
@Failure		422
@Failure		500
@Router			/v1/asns/blocklist/exclude [post]

func ASNIncludeListCheck added in v1.2.0

func ASNIncludeListCheck(include *types.MapList[uint32], mu *sync.Mutex) func(*gin.Context)

ASNIncludeListCheck godoc

@Summary		Check included ASN
@Description	check if an ASN is included
@Tags			ASNs
@Produce		json
@Param			asn	path		string	true	"ASN to check"
@Success		200	{object}	CheckASNResp
@Failure		400
@Router			/v1/asns/blocklist/include/{asn} [get]

func ASNIncludeListGet added in v1.2.0

func ASNIncludeListGet(include *types.MapList[uint32], mu *sync.Mutex) func(*gin.Context)

ASNIncludeListGet godoc

@Summary		Get included ASNs
@Description	get all included ASNs
@Tags			ASNs
@Produce		json
@Success		200	{object}	GetASNsResp
@Router			/v1/asns/blocklist/include [get]

func ASNIncludeListRemove added in v1.2.0

func ASNIncludeListRemove(include *types.MapList[uint32], mu *sync.Mutex, db *database.Database) func(*gin.Context)

ASNIncludeListRemove godoc

@Summary		Remove included ASNs
@Description	remove ASNs from includelist
@Tags			ASNs
@Accept			json
@Param			body	body	RemoveASNsReq	true	"ASNs to remove"
@Success		202
@Failure		400
@Failure		422
@Failure		500
@Router			/v1/asns/blocklist/include [delete]

func ASNIncludeListUpsert added in v1.2.0

func ASNIncludeListUpsert(include *types.MapList[uint32], mu *sync.Mutex, db *database.Database) func(*gin.Context)

ASNIncludeListUpsert godoc

@Summary		Upsert included ASNs
@Description	upsert ASNs to includelist
@Tags			ASNs
@Accept			json
@Param			body	body	UpsertASNsReq	true	"ASNs to add"
@Success		202
@Failure		400
@Failure		422
@Failure		500
@Router			/v1/asns/blocklist/include [post]

func CountryBlockListCheck added in v1.2.0

func CountryBlockListCheck(blocklist *types.CountryList, mu *sync.Mutex) func(*gin.Context)

CountryBlockListCheck godoc

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

func CountryBlockListGet added in v1.2.0

func CountryBlockListGet(blocklist *types.CountryList, mu *sync.Mutex) func(*gin.Context)

CountryBlockListGet godoc

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

func CountryBlockListRemove added in v1.2.0

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

CountryBlockListRemove godoc

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

func CountryBlockListUpsert added in v1.2.0

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

CountryBlockListUpsert godoc

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

func DomainExcludeListCheck added in v1.2.0

func DomainExcludeListCheck(exclude *types.DomainList, mu *sync.Mutex) func(*gin.Context)

DomainExcludeListCheck godoc

@Summary		Check excluded domains
@Description	check if a domain is excluded
@Tags			Domains
@Produce		json
@Param			domain	path		string	true	"domain to check"
@Success		200		{object}	CheckDomainResp
@Router			/v1/domains/blocklist/exclude/{domain} [get]

func DomainExcludeListGet added in v1.2.0

func DomainExcludeListGet(exclude *types.DomainList, mu *sync.Mutex) func(*gin.Context)

DomainExcludeListGet godoc

@Summary		Get excluded domains
@Description	get all excluded domains
@Tags			Domains
@Produce		json
@Success		200	{object}	GetDomainsResp
@Router			/v1/domains/blocklist/exclude [get]

func DomainExcludeListRemove added in v1.2.0

func DomainExcludeListRemove(exclude *types.DomainList, mu *sync.Mutex, db *database.Database) func(*gin.Context)

DomainExcludeListRemove godoc

@Summary		Remove excluded domains
@Description	remove domains from excludelist
@Tags			Domains
@Accept			json
@Param			body	body	RemoveDomainsReq	true	"domains to remove"
@Success		202
@Failure		400
@Failure		422
@Failure		500
@Router			/v1/domains/blocklist/exclude [delete]

func DomainExcludeListUpsert added in v1.2.0

func DomainExcludeListUpsert(exclude *types.DomainList, mu *sync.Mutex, db *database.Database) func(*gin.Context)

DomainExcludeListUpsert godoc

@Summary		Upsert excluded domains
@Description	upsert domains to excludelist
@Tags			Domains
@Accept			json
@Param			body	body	UpsertDomainsReq	true	"domains to add"
@Success		202
@Failure		400
@Failure		422
@Failure		500
@Router			/v1/domains/blocklist/exclude [post]

func DomainIncludeListCheck added in v1.2.0

func DomainIncludeListCheck(include *types.DomainList, mu *sync.Mutex) func(*gin.Context)

DomainIncludeListCheck godoc

@Summary		Check included domains
@Description	check if a domain is included
@Tags			Domains
@Produce		json
@Param			domain	path		string	true	"domain to check"
@Success		200		{object}	CheckDomainResp
@Router			/v1/domains/blocklist/include/{domain} [get]

func DomainIncludeListGet added in v1.2.0

func DomainIncludeListGet(include *types.DomainList, mu *sync.Mutex) func(*gin.Context)

DomainIncludeListGet godoc

@Summary		Get included domains
@Description	get all included domains
@Tags			Domains
@Produce		json
@Success		200	{object}	GetDomainsResp
@Router			/v1/domains/blocklist/include [get]

func DomainIncludeListRemove added in v1.2.0

func DomainIncludeListRemove(include *types.DomainList, mu *sync.Mutex, db *database.Database) func(*gin.Context)

DomainIncludeListRemove godoc

@Summary		Remove included domains
@Description	remove domains from includelist
@Tags			Domains
@Accept			json
@Param			body	body	RemoveDomainsReq	true	"domains to remove"
@Success		202
@Failure		400
@Failure		422
@Failure		500
@Router			/v1/domains/blocklist/include [delete]

func DomainIncludeListUpsert added in v1.2.0

func DomainIncludeListUpsert(include *types.DomainList, mu *sync.Mutex, db *database.Database) func(*gin.Context)

DomainIncludeListUpsert godoc

@Summary		Upsert included domains
@Description	upsert domains to includelist
@Tags			Domains
@Accept			json
@Param			body	body	UpsertDomainsReq	true	"domains to add"
@Success		202
@Failure		400
@Failure		422
@Failure		500
@Router			/v1/domains/blocklist/include [post]

func JA3ExcludeListCheck added in v1.2.0

func JA3ExcludeListCheck(exclude *types.MapList[string], mu *sync.Mutex) func(*gin.Context)

JA3ExcludeListCheck godoc

@Summary		Check excluded ja3 hash
@Description	check if a ja3 hash is excluded
@Tags			JA3
@Produce		json
@Param			hash	path		string	true	"hash to check"
@Success		200		{object}	CheckJA3Resp
@Router			/v1/ja3/blocklist/exclude/{hash} [get]

func JA3ExcludeListGet added in v1.2.0

func JA3ExcludeListGet(exclude *types.MapList[string], mu *sync.Mutex) func(*gin.Context)

JA3ExcludeListGet godoc

@Summary		Get excluded ja3 hashes
@Description	get all excluded ja3 hashes
@Tags			JA3
@Produce		json
@Success		200	{object}	GetJA3Resp
@Router			/v1/ja3/blocklist/exclude [get]

func JA3ExcludeListRemove added in v1.2.0

func JA3ExcludeListRemove(exclude *types.MapList[string], mu *sync.Mutex, db *database.Database) func(*gin.Context)

JA3ExcludeListRemove godoc

@Summary		Remove excluded ja3 hashes
@Description	remove ja3 hashes from excludelist
@Tags			JA3
@Accept			json
@Param			body	body	RemoveJA3Req	true	"hashes to remove"
@Success		202
@Failure		400
@Failure		422
@Failure		500
@Router			/v1/ja3/blocklist/exclude [delete]

func JA3ExcludeListUpsert added in v1.2.0

func JA3ExcludeListUpsert(exclude *types.MapList[string], mu *sync.Mutex, db *database.Database) func(*gin.Context)

JA3ExcludeListUpsert godoc

@Summary		Upsert excluded ja3 hashes
@Description	upsert ja3 hashes to excludelist
@Tags			JA3
@Accept			json
@Param			body	body	UpsertJA3Req	true	"hashes to add"
@Success		202
@Failure		400
@Failure		422
@Failure		500
@Router			/v1/ja3/blocklist/exclude [post]

func JA3IncludeListCheck added in v1.2.0

func JA3IncludeListCheck(include *types.MapList[string], mu *sync.Mutex) func(*gin.Context)

JA3IncludeListCheck godoc

@Summary		Check included ja3 hash
@Description	check if a ja3 hash is included
@Tags			JA3
@Produce		json
@Param			hash	path		string	true	"hash to check"
@Success		200		{object}	CheckJA3Resp
@Router			/v1/ja3/blocklist/include/{hash} [get]

func JA3IncludeListGet added in v1.2.0

func JA3IncludeListGet(include *types.MapList[string], mu *sync.Mutex) func(*gin.Context)

JA3IncludeListGet godoc

@Summary		Get included ja3 hashes
@Description	get all included ja3 hashes
@Tags			JA3
@Produce		json
@Success		200	{object}	GetJA3Resp
@Router			/v1/ja3/blocklist/include [get]

func JA3IncludeListRemove added in v1.2.0

func JA3IncludeListRemove(include *types.MapList[string], mu *sync.Mutex, db *database.Database) func(*gin.Context)

JA3IncludeListRemove godoc

@Summary		Remove included ja3 hashes
@Description	remove ja3 hashes from includelist
@Tags			JA3
@Accept			json
@Param			body	body	RemoveJA3Req	true	"hashes to remove"
@Success		202
@Failure		400
@Failure		422
@Failure		500
@Router			/v1/ja3/blocklist/include [delete]

func JA3IncludeListUpsert added in v1.2.0

func JA3IncludeListUpsert(include *types.MapList[string], mu *sync.Mutex, db *database.Database) func(*gin.Context)

JA3IncludeListUpsert godoc

@Summary		Upsert included ja3 hashes
@Description	upsert ja3 hashes to includelist
@Tags			JA3
@Accept			json
@Param			body	body	UpsertJA3Req	true	"hashes to add"
@Success		202
@Failure		400
@Failure		422
@Failure		500
@Router			/v1/ja3/blocklist/include [post]

func Register

func Register(
	r *gin.Engine,
	db *database.Database,
	ipAllowList *types.IPList,
	countryBlockList *types.CountryList,
	ipIncludeList *types.IPList,
	ipExcludeList *types.IPList,
	asnIncludeList *types.MapList[uint32],
	asnExcludeList *types.MapList[uint32],
	ja3IncludeList *types.MapList[string],
	ja3ExcludeList *types.MapList[string],
	domainIncludeList *types.DomainList,
	domainExcludeList *types.DomainList,
)

func SubnetAllowListCheck added in v1.2.0

func SubnetAllowListCheck(allowlist *types.IPList, mu *sync.Mutex) func(*gin.Context)

SubnetAllowListCheck godoc

@Summary		Check allowed ip address
@Description	check if an ip address is allowed
@Tags			Subnets
@Produce		json
@Param			ip	path		string	true	"ip address to check"
@Success		200	{object}	CheckSubnetResp
@Failure		400
@Router			/v1/subnets/allowlist/{ip} [get]

func SubnetAllowListGet added in v1.2.0

func SubnetAllowListGet(allowlist *types.IPList, mu *sync.Mutex) func(*gin.Context)

SubnetAllowListGet godoc

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

func SubnetAllowListRemove added in v1.2.0

func SubnetAllowListRemove(allowlist *types.IPList, mu *sync.Mutex, db *database.Database) func(*gin.Context)

SubnetAllowListRemove godoc

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

func SubnetAllowListUpsert added in v1.2.0

func SubnetAllowListUpsert(allowlist *types.IPList, mu *sync.Mutex, db *database.Database) func(*gin.Context)

SubnetAllowListUpsert godoc

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

func SubnetExcludeListCheck added in v1.2.0

func SubnetExcludeListCheck(exclude *types.IPList, mu *sync.Mutex) func(*gin.Context)

SubnetExcludeListCheck godoc

@Summary		Check excluded ip address
@Description	check if an ip address is excluded
@Tags			Subnets
@Produce		json
@Param			ip	path		string	true	"ip address to check"
@Success		200	{object}	CheckSubnetResp
@Failure		400
@Router			/v1/subnets/blocklist/exclude/{ip} [get]

func SubnetExcludeListGet added in v1.2.0

func SubnetExcludeListGet(exclude *types.IPList, mu *sync.Mutex) func(*gin.Context)

SubnetExcludeListGet godoc

@Summary		Get excluded subnets
@Description	get all excluded subnets
@Tags			Subnets
@Produce		json
@Success		200	{object}	GetSubnetsResp
@Router			/v1/subnets/blocklist/exclude [get]

func SubnetExcludeListRemove added in v1.2.0

func SubnetExcludeListRemove(exclude *types.IPList, mu *sync.Mutex, db *database.Database) func(*gin.Context)

SubnetExcludeListRemove godoc

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

func SubnetExcludeListUpsert added in v1.2.0

func SubnetExcludeListUpsert(exclude *types.IPList, mu *sync.Mutex, db *database.Database) func(*gin.Context)

SubnetExcludeListUpsert godoc

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

func SubnetIncludeListCheck added in v1.2.0

func SubnetIncludeListCheck(include *types.IPList, mu *sync.Mutex) func(*gin.Context)

SubnetIncludeListCheck godoc

@Summary		Check included ip address
@Description	check if an ip address is included
@Tags			Subnets
@Produce		json
@Param			ip	path		string	true	"ip address to check"
@Success		200	{object}	CheckSubnetResp
@Failure		400
@Router			/v1/subnets/blocklist/include/{ip} [get]

func SubnetIncludeListGet added in v1.2.0

func SubnetIncludeListGet(include *types.IPList, mu *sync.Mutex) func(*gin.Context)

SubnetIncludeListGet godoc

@Summary		Get included subnets
@Description	get all included subnets
@Tags			Subnets
@Produce		json
@Success		200	{object}	GetSubnetsResp
@Router			/v1/subnets/blocklist/include [get]

func SubnetIncludeListRemove added in v1.2.0

func SubnetIncludeListRemove(include *types.IPList, mu *sync.Mutex, db *database.Database) func(*gin.Context)

SubnetIncludeListRemove godoc

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

func SubnetIncludeListUpsert added in v1.2.0

func SubnetIncludeListUpsert(include *types.IPList, mu *sync.Mutex, db *database.Database) func(*gin.Context)

SubnetIncludeListUpsert godoc

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

Types

type CheckASNResp added in v1.2.0

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

type CheckCountryResp added in v0.8.0

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

type CheckDomainResp added in v0.5.0

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

type CheckJA3Resp added in v1.2.0

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

type CheckSubnetResp added in v0.5.0

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

type GetASNsResp added in v1.2.0

type GetASNsResp struct {
	ASNs []uint32 `json:"asns" example:"206831,400328"`
}

type GetCountriesResp added in v0.8.0

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

type GetDomainsResp added in v0.5.0

type GetDomainsResp struct {
	Domains []string `json:"domains" example:"good.com,bad.com"`
}

type GetJA3Resp added in v1.2.0

type GetJA3Resp struct {
	Hashes []string `json:"hashes" example:"a50a861119aceb0ccc74902e8fddb618,534ce2dbc413c68e908363b5df0ae5e0"`
}

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 RemoveASNsReq added in v1.2.0

type RemoveASNsReq struct {
	ASNs []uint32 `json:"asns" example:"206831,400328"`
}

type RemoveCountriesReq added in v0.8.0

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

type RemoveDomainsReq added in v0.5.0

type RemoveDomainsReq struct {
	Domains []string `json:"domains" example:"good.com,bad.com"`
}

type RemoveJA3Req added in v1.2.0

type RemoveJA3Req struct {
	Hashes []string `json:"hashes" example:"a50a861119aceb0ccc74902e8fddb618,534ce2dbc413c68e908363b5df0ae5e0"`
}

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 UpsertASNsReq added in v1.2.0

type UpsertASNsReq struct {
	ASNs []uint32 `json:"asns" example:"206831,400328"`
}

type UpsertCountriesReq added in v0.8.0

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

type UpsertDomainsReq added in v0.5.0

type UpsertDomainsReq struct {
	Domains []string `json:"domains" example:"good.com,bad.com"`
}

type UpsertJA3Req added in v1.2.0

type UpsertJA3Req struct {
	Hashes []string `json:"hashes" example:"a50a861119aceb0ccc74902e8fddb618,534ce2dbc413c68e908363b5df0ae5e0"`
}

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