docs/remote-config-update-api.md
This document describes how to update eCapture’s runtime configuration via HTTP, from the client side.
It focuses on how to construct HTTP requests and JSON payloads to communicate with eCapture.
Notes:
- Default: disabled (no HTTP server). Pass
--listento enable, for example:--listen 127.0.0.1:28256- Set
--listen ""to explicitly disable the HTTP server (runtime config update will be unavailable)- All endpoints are HTTP POST + JSON
- Endpoint paths have no prefix. They are just the module names (e.g.
/tls,/gotls,/gnutls).
POSTapplication/jsonconfig.*Config type inside eCapture)The set of supported configuration update paths is slightly different between Linux and Android GKI.
On Linux, you can update configurations via the following HTTP paths:
| Path | Description |
|---|---|
/tls | OpenSSL / TLS module |
/openssl | Alias of /tls |
/boringssl | Alias of /tls |
/gotls | Go TLS module |
/gnutls | GnuTLS module |
/nss | NSS / NSPR module |
/nspr | Alias of /nss |
/bash | Bash command capture (Linux only) |
/mysqld | MySQLd protocol capture (Linux only) |
/postgress | PostgreSQL protocol capture (Linux only, note the spelling) |
Reminder:
/openssland/boringsslare aliases of/tls; they share the same configuration structure./nssand/nsprshare the same configuration structure./bash,/mysqld, and/postgressdo not exist on Android GKI.
On Android GKI, the available paths are:
| Path | Description |
|---|---|
/tls | OpenSSL / TLS module |
/openssl | Alias of /tls |
/boringssl | Alias of /tls |
/gotls | Go TLS module |
/gnutls | GnuTLS module |
/nss | NSS / NSPR module |
/nspr | Alias of /nss |
Reminder:
- Android GKI does not expose
/bash,/mysqld,/postgressconfiguration endpoints.- If your management client needs to support both Linux and Android, detect the platform and only call supported paths.
All configuration update endpoints use the same HTTP request pattern:
POSThttp://<listen-address>/<path>http://127.0.0.1:28256/tlsContent-Type: application/jsonpid, uid, debug, hex, btf, per_cpu_map_size, truncate_size, etc.Exact field names and types are defined in
user/config/*.go.
Examples below are illustrative only, to show how to call the API from the client side.
All endpoints return a unified JSON structure:
{
"code": 0,
"module_type": "openssl",
"msg": "RespOK",
"data": null
}
Field description:
code (number): status code
0 – success (RespOK)4 – configuration JSON decode failed (RespConfigDecodeFailed)5 – configuration check failed (RespConfigCheckFailed)6 – failed to send configuration into internal channel (RespSendToChanFailed)module_type (string): module identifier for this update (e.g. openssl, gotls, gnutls)msg (string): human-readable string corresponding to code, useful for logging and debuggingdata: currently unused and usually nullRelationship between HTTP status and code (for clients):
code == 0:code usually 4 or 5).code is 6). You can retry later.All examples assume eCapture is running on the local machine with the default address 127.0.0.1:28256.
Again, JSON fields below are examples only.
Align them with the actual fields from your currentuser/config/*.go.
/tls / /openssl / /boringssl)Used for applications based on OpenSSL / BoringSSL / generic TLS.
The three paths are equivalent; you can pick any of them.
curl -v \
-H "Content-Type: application/json" \
-X POST \
--data '{
"pid": 0,
"uid": 0,
"debug": false,
"hex": false,
"btf": 0,
"per_cpu_map_size": 1024,
"truncate_size": 0,
"filters": {
"target_process": ["nginx", "curl"],
"ignore_process": ["ecapture"]
}
}' \
http://127.0.0.1:28256/tls
A typical success response:
{
"code": 0,
"module_type": "openssl",
"msg": "RespOK",
"data": null
}
package main
import (
"bytes"
"encoding/json"
"log"
"net/http"
)
type TlsConfig struct {
Pid uint64 `json:"pid"`
Uid uint64 `json:"uid"`
Debug bool `json:"debug"`
Hex bool `json:"hex"`
Btf uint8 `json:"btf"`
PerCpuMapSize int `json:"per_cpu_map_size"`
TruncateSize uint64 `json:"truncate_size"`
// Add real TLS config fields here to match user/config/OpensslConfig
}
type Resp struct {
Code uint8 `json:"code"`
ModuleType string `json:"module_type"`
Msg string `json:"msg"`
Data interface{} `json:"data"`
}
func main() {
cfg := TlsConfig{
Pid: 0,
Uid: 0,
Debug: false,
Hex: false,
Btf: 0,
PerCpuMapSize: 1024,
TruncateSize: 0,
}
body, _ := json.Marshal(cfg)
resp, err := http.Post(
"http://127.0.0.1:28256/tls",
"application/json",
bytes.NewReader(body),
)
if err != nil {
log.Fatalf("request failed: %v", err)
}
defer resp.Body.Close()
var r Resp
if err := json.NewDecoder(resp.Body).Decode(&r); err != nil {
log.Fatalf("decode resp failed: %v", err)
}
log.Printf("status=%d code=%d module=%s msg=%s",
resp.StatusCode, r.Code, r.ModuleType, r.Msg)
}
/gotls)Used for Go applications that use the Go TLS stack.
curl -v \
-H "Content-Type: application/json" \
-X POST \
--data '{
"pid": 0,
"uid": 0,
"debug": true,
"per_cpu_map_size": 2048
}' \
http://127.0.0.1:28256/gotls
/gnutls)Used for applications that rely on GnuTLS.
curl -v \
-H "Content-Type: application/json" \
-X POST \
--data '{
"pid": 0,
"uid": 0,
"debug": false
}' \
http://127.0.0.1:28256/gnutls
/nss / /nspr)Used for modules based on NSS / NSPR (e.g. some browsers or system components).
curl -v \
-H "Content-Type: application/json" \
-X POST \
--data '{
"pid": 0,
"uid": 0,
"debug": false
}' \
http://127.0.0.1:28256/nss
/nspr is identical, only the path changes:
curl -v \
-H "Content-Type: application/json" \
-X POST \
--data '{ ... }' \
http://127.0.0.1:28256/nspr
/bash)Not available on Android GKI.
If your management tool targets multiple platforms, detect the platform before calling this endpoint.
curl -v \
-H "Content-Type: application/json" \
-X POST \
--data '{
"pid": 0,
"uid": 0,
"debug": true
}' \
http://127.0.0.1:28256/bash
/mysqld)curl -v \
-H "Content-Type: application/json" \
-X POST \
--data '{
"pid": 0,
"uid": 0,
"debug": false
}' \
http://127.0.0.1:28256/mysqld
/postgress)The path is spelled
/postgresswith a double “s”.
curl -v \
-H "Content-Type: application/json" \
-X POST \
--data '{
"pid": 0,
"uid": 0,
"debug": false
}' \
http://127.0.0.1:28256/postgress
You can combine HTTP status and the code field from the JSON response:
| HTTP status | code | Meaning | Client suggestion |
|---|---|---|---|
| 200 | 0 | Success, configuration accepted and applied | Normal flow |
| 200 | 4 | JSON decode failed (syntax error / type mismatch) | Fix request body and retry |
| 200 | 5 | Config check failed (missing field, invalid value) | Fix config content based on logs and retry |
| 200 | 6 | Internal update channel is full / busy | Wait and retry later |
| 200 | 1 / 2 | Invalid request / internal server error | Log and alert as needed |
code == 6:
/bash, /mysqld, /postgress on Linux, because they do not exist on Android.user/config/*.go.map[string]any) and only fill fields that you really need.| Version | Date | Description |
|---|---|---|
| 0.1.0 | 2025-12-07 | Initial version of the remote config API doc |