|
Device Generator 1.0.3
Devices, browsers, user agents and IP addresses that fit together for C++23
|
Requires C++23 (e.g.,
-std=c++23for GCC/Clang,/std:c++latestfor MSVC).
API Reference · Usage Guide · Data and Method · Releases
Devices, browsers, user agents and IP addresses that fit together: a phone model that was on sale at the date, running an OS version it supports, a browser that runs on that OS at a version released by then, the user-agent string that exact combination sends, its screen, and an address registered in the person's country.
Android 10; K), the minor-version zeros from 101, Apple's frozen 18_6 token from iOS 26, CriOS, FxiOS and EdgiOS on iOS, iPad Safari asking for the desktop site. Chrome, Safari, Edge, Firefox, Samsung Internet, Opera and Yandex Browser. Checked against ua-parser, which reads back the browser, its major version and the OS for every generated string.Sec-CH-UA, Sec-CH-UA-Mobile and Sec-CH-UA-Platform headers they send with every request, with the brand list ordered and spelled by the version as Chromium does it ("Not_A Brand";v="8", "Chromium";v="120", "Google Chrome";v="120").safe gives documentation addresses only (RFC 5737, RFC 3849), so test data reaches no one.reference_date from 2021 on picks the devices, OS and browser versions of that day, and maker and browser shares follow their trends (Huawei's fall outside China, Edge's rise on Windows); the library never reads the clock.device_request can fix the country, the platform (user-generator's keys), the kind, the browser, the IP family and the locale (for Accept-Language). What is left out is drawn, and fixing one part leaves the others' draws unchanged.get_device(request, seed) for reproducible results, and device::seed() for replaying a previous generation with the same request and data.extend()), checked before they are applied.to_json() on every result, and a signature() recording the seed and the data it came from.DASMIG_DEVICE_EMBED to build the lite tier into the program, for WebAssembly and other builds without files.dvg instances with their own data and random engine.devicegen.hpp is the library released here. Keep core.hpp and the core/ directory (dasmig-core) in the same directory. Add
to the files you want to use it in, and supply the resources folder (or define DASMIG_DEVICE_EMBED).
See the usage guide for everything else.
Tested with:
-std=c++23)-std=c++23)/std:c++latest)| Dependency | Version | Bundled | Purpose |
|---|---|---|---|
| dasmig-core | 1.3 | Yes (core.hpp, core/) | Platform-independent random engine and distributions, data layers, JSON |
| Catch2 | 3.x | Yes (amalgamated) | Unit testing |
| Library | Description |
|---|---|
| address-generator | Postal addresses with real streets by place |
| biodata-generator | Procedural human physical characteristics |
| birth-generator | Demographically plausible birthdays |
| city-generator | Weighted city selection by population |
| country-generator | Weighted country selection by population |
| email-generator | Email addresses in each country's style |
| entity-generator | ECS-based entity generation |
| interest-generator | Religion, hobbies and favourite media by country, age and sex |
| name-generator | Culturally appropriate full names |
| nickname-generator | Gamer-style nicknames |
| occupation-generator | Employment status, education and occupation by country, age and sex |
| persona-generator | Complete characters composed from the other generators |
| phone-generator | Phone numbers valid in each country's numbering plan |
| relationship-generator | Families around a person: parents, siblings, partners and children |
| trait-generator | Personality traits with conflicts, synergies and Big Five axes |
| user-generator | Complete user records: account, username, email, phone and address |
This library is released under the MIT License. The data's sources are listed in LICENSE_DATA.txt and doc/data.md.