lni / dragonboat

A feature complete and high performance multi-group Raft library in Go.
Apache License 2.0
5.09k stars 542 forks source link

Improve the address validator #340

Open lni opened 11 months ago

lni commented 11 months ago

All addresses used in the config are locally validated, the current implementation relies on a few regex to do that, code is here. See IsValidAddress() and IsValidAddressErr().

Current limitation is that it can't tell that things like 192.168.0.300 is invalid (see the 300 part), as they are considered as a valid hostname (not an IPv4 address).

It will great if someone can help to improve the address validator and provide a few tests.

nurlantulemisov commented 11 months ago

hi @lni.

I would like to get feedback from you about PR.

Thanks