100.64.0.0/10 not recognized as private ip space
hugoboos opened this issue · comments
When using sonyflake on a host with an IP address in the 100.64.0.0/10
space, a nil
is returned.
The isPrivateIPv4
function does not recognize IP in 100.64.0.0/10
as private IP addresses.
Found this bug when using sonyflake in an app running on Kubernetes with Calico as an overlay network. Calico uses IP addresses from the 100.64.0.0/10
space for its pods.
isPrivateIPv4
does not handle 100.64.0.0/10 because it is not private address space but shared address space.
You can give custom MachineID
to handle 100.64.0.0/10.
https://github.com/sony/sonyflake#usage
Sonyflake's machine ID is 16-bit wide. So please care about duplicate machine ID.