# Regional Scoping with ISO Codes (MeshCore)

## Regional Scoping (MeshCore Region Filtering)

MeshCore region scoping (region filtering) lets repeater operators tag flood traffic with a **region** so that repeaters only forward scoped packets within their configured region, reducing cross-country network congestion. A region is **not** an ISO 3166-2 code and there is no built-in standard, code table, or official registry inside the firmware. A region is simply an **arbitrary, operator-chosen plain name** that the firmware **SHA-256 hashes into a 2-byte transport code** carried in the packet header; repeaters match on that hash.

Communities often adopt ISO-3166-2-style strings such as `us` or `us-co` purely as a naming *convention*. These work only because they are valid arbitrary names - the firmware never interprets them as ISO codes, validates them against any standard, or enforces a country/state hierarchy. Any agreed string works equally well.

### How It Works

- A region name is a string of **lowercase alphanumeric characters and hyphens** (`a-z`, `0-9`, `-`), maximum **~29 bytes** (UTF-8). Within a given mesh, region names must be unique, and they must match **exactly** - any misspelling is treated as a completely different region.
- The firmware hashes the name (SHA-256) down to a **2-byte** identifier. Because the identifier is only 2 bytes, hash collisions between different names are possible (though unlikely for a small set of regions).
- Legacy flood packets that carry *no* scope are still forwarded everywhere by default - region filtering only applies to packets that carry a scope.
- Since v1.10.0 a basic rule applies: a repeater will *not* forward a flood packet that has a scope set when the repeater has no matching region. Repeaters running firmware older than v1.10.0 do not honor scopes, so scoped traffic can still leak across them.

This lets a local community (for example, a Colorado group) agree on a region name and keep its scoped traffic within that region instead of flooding the wider mesh.

### Configuration Notes

- The number of regions configurable per repeater depends on firmware version. Refer to MeshCore release notes for current limits.
- Region names: lowercase alphanumeric plus hyphen, maximum ~29 bytes (UTF-8), unique within a mesh, matched exactly.
- There is **no firmware-enforced minimum scope** (no required country + state). Any hierarchy - such as a broad `us` region plus a narrower `us-co` region - is purely a convention agreed among operators, not a rule the firmware enforces.

### CLI Configuration Example (Colorado)

The names below (`us`, `us-co`) are arbitrary example strings, not standardized codes. Defining a region is not enough on its own - you also issue `region allowf` (allow flood) for each region to actually permit scoped flood forwarding, then `region save`:

```
region put us
region put us-co us
region allowf us
region allowf us-co
region save
```

This configures the repeater with two arbitrary regions (`us` and `us-co`) and enables flood forwarding for both. The names carry no inherent geographic meaning to the firmware - they match only because every participating operator uses the exact same strings.

### Example Region Names (Convention Only)

The strings below are **examples of arbitrary names a community might agree to adopt**. They are not ISO 3166-2 codes recognized by MeshCore and are not validated by the firmware - they work only among networks that all agree to use them. Pick any short, agreed name for your local mesh; everyone in scope must use the identical string.

<table id="bkmrk-coderegion-usunited-"> <thead><tr><th>Example Name</th><th>Could Represent</th></tr></thead> <tbody> <tr><td>`us`</td><td>United States (broad)</td></tr> <tr><td>`us-co`</td><td>Colorado</td></tr> <tr><td>`us-nd`</td><td>North Dakota</td></tr> <tr><td>`us-or`</td><td>Oregon</td></tr> <tr><td>`us-wa`</td><td>Washington</td></tr> <tr><td>`ca`</td><td>Canada (broad)</td></tr> <tr><td>`us-dfw`</td><td>Dallas/Fort Worth metro</td></tr> <tr><td>`us-bay`</td><td>[San Francisco Bay Area](https://wiki.meshamerica.com/books/north-american-networks/page/san-francisco-bay-area) metro</td></tr> <tr><td>`us-atl`</td><td>Greater Atlanta metro</td></tr> </tbody></table>

### Agreeing on Region Names

There is **no central registry built into MeshCore**. Choosing region names is a coordination exercise: operators discuss in whatever forums they use (or even over the mesh itself) and come to a consensus on how to divide up their geography. Whatever string you settle on, every repeater that should share that region must be configured with the exact same name.

Third-party community sites such as [regionmesh.com](https://regionmesh.com) publish suggested naming conventions to help operators coordinate, but these are **independent community resources, not official MeshCore registries** - the firmware neither knows about nor enforces them.

### After Changing Region Configuration

After saving region changes, run `advert` to broadcast the updated configuration to the network immediately rather than waiting for the next scheduled advertisement.