2f40d62d5c
Bumps the minor group with 3 updates: [futures](https://github.com/rust-lang/futures-rs), [once_cell](https://github.com/matklad/once_cell) and [ipnet](https://github.com/krisprice/ipnet). Updates `futures` from 0.3.30 to 0.3.31 - [Release notes](https://github.com/rust-lang/futures-rs/releases) - [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md) - [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.30...0.3.31) Updates `once_cell` from 1.20.1 to 1.20.2 - [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md) - [Commits](https://github.com/matklad/once_cell/compare/v1.20.1...v1.20.2) Updates `ipnet` from 2.10.0 to 2.10.1 - [Release notes](https://github.com/krisprice/ipnet/releases) - [Changelog](https://github.com/krisprice/ipnet/blob/master/RELEASES.md) - [Commits](https://github.com/krisprice/ipnet/commits) --- updated-dependencies: - dependency-name: futures dependency-type: direct:production update-type: version-update:semver-patch dependency-group: minor - dependency-name: once_cell dependency-type: direct:production update-type: version-update:semver-patch dependency-group: minor - dependency-name: ipnet dependency-type: direct:production update-type: version-update:semver-patch dependency-group: minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
---|---|---|
.cargo | ||
.github | ||
src | ||
.codecov.yml | ||
.dockerignore | ||
.gitignore | ||
.therapist.yml | ||
CODE_OF_CONDUCT.md | ||
Cargo.lock | ||
Cargo.toml | ||
Dockerfile | ||
LICENSE | ||
README.md | ||
apiKeys.json | ||
app.yaml | ||
bors.toml | ||
version.json |
README.md
Classify Client
This is an optimized version of the classify client endpoint in Normandy.
Dev instructions
This is a normal Cargo project, so after cloning the repository, you can build and run it with
$ cargo build
$ cargo run
This project should run on the latest stable version of Rust. Unstable features are not allowed.
GeoIP Database
A GeoIP database will need to be provided. By default it is expected to be
found at ./GeoLite2-Country.mmdb
.
Configuration
Via environment variables:
DEBUG
: Set to"true"
to enable extra debugging options, such as a/debug
endpoint that shows internal server state (default:"false"
).GEOIP_DB_PATH
: path to GeoIP database (default:"./GeoLite2-Country.mmdb"
)HOST
: host to bind to (default:"localhost"
)HUMAN_LOGS
: set to"true"
to use human readable logging (default: MozLog as JSON)METRICS_TARGET
: The host and port to send statsd metrics to. May be a hostname like"metrics.example.com:8125"
or an IP like"127.0.0.1:8125"
. Port is required. (default:"localhost:8125"
)PORT
: port number to bind to (default:"8000"
)SENTRY_DSN
: report errors to a Sentry instance (default:""
)SENTRY_ENV
: Sentry environment (default:"production"
)SENTRY_SAMPLE_RATE
: Sentry sampling rate (default:1.0
)TRUSTED_PROXY_LIST
: A comma-separated list of CIDR ranges that trusted proxies will be in. Supports both IPv4 and IPv6.VERSION_FILE
: path toversion.json
file (default:"./version.json"
)API_KEYS_FILE
: path toapiKeys.json
file for/v1/country
endpoint (default:"./apiKeys.json"
)
Tests
Tests can be run with Cargo as well
$ cargo test
Linting
Linting is handled via
Therapist. After installing it,
enable the git hooks using either therapist install
or therapist install --fix
. The --fix
variant will automatically format your code upon commit.
The variant without --fix
will simply show an error and ask you to reformat
the code using other means before committing. Therapist runs in CI.
The checks Therapist runs are:
- Rustfmt
- Clippy, using the
clippy::all
preset
Former endpoints from Mozilla Location Services
Endpoints from the Mozilla Location Services project has been migrated to classify-client for continuity.
/v1/country
- Requires an api key.- Downstream firefox builds can self select a key that matches this expression:
^firefox-downstream-\w{1,40}$
- The API key is required here just to have rough usage metrics and allow us to reach out to project maintainers if needed in the future.
- Downstream firefox builds can self select a key that matches this expression:
/v1/geolocate
- Intentionally not routed to return a 404/v1/geosubmit
- Static 403 response/v1/submit
- Static 403 response/v2/geosubmit
- Static 403 response