variable gdprText

EU/GDPR firmware speaking the bespoke text payload format over /cgi_gdpr.

This dialect is the package default; callers targeting TL-MR6400, Archer VR900v, TL-MR6500v, Archer MR600 v2 and similar models never need to name it.

All actions of one execute call travel in a single request: the dialect emits exactly one batch covering every action index.

Examples

Build a command request

import { assertEquals } from "@std/assert";
import { gdprText } from "./gdprText.ts";

const request = gdprText.commandRequest(
  "http://192.168.1.1",
  { data: "ZGF0YQ==", sign: "00ff" },
  { sessionId: "abc123", tokenId: "tok", authTimes: 1 },
);

assertEquals(request.method, "POST");
assertEquals(request.url, "http://192.168.1.1/cgi_gdpr");
assertEquals(request.headers.get("tokenid"), "tok");
assertEquals(
  request.headers.get("cookie"),
  "loginErrorShow=1; JSESSIONID=abc123",
);
assertEquals(await request.text(), "sign=00ff\r\ndata=ZGF0YQ==\r\n");

Batch every action into one round trip

import { assertEquals } from "@std/assert";
import { ACT } from "./dialect.ts";
import { gdprText } from "./gdprText.ts";

const batches = gdprText.encodeCommands([
  [ACT.GET, "IGD_DEV_INFO"],
  [ACT.GET, "LTE_BANDINFO"],
]);

assertEquals(batches.length, 1);
assertEquals(batches[0].indices, [0, 1]);

Type

Usage

import { gdprText } from "mod.ts";