Files
ping_service/input_service/README.md
2025-12-30 19:08:18 +02:00

56 lines
1.3 KiB
Markdown

# HTTP Input Service
A lightweight HTTP server that serves individual IPv4 addresses from cloud provider CIDR ranges.
## Purpose
Provides a continuous stream of IPv4 addresses to network scanning tools. Each consumer (identified by IP) receives addresses in randomized order from cloud provider IP ranges.
## Requirements
- Go 1.16+
- Cloud provider IP repository cloned at `./cloud-provider-ip-addresses/`
## Usage
```bash
# Build
go build -ldflags="-s -w" -o ip-feeder main.go
# Run
./ip-feeder
```
Server starts on `http://localhost:8080`
## API
**GET /**
Returns a single IPv4 address per request.
```bash
curl http://localhost:8080
# Output: 13.248.118.1
```
## Features
- **Per-consumer state** - Each client gets independent, deterministic sequence
- **Memory efficient** - Loads CIDR files lazily (~5-15MB RAM usage)
- **Lazy expansion** - IPs generated on-demand from CIDR notation
- **Randomized order** - Interleaves IPs from multiple ranges randomly
- **IPv4 only** - Filters IPv6, multicast, network/broadcast addresses
- **Graceful shutdown** - Ctrl+C drains connections cleanly
## Expected Input Format
Scans `./cloud-provider-ip-addresses/` for `.txt` files containing IP ranges:
```
# Comments ignored
13.248.118.0/24
52.94.0.0/16
3.5.140.0/22
```
## Shutdown
Press `Ctrl+C` for graceful shutdown with 10s timeout.