api

package
Version: v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2020 License: MIT Imports: 15 Imported by: 0

README

SDNS HTTP API

You can manage all blocks with basic HTTP API functions.

Authentication

WARNING: Currently, there is no authentication mechanism for API functions.

Actions

GET /api/v1/block/set/:key

It is used to create a new block.

request

curl http://localhost:8080/api/v1/block/set/domain.com

response

{"success":true}
GET /api/v1/block/get/:key

Used to request an existing block

request

curl http://localhost:8080/api/v1/block/get/domain.com

response

{"success":true}

or

{"error":"domain.com not found"}
GET /api/v1/block/exists/:key

It queries whether it has a block.

request

curl http://localhost:8080/api/v1/block/exists/domain.com

response

{"success":true}
GET /api/v1/block/remove/:key

Deletes the block.

request

curl http://localhost:8080/api/v1/block/remove/domain.com

response

{"success":true}
GET /api/v1/purge/domain/type

Purge a cached query.

request

curl http://localhost:8080/api/v1/purge/example.com/MX

response

{"success":true}
GET /metrics

Export the prometheus metrics.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	// contains filtered or unexported fields
}

API type

func New

func New(cfg *config.Config) *API

New return new api

func (*API) Run

func (a *API) Run()

Run API server

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto