Practical way to define named ports (automatically resolved version of `/etc/services`)?
0
votes
0
answers
36
views
[Named ports can be defined in
/etc/services
](https://unix.stackexchange.com/questions/611406/how-to-assign-a-friendly-name-to-a-port-number-in-linux) but none of curl
, http.Get()
(Go) or reqwest::get()
(Rust) [respects the definition](https://stackoverflow.com/questions/18182076/ssh-port-issuecurl-6-couldnt-resolve-host-127-0-0-1ssh) .
While it is possible to manually lookup the integer port number by the service name via [libc's getservbyname()
](https://linux.die.net/man/3/getservbyname) or [getent
command](https://stackoverflow.com/a/8497399/8776746) , it would be great if there is any way to define named ports which are transparently (automatically) resolved by any network applications such as curl
.
Is there any such way?
Asked by ynn
(998 rep)
Feb 2, 2025, 11:47 AM