Skip to content

Admin namespace

makemake-kbo edited this page Dec 12, 2023 · 1 revision

The blutgang namespace containts JSON-RPC methods that let you change settings, as well as giving you information about Blutgang. It can be enabled via both CLI arguments or via the config file. It's recommended you use the config file as it gives you more options when it comes to configuring how the blutgang namespace behaves.

# Note: the admin namespace contains volatile functions and
# should not be exposed to the public.
[admin]
# Enable the admin namespace
enabled = true
# Address for the admin RPC
address = "127.0.0.1:5715"
# Only allow read-only methods
# Recommended `true` unless you 100% need write methods
readonly = true
# Enable JWT request authentication
# MUST BE ENABLED IN PROD
jwt = true
# JWT token
key = "some-token-replace-this"

Methods

For the benefit of security, methods are split into read and write categories. Read display information about blutgang, while write methods can be used to change its behaviour, and can be dangerous if abused.

Read

blutgang_rpc_list

Returns a list of RPCs in the active pool.

Example

curl localhost:5715 \                                                                                                                           
  -X POST \            
  -H "Content-Type: application/json" \
  --data '{"method":"blutgang_rpc_list","id":1,"jsonrpc":"2.0"}'

blutgang_poverty_list

Returns a list of inactive RPCs.

Example

curl localhost:5715 \                                                                                                                           
  -X POST \            
  -H "Content-Type: application/json" \
  --data '{"method":"blutgang_poverty_list","id":1,"jsonrpc":"2.0"}'

blutgang_config

Outputs the current config info

Example

curl localhost:5715 \                                                                                                                           
  -X POST \            
  -H "Content-Type: application/json" \
  --data '{"method":"blutgang_config","id":1,"jsonrpc":"2.0"}'

blutgang_ttl

Returns the current ttl. Determines when requests to RPCs time out.

Example

curl localhost:5715 \                                                                                                                           
  -X POST \            
  -H "Content-Type: application/json" \
  --data '{"method":"blutgang_ttl","id":1,"jsonrpc":"2.0"}'

blutgang_health_check_ttl

Returns the current blutgang_health_check_ttl. Controls when requests to RPCs inside the health check time out.

Example

curl localhost:5715 \                                                                                                                           
  -X POST \            
  -H "Content-Type: application/json" \
  --data '{"method":"blutgang_ttl","id":1,"jsonrpc":"2.0"}'

Write

blutgang_quit

Flushes the DB and terminates the process.

Example

curl localhost:5715 \                                                                                                                           
  -X POST \            
  -H "Content-Type: application/json" \
  --data '{"method":"blutgang_quit","id":1,"jsonrpc":"2.0"}'

blutgang_flush_cache

Flushes sled to disk.

Example

curl localhost:5715 \                                                                                                                           
  -X POST \            
  -H "Content-Type: application/json" \
  --data '{"method":"blutgang_flush_cache","id":1,"jsonrpc":"2.0"}'

blutgang_set_ttl

Sets the ttl. Takes in the the ttl in milliseconds as an argument.

Example

curl localhost:5715 \                                                                                                                           
  -X POST \            
  -H "Content-Type: application/json" \
  --data '{"method":"blutgang_set_ttl","id":1,"jsonrpc":"2.0" , "params": [100]}'

blutgang_set_health_check_ttl

Sets the health_check_ttl. Takes in the the health_check_ttl in milliseconds as an argument.

Example

curl localhost:5715 \                                                                                                                           
  -X POST \            
  -H "Content-Type: application/json" \
  --data '{"method":"blutgang_set_health_check_ttl","id":1,"jsonrpc":"2.0" , "params": [100]}'

blutgang_add_to_rpc_list

Adds an RPC to the current active pool of RPCs. Takes in the URL, max consecutive, and MA length as arguments.

Example

curl localhost:5715 \                                                                                                                           
  -X POST \            
  -H "Content-Type: application/json" \
  --data '{"method":"blutgang_add_to_rpc_list","id":1,"jsonrpc":"2.0" , "params": ["http://example.com", 5, 10]}'

blutgang_add_to_poverty_list

Adds an RPC to the inactive pool of RPCs. Takes in the URL, max consecutive, and MA length as arguments.

Example

curl localhost:5715 \                                                                                                                           
  -X POST \            
  -H "Content-Type: application/json" \
  --data '{"method":"blutgang_add_to_poverty_list","id":1,"jsonrpc":"2.0" , "params": ["http://example.com", 5, 10]}'

blutgang_remove_from_rpc_list

Removes an RPC from the active RPC pool. Takes in the index of the RPC as an argument. Does not move it from the inactive pool.

Example

curl localhost:5715 \                                                                                                                           
  -X POST \            
  -H "Content-Type: application/json" \
  --data '{"method":"blutgang_remove_from_rpc_list","id":1,"jsonrpc":"2.0" , "params": [1]}'

blutgang_remove_from_poverty_list

Removes an RPC from the inactive RPC pool. Takes in the index of the RPC as an argument. Does not move it to the active pool.

Example

curl localhost:5715 \                                                                                                                           
  -X POST \            
  -H "Content-Type: application/json" \
  --data '{"method":"blutgang_remove_from_rpc_list","id":1,"jsonrpc":"2.0" , "params": [1]}'