~bigbes/core-go

55ab6c4b4a6d8850292bb31f27c135686c689166 — Simon Martin 1 year, 4 months ago 29a3ebf
config: add missing private ip ranges

I noticed that 172.16.0.0/12 is missing from the default private IP
address space; following a quick discussion in [1], this patches adds
it, as well as link local ranges.

[1] https://lists.sr.ht/~sircmpwn/sr.ht-dev/%3C20241218140750.2393901-1-robin@jarry.cc%3E

Fixes: deb699c9d01a ("add global internal-ipnet setting")
Signed-off-by: Simon Martin <simon@nasilyan.com>
1 files changed, 3 insertions(+), 1 deletions(-)

M config/config.go
M config/config.go => config/config.go +3 -1
@@ 85,7 85,9 @@ func LoadConfig(defaultAddr string) ini.File {

	nets, ok := config.Get("sr.ht", "internal-ipnet")
	if !ok {
		nets = "127.0.0.0/8,192.168.0.0/16,10.0.0.0/8,::1/128,fc00::/7"
		nets = "127.0.0.0/8,::1/128," + // Loopback
			"10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,fc00::/7," + // Private
			"169.254.0.0/16,fe80::/64" // Link local
	}
	for _, n := range strings.Split(nets, ",") {
		_, net, err := net.ParseCIDR(n)