Address policy
AddressPolicy.IsAllowed(IPAddress) decides whether a connection may reach an address. Myelin calls it on every
address a host resolves to, before connecting; one refused answer refuses the host.
Refused ranges
Every entry of the IANA IPv4 and IPv6 special-purpose registries that is not globally reachable, plus multicast and broadcast:
| IPv4 | What |
|---|---|
0.0.0.0/8 | "This network" |
10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 | Private |
100.64.0.0/10 | Carrier-grade NAT |
127.0.0.0/8 | Loopback |
169.254.0.0/16 | Link-local, cloud metadata (169.254.169.254) |
192.0.0.0/24 | IETF protocol assignments |
192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24 | Documentation |
192.88.99.0/24 | Deprecated 6to4 relay |
198.18.0.0/15 | Benchmarking |
224.0.0.0/4 | Multicast |
240.0.0.0/4 | Reserved, and 255.255.255.255 |
| IPv6 | What |
|---|---|
::/96 | IPv4-compatible, :: and ::1 |
::ffff:0:0:0/96 | SIIT IPv4-translated |
64:ff9b:1::/48 | Local-use NAT64 |
100::/64, 100:0:0:1::/64 | Discard-only, dummy prefix |
2001::/23 | IETF protocol assignments (Teredo, benchmarking, ORCHID…) |
2001:db8::/32, 3fff::/20 | Documentation |
2002::/16 | 6to4 |
5f00::/16 | Segment routing SIDs |
fc00::/7 | Unique local |
fe80::/10, fec0::/10 | Link-local, deprecated site-local |
ff00::/8 | Multicast |
An application that must call a service it registered itself on a private network can opt in to
registered endpoints: exact https host:port pairs allowed to reach private-use, CGNAT and
unique-local addresses, and nothing else.
192.0.0.0/24 and 2001::/23 are refused whole, including the few anycast services they hold: an application has
no reason to call them.
Mapped and translated addresses
- IPv4-mapped (
::ffff:a.b.c.d) is judged on its IPv4 address:::ffff:10.0.0.1is refused,::ffff:8.8.8.8allowed. - Well-known NAT64 (
64:ff9b::/96) is judged on the IPv4 address it embeds, so a NAT64 network still reaches public IPv4 hosts and still cannot reach10.0.0.1.
The ranges are checked with System.Net.IPNetwork on parsed addresses, never on text: octal, hexadecimal and integer
notations (0x7f000001, 2130706433) are already 127.0.0.1 by then.
DNS rebinding
The connection handler (MyelinHandler.Create) resolves the host itself, checks every answer, then opens the
socket on exactly those addresses. The socket layer never resolves the name again, so a server that answers a public
address to the check and a private one to the connection gains nothing.
Proxies are disabled for the same reason: a proxy would connect to an address this check never sees.
Custom resolution
Register your own IHostResolver (before AddMyelin, or in place of the default) to resolve through another DNS
service, or to make tests deterministic:
services.AddSingleton<IHostResolver, MyResolver>();
services.AddMyelin();