/api/rke/discover
GETDiscovers RKE (RAIDA Key Exchange) configuration from a Content Server's DNS records, including RAIDA server mappings and key set definitions.
Description
The RKE discovery process queries DNS records to find Content Server configuration. This is the first step in establishing an encrypted session with a Content Server.
DNS Discovery Process
The discovery queries two types of DNS records:
- SRV Record:
_rke._udp.{domain}- Returns the target host and port - TXT Records: Multiple TXT records containing:
k1 = SERVER_ID- Key set definitions192.168.1.1:50000 k1- RAIDA server to key set mappingsrequired raidas>=13- Minimum RAIDA threshold
Prerequisite
The Content Server domain must have proper RKE DNS records configured. If the domain doesn't have RKE records, this endpoint will return an error.
Parameters
domain
string (query)
Required
The Content Server domain to discover RKE configuration for.
Format: Fully qualified domain name (FQDN)
Examples:
content.cloudcoin.globalmedia.example.comrke.myserver.org
Response
Returns the discovered RKE configuration including key sets and RAIDA server mappings.
Response Properties (Success)
command
string
Always "rke_discover".
success
boolean
True if discovery succeeded.
domain
string
The queried domain.
target_host
string
Resolved host from SRV record.
target_port
integer
Port from SRV record.
min_raidas_required
integer
Minimum RAIDA servers needed (typically 13).
key_sets
array
Available key sets for this Content Server.
key_sets[].key_id
string
Key set identifier (e.g., "k1", "k2").
key_sets[].cs_id
string
Content Server ID for this key set.
key_sets[].server_count
integer
Number of RAIDA servers mapped to this key set.
Example Response (Success)
{
"command": "rke_discover",
"success": true,
"domain": "content.cloudcoin.global",
"target_host": "192.168.1.100",
"target_port": 443,
"min_raidas_required": 13,
"key_sets": [
{
"key_id": "k1",
"cs_id": "CLOUDCOIN_CONTENT",
"server_count": 25
}
]
}
Example Response (Error - DNS Not Found)
{
"error": true,
"message": "DNS discovery failed",
"code": 500,
"result_code": 13,
"domain": "nonexistent.example.com"
}
Examples
JavaScript (fetch)
const API_HOST = 'http://localhost:8080';
async function discoverRke(domain) {
try {
const url = `${API_HOST}/api/rke/discover?domain=${encodeURIComponent(domain)}`;
const response = await fetch(url);
const result = await response.json();
if (result.success) {
console.log(`RKE Configuration for ${result.domain}:`);
console.log(` Target: ${result.target_host}:${result.target_port}`);
console.log(` Min RAIDAs: ${result.min_raidas_required}`);
console.log(` Key Sets: ${result.key_sets.length}`);
result.key_sets.forEach(ks => {
console.log(` - ${ks.key_id}: ${ks.cs_id} (${ks.server_count} servers)`);
});
} else {
console.error('Discovery failed:', result.message);
}
return result;
} catch (error) {
console.error('Error:', error);
}
}
// Discover RKE configuration for a Content Server
discoverRke('content.cloudcoin.global');
cURL
# Discover RKE configuration for a domain
curl "http://localhost:8080/api/rke/discover?domain=content.cloudcoin.global"
# Pretty print with jq
curl "http://localhost:8080/api/rke/discover?domain=content.cloudcoin.global" | jq
# Extract key sets
curl "http://localhost:8080/api/rke/discover?domain=content.cloudcoin.global" | jq '.key_sets'
Go
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"net/url"
)
const ApiHost = "http://localhost:8080"
type KeySet struct {
KeyID string `json:"key_id"`
CsID string `json:"cs_id"`
ServerCount int `json:"server_count"`
}
type DiscoverResponse struct {
Command string `json:"command"`
Success bool `json:"success"`
Domain string `json:"domain"`
TargetHost string `json:"target_host"`
TargetPort int `json:"target_port"`
MinRaidasRequired int `json:"min_raidas_required"`
KeySets []KeySet `json:"key_sets"`
}
func DiscoverRke(domain string) (*DiscoverResponse, error) {
url := fmt.Sprintf("%s/api/rke/discover?domain=%s",
ApiHost, url.QueryEscape(domain))
resp, err := http.Get(url)
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
var result DiscoverResponse
json.Unmarshal(body, &result)
return &result, nil
}
func main() {
config, _ := DiscoverRke("content.cloudcoin.global")
if config.Success {
fmt.Printf("Target: %s:%d\n", config.TargetHost, config.TargetPort)
fmt.Printf("Key Sets: %d\n", len(config.KeySets))
}
}