5 ms·
It's like someone should make a file... maybe in /etc ... and put short names for services in it... maybe it could be called /etc/services...
by zdw 6mo ago
It's like someone should make a file... maybe in /etc ... and put short names for services in it... maybe it could be called /etc/services...
- tolciho 6mo agoAnd then they might code up some sort of service lookup tool thingy to use on the train wreck that is the modern web. $ getent services gopher gopher 70/tcp
- otabdeveloper4 6mo agoHeck, maybe even `resolvectl service`?
- pratyahava 6mo agothis is a nice idea, but idk why, in macos if i do `nc -l 127.0.0.1 gopher` and then try to open url "http://127.0.0.1:gopher/ http://127.0.0.1:gopher/" - safari does not open it, no requests visible in the `nc` output. also `curl -v http://127.0.0.1:gopher/ http://127.0.0.1:gopher/` gives error message * URL rejected: Port number was not a decimal number between 0 and 65535 * Closing connection curl: (3) URL rejected: Port number was not a decimal number between 0 and 65535 so the ports are named, it is nice, but in practice it does not make life easier.
- bandie91 6mo ago> http://...:gopher is it http or gopher? :)
- pratyahava 6mo agoi chose gopher port just as an example. try with any other service name mapped to a port number from /etc/services and the result will be the same. the OP's goal was to use many http/https services, so we are talking about many http(s) services. i just wanted to make the point that even if you have service names in /etc/services, it is not possible to use that names easily to host/access http(s) services.
- skydhash 6mo agoThe names are the kind of servers that listen on those ports (by default) like ssh, telnet, http, and smtp. They are not subdomains or for URI parsing.
- pratyahava 6mo agoURI contains ":port" tho, but practically it is only digital number. the OP made a tool which helps them to avoid using port numbers. people commented in a way that looked like laughing at him, like he reinvented the wheel, and talking about /etc/services. well ok, i decided to try using /etc/services for the purpose of using names instead of port numbers. would it be possible to add "myapp 60001/tcp" to /etc/services and then work with "http://localhost:myapp"? NO! browsers do not translate these names into port numbers. netcat does. curl does not. so probably the OP's solution is not that questionable and really solved their need? and "good old friend /etc/services" is not useful for this? i dont know what it is useful for as running services on non-standard ports actually helps with hiding from security/vuln scanners and is practiced widely.
- skydhash 6mo agoMaybe the joke has gotten too far, but the point that most people have been trying to say is that the issue that the OP is trying to solve has been solved for years. It's called a reverse proxy. Doing the configuration automatically like OP does does not alter the fact that it is a reverse proxy. `/etc/services` serve a different purpose. Also URL parsing is a completely different matter. Browsers are primarily an HTTP(s) client. If you do not mention the ":port", it will try to connect to 80 (HTTP) or HTTPS (443). Because that the default ports for a web server. Other services have different port. So if your URL has the ftp scheme, the default port would be 21.
- jasonlotito 6mo agoWell, the entire context of this is https so anything else is immaterial. The only reason it would be gopher is if you didn't read the post or don't understand the basics of https.
- tharkun__ 6mo agoI know you're trying to be funny but ... technically it's 100% clear: You should talk HTTP, because that's the URL scheme here. The port makes no difference. You just happened to use a port by name. For all we know I run my HTTP server on some NFS related port so all the script kiddies try all the wrong exploits on it or something ;)
- Tepix 6mo agoAs bandie pointed out, you‘re explicitly making a http request. Duh. nc is for generic connections and handles it well.
- pratyahava 6mo agoi know, but the OP's goal was to host/access http(s) services with names and avoid port numbers, and gopher service name was chosen by me as an example. my point was that /etc/services cannot be used for the OP's need. if you host an http(s) service on port 11111 you can reach it with url http://127.1:11111 http://127.1:11111, but url http://127.1:vce/ http://127.1:vce/ would not work in most software. $ grep 11111 /etc/services vce 11111/udp # Viral Computing Environment (VCE) vce 11111/tcp # Viral Computing Environment (VCE)
- deleted 6mo ago[deleted]
- Tepix 6mo agoBut if you want to contact vce, why use „http“? It‘s not going to work
- SAI_Peregrinus 6mo agoTry http://127.0.0.1:hkp http://127.0.0.1:hkp instead of http://127.0.0.1:11371 http://127.0.0.1:11371 for an OpenPGP HTTP keyserver. HTTP will work, but using the service name won't. Does that make what they're trying to say clearer?
- pratyahava 6mo agothe question was "can we use port names from /etc/services instead of port numbers?" how about "ssh://git@ssh.github.com:https/golang/go.git" instead of "ssh://git@ssh.github.com:443/golang/go.git"? does not work, hmm.
- mrhottakes 6mo agoIf I curl my phone number it doesn't connect, that's strange
- mrhottakes 6mo agoSounds like you need an AI agent that can determine whether http and gopher are the same protocol
- pratyahava 6mo agoif you configure sshd to listen on port 443, does it become an https server? i was just trying to demondtrate: pick any port from /etc/services and try to use the name instead of port number. no, it does not work well when trying to use for local-hosting http(s) services. so to address the irony and sarcasm of the messages i was replying to: zdw: It's like someone should make a file... maybe in /etc ... and put short names for services in it... maybe it could be called /etc/services... tolciho: And then they might code up some sort of service lookup tool thingy to use on the train wreck that is the modern web. $ getent services gopher gopher 70/tcp
- tolciho 6mo agoMany clients also do not support getservent(3) or portmap or DNS SRV records or NIS or LDAP or ActiveDirectory so one might wonder why there are so many half-baked, failed, or overy complicated attempts at solving whatever the problem is here even before "AI has entered the chat".
- laurencerowe 6mo agoThis is not possible since it is ambiguous. It is impossible to parse “http://127.0.0.1:gopher/ http://127.0.0.1:gopher/“ since that would be valid as either “scheme://user:host/“ or “scheme://host:portname/“. “http://127.0.0.1:70/ http://127.0.0.1:70/“ is unambiguous since 70 is not a valid host.
- lloeki 6mo agoAnd if they want name resolution, maybe even names that reflect the scope of its location like .localhost or .internal
- tolciho 6mo agoVarious services have existed, such as portmap(8), though NFS and similar services have often suffered from the "too complicated to debug" problem where devops (then sysadmins) would try turning the system off and then back on again in the hopes of resolving the issue du jour. You might get lucky and determine that node number three (of many) was cursed and leave it switched off for the Season of Mammon, more commonly known as Christmas, and to retire it quietly, later. Hypothetically. Generally host and port mapping gets shoved somewhere into the configuration management layer and hopefully does not become too complicated (or have too many security holes) as this could vary from "configuration files and a few scripts" to database and services layers that few can debug, especially not a sysadmin at 3 AM in the morning running on an hour of bad sleep. Hypothetically.
- m463 6mo agobut you want security, so NIS+
- TomK32 6mo agoSure, but they are running web-apps they've vibe-coded (hence the .vibe tld) and for that use-case of many web apps that I run in docker containers I use nginx-proxy [0]. All the container needs is a VIRTUAL_HOST environment variable with the domain and what my router needs is an address entry for the wildcard subdomains. I even have nginx-proxy on a internet-accessible staging server. [0] https://github.com/nginx-proxy/nginx-proxy https://github.com/nginx-proxy/nginx-proxy
- huflungdung 6mo ago[dead]
- locknitpicker 6mo ago> It's like someone should make a file... maybe in /etc ... and put short names for services in it... maybe it could be called /etc/services... People shit-talk container orchestration systems like Kubernetes, but if anything they greatly simplified (if not completely eliminated) the need for this sort of network bookkeeping.
- nesarkvechnep 6mo agoYou forgot the /s at the end.
- adestefan 6mo agoAll our bookkeeping is now in YAML. Watch the spaces on your way out the door.
- sgarland 6mo agoAnd don’t forget to quote your port assignments and version strings.
- pirates 6mo agoHacker News loves to make snarky comments about everything to do with K8s and YAML all the time, and yet in my experience the amount of times an issue was caused by actual YAML can be counted on one hand. Way more often it’s developers who can’t figure out that their http library only supports 2 concurrent connections, or emit garbage/malformed log lines and then bitch that they can’t see their app logs because we dropped them, or can’t be fucked to do “kubectl describe” in their own developer namespace that they have full permission for. If you truly experience issues with just using YAML then you need to skill up probably.
- SAI_Peregrinus 6mo agoMost of the issues with YAML are really issues with people who think that since "configuration as code" is good, that "code as configuration" must also be good.
- npodbielski 6mo agoThis is exact problem I see with all of those vibe coded software: In few years everything will be super fragmented, everyone will be using their own set of tools, or vibe coding them, themselves. Communication between teams or even between team members will become very hard because of those differences. 'What do you mean production is down? On my vibe coded dashboard everything is green!'
- spiderfarmer 6mo agoWhy do people always assume that change is permanent? It's never. After decentralisation we always see decentralisation. After a period of growth, a decline will follow. After the vibe coding hype, consolidation will follow. After rain comes sunshine.
- npodbielski 6mo agoWell, I am forty years old. In twenty years I won't be working. We are in the dawn of AI software. If this will be decentralisation it will be at least 10 years of that. Probably more. So if fifteen or twenty years things will be going back to 'our normal' as we see today, I won't be concerned about all of it that much anymore. Perspective change with age considerably.
- teddyh 6mo agoIt’s the Lisp curse again. “[X] is so powerful that problems which are technical issues in other programming languages are social issues in [X].” — <https://www.winestockwebdesign.com/Essays/Lisp_Curse.html#main https://www.winestockwebdesign.com/Essays/Lisp_Curse.html#ma...>
- m463 6mo ago[dead]
- meitham 6mo agoPerhaps we could even make the file the port itself, perhaps calling it a “socket”? A “unix socket” would be a great name. If we could place all these files behind a local reverse proxy then we could use localhost/jekyll or localhost/fastapi. It’s just a dream
- fulafel 6mo agoIf the port number space was bigger, I wonder if we would have gotten a global naming service (ala DNS) for unique service names. You can still publish port numbers along with addresses in DNS though (SRV records).
- rdevilla 6mo agoNot modern enough. Unix is too low level, antiquated, and discriminates against those who just want to get shit done instead of reading manpages or documentation by hand.
- sgarland 6mo agoThis is the best example of Poe’s Law I’ve ever seen. Well done…?
- nullsanity 6mo ago[dead]
- loa_in_ 6mo agoWhat about identifying different instances of the same service?
- maeglin 6mo agoTop reply, and clearly based on the article's title rather than its content, as are the follow-ups. You're making this site worse. The article is short; go read it then come back and delete.
- nsowz 6mo ago[flagged]
- saidnooneever 6mo agoyou go and look in etc services for what is bound to port 5009. the article might not be the most useful but these comments are completely off the mark and stupid.
- imtringued 6mo ago[flagged]
- ai_slop_hater 6mo agoWhy?
- stavros 6mo agoWhat's up with the hate? It seemed like an interesting project to me, maybe not something I see myself using, but not something deserving hate.
- amelius 6mo agoYou have to be root to edit /etc/services ...
- necovek 6mo agoI am pretty convinced you need root on most systems to update DNS resolution mechanism system-wide (eg. to edit /etc/hosts or run a local DNS server and put that into /etc/resolv.conf).
- MarsIronPI 6mo agoTechnically you can set the HOSTALIASES variable to point to a custom hosts file, but that only works with programs that use gethostbyname(3). (Which is most of them? IDK.)
- qurren 6mo agoURLs already have default ports for service names as a feature. http:// means port 80 unless specified otherwise https:// means port 443 unless specified otherwise ftp:// means port 21 unless specified otherwise sftp:// means port 22 unless specified otherwise ... The practical solution for TFA is actually just an nginx server running on port 80 with proxy_pass location /blog/ { proxy_pass http://127.0.0.1:3000 ; } location /tensorboard/ { proxy_pass http://127.0.0.1:6006; } ...
- jameshart 6mo agoHow many little web servers work without issue when their root page is loaded from a path other than /?
- qurren 6mo agoIf that's your concern you can also do this server { listen 80; server_name "tensorboard.localhost"; location / { proxy_pass http://127.0.0.1:6006; } } server { listen 80; server_name "blog.localhost"; location / { proxy_pass http://127.0.0.1:3000; } } HTTP 1.1 and later will have the browser supply the domain name that was used to access the site, and even though *.localhost all resolve to 127.0.0.1, nginx will pluck out the correct configuration and proxy_pass the correct one.
- halJordan 6mo agoThat's because there defines in etc services (really the place where etc services gets its mapping). You're putting the cart in front of the horse
- jasonlotito 6mo agoNo, go ahead. Tell me how just using /etc/services does what this does. Because I'm calling bullshit. But go ahead. /etc/services, please, share with me how it's setup to do thing likes create the HTPS and makes it trusted and sets up the domain. Go ahead. Go ahead. You can ONLY use /etc/services. Or, you are admit you don't actually have a clue as to what /etc/services does.
- kjs3 6mo agoThat would mean not being able to vibe code up an entire app to deal with something as insurmountable as looking at a list of numbers and post it on HN for those sweet, sweet upvotes. Why would they not do that.
- xnx 6mo agoThe best way to find the right answer on the Internet is to slop-code a half-assed solution to a long-solved problem. https://meta.wikimedia.org/wiki/Cunningham%27s_Law https://meta.wikimedia.org/wiki/Cunningham%27s_Law Sidenote: A good AI would interject, Clippy-like, "It looks like you're trying to recreate /etc/services. Would you like me to explain what that is?"