When I configure:
listen = 0.0.0.0:1966 [::]:1966
ERROR - Address already in use (os error 98)
lsof shows noone is listening on port 1966. (There is another Gemini server on port 1965.)
Apparently, stargazer conflicts with itself. If I listen only on
[::]:1966, it works. Whether this will have the intended effect (listening both with IPv4 and IPv6) depends on the OS.
What OS are you using? I assume Linux. After doing some research I believe the problem is that by default in Rust on Linux, when listening on IPv6 it also listens on IPv4 and I'm not hanging that case.
Yes, it is Linux. If I listen on IPv6 it works with both v4 and v6 but it is configurable. It is probably not because of Rust but it is a kernel choice, configurable with
sysctl net/ipv6/bindv6only. In my case (it is the default on Debian):
% cat /proc/sys/net/ipv6/bindv6only 0
This is why it works. This is a painful problem because it means the result of a given configuration file will depend on the system. I don't know for Rust but Go https://github.com/golang/go/issues/679 had a similar issue.
I'll probably need another library to fix this (net2 I think). The way stargazer should behave is that if you have only IPv6 specified it should do whatever the system is configured to do. But if you have both specified in your config it should always do both. You think that's responsible? Or should I always set IPv6 only if only IPv6 is specified in the config?
With the last version of stargazer (which apparently binds only on IPv6 when you give it
[::], it works, I can have both
[::]on the same port, which seems sensible to me. Thanks.