upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/components/tollgate_core
diff options
context:
space:
mode:
authorYour Name <you@example.com>2026-05-23 06:32:21 +0530
committerYour Name <you@example.com>2026-05-23 06:32:21 +0530
commita40cf60d5dff114bfd82aa74db767433564a29c0 (patch)
tree6a134558a7af0fa5f7223753380b9183d34a4ed2 /components/tollgate_core
parent0642900ae44d84cfe24abe6911dbed4cd31ab8ad (diff)
Phase 10a: component metadata v1.1.0, README, CHANGELOG
- idf_component.yml updated: v1.1.0, description, url, IDF >=5.3 - README.md with integration guide, API reference, dependencies - CHANGELOG.md tracking v1.0.0 and v1.1.0 releases - All 21 unit tests pass, ESP-IDF build passes
Diffstat (limited to 'components/tollgate_core')
-rw-r--r--components/tollgate_core/CHANGELOG.md19
-rw-r--r--components/tollgate_core/README.md71
-rw-r--r--components/tollgate_core/idf_component.yml13
3 files changed, 99 insertions, 4 deletions
diff --git a/components/tollgate_core/CHANGELOG.md b/components/tollgate_core/CHANGELOG.md
new file mode 100644
index 0000000..b6d664f
--- /dev/null
+++ b/components/tollgate_core/CHANGELOG.md
@@ -0,0 +1,19 @@
1# Changelog
2
3## 1.1.0 (2026-05-23)
4
5- Added `tollgate_core_beacon` — WiFi vendor IE construction (hash_mint, hash_npub, build_ie)
6- Added `tollgate_core_market` — market table logic (parse_ie, find_cheapest, update_ssid)
7- Platform-agnostic `tollgate_beacon_config_t` input struct for IE construction
8- `tollgate_vendor_ie_t` abstraction decouples market parsing from ESP WiFi types
9
10## 1.0.0 (2026-05-22)
11
12- Initial release
13- Session management (time + bytes based)
14- Cashu token decode and allotment calculation
15- Per-client firewall with sandbox mode
16- DNS server with per-client hijack/forward
17- Mining payment tracking (nbits→difficulty, hashprice, share→allotment)
18- Stratum proxy with job management
19- Platform abstraction via `tollgate_platform_t` callbacks
diff --git a/components/tollgate_core/README.md b/components/tollgate_core/README.md
new file mode 100644
index 0000000..d83d634
--- /dev/null
+++ b/components/tollgate_core/README.md
@@ -0,0 +1,71 @@
1# tollgate_core
2
3ESP-IDF component providing paid WiFi hotspot logic with Cashu e-cash payments.
4
5## Features
6
7- **Session management** — time-based and bytes-based sessions with auto-expiry
8- **Cashu token processing** — decode Cashu e-cash tokens, calculate allotments, multi-mint support
9- **Per-client firewall** — whitelist-based NAT filtering with sandbox mode
10- **DNS server** — per-client DNS hijack/forward with DoT rejection
11- **Mining payment** — Stratum share tracking, hashprice calculation, difficulty conversion
12- **Stratum proxy** — transparent TCP proxy for mining traffic with job management
13- **Beacon price** — WiFi vendor IE construction for price/mint/geohash advertising
14- **Market scanner** — discover and compare nearby TollGate prices
15
16## Integration
17
18### 1. Implement platform callbacks
19
20```c
21#include "tollgate_platform.h"
22
23static tollgate_platform_t platform = {
24 .get_price_sats = my_get_price,
25 .get_step_ms = my_get_step_ms,
26 .get_mint_url = my_get_mint_url,
27 .get_metric = my_get_metric,
28 .get_time_ms = my_get_time_ms,
29 // ... other callbacks
30};
31```
32
33### 2. Initialize
34
35```c
36#include "tollgate_core.h"
37
38esp_ip4_addr_t ap_ip;
39IP4_ADDR(&ap_ip, 192, 168, 4, 1);
40tollgate_core_init(&platform, ap_ip);
41
42esp_ip4_addr_t dns;
43IP4_ADDR(&dns, 8, 8, 8, 8);
44tollgate_core_dns_start(dns);
45```
46
47### 3. Process payments
48
49```c
50tollgate_core_process_payment(client_ip, cashu_token_string);
51```
52
53### 4. Tick
54
55Call `tollgate_core_tick()` periodically (e.g., every second) to expire sessions.
56
57## API Reference
58
59See `include/tollgate_core.h` for the public API and `include/tollgate_platform.h` for platform callbacks.
60
61## Dependencies
62
63- ESP-IDF >= 5.3
64- mbedtls (SHA-256, HMAC)
65- cJSON
66- lwip
67- esp_wifi (for beacon/market features)
68
69## License
70
71Proprietary — see repository for details.
diff --git a/components/tollgate_core/idf_component.yml b/components/tollgate_core/idf_component.yml
index 112aa18..cdf2ee3 100644
--- a/components/tollgate_core/idf_component.yml
+++ b/components/tollgate_core/idf_component.yml
@@ -1,6 +1,11 @@
1version: "1.0.0" 1version: "1.1.0"
2description: TollGate core component — Cashu payment processing, per-client DNS/firewall, session management for paid WiFi hotspots 2description: |
3url: https://github.com/nicoulaj/esp32-tollgate 3 TollGate core component for paid WiFi hotspots with Cashu e-cash payments.
4 Provides session management, per-client DNS/firewall, Cashu token processing,
5 mining payment tracking, beacon price advertising, and market scanning.
6 Platform-agnostic via tollgate_platform_t callbacks for easy integration
7 with any ESP32 firmware (TollGate, NerdQAxePlus, BitAxe, etc.).
8url: https://git.orangesync.tech/npub12m5exm2uk3xa674cc5r0hlyvccs5xxn7qv83ezuteefv5972nquq4j4szl/esp32-tollgate
4dependencies: 9dependencies:
5 idf: 10 idf:
6 version: ">=5.4.0" 11 version: ">=5.3.0"