Live data from Hacker News

Bashbro – Make Any Comp a Web-Based File Server

github.com

11–20 of 52 posts

Re: Bashbro – Make Any Comp a Web-Based File Server

#13
post #8

What is wrong with "python -m http.server"?

It requires Python. Bashbro, on the other hand, seems to require socat. I wonder if there's any bash-istic method of listening to a port...

For Bash with `--enable-net-redirections` set at configure time (not a default, not enabled on popular distros to my knowledge), `/dev/{udp,tcp}/$host/$port` is available for this purpose.

Re: Bashbro – Make Any Comp a Web-Based File Server

#14
post #8

What is wrong with "python -m http.server"?

It requires Python. Bashbro, on the other hand, seems to require socat. I wonder if there's any bash-istic method of listening to a port...

gawk can: https://www.gnu.org/software/gawk/manual/gawkinet/gawkinet.h...

Re: Bashbro – Make Any Comp a Web-Based File Server

#15
post #10

This is cool, but there's currently an overload of ports assigned on my system. Is there a way to manage all these port numbers? And why can't we use strings, even if just locally? And what do people use to allocate port numbers in a way that you'll never get clashes?

You can consider the use of Unix sockets (sockets as named files). There are lots of limitations but the most pervasive and frustrating of those is the general lack of support for them across apps.

You could set up Nginx and some local subdomains to reverse proxy to the intended applications, regardless of whether they're hosted on Unix sockets or plain ports, if that makes accessing them easier. It definitely makes them easier to make accessible outside of the local machine.

Re: Bashbro – Make Any Comp a Web-Based File Server

#16
post #10

This is cool, but there's currently an overload of ports assigned on my system. Is there a way to manage all these port numbers? And why can't we use strings, even if just locally? And what do people use to allocate port numbers in a way that you'll never get clashes?

You can consider the use of Unix sockets (sockets as named files). There are lots of limitations but the most pervasive and frustrating of those is the general lack of support for them across apps. You could set up Nginx and some local subdomains to reverse proxy to the intended applications, regardless of whether they're hosted on Unix sockets or plain ports, if that makes accessing them easier. It definitely makes…

Thanks! But how would I start bashbro in this case, and assign it to the label "myfiles"? I suspect I need additional scripting to make this easy.

Re: Bashbro – Make Any Comp a Web-Based File Server

#17

Earlier quoted context omitted.

It requires Python. Bashbro, on the other hand, seems to require socat. I wonder if there's any bash-istic method of listening to a port...

For Bash with `--enable-net-redirections` set at configure time (not a default, not enabled on popular distros to my knowledge), `/dev/{udp,tcp}/$host/$port` is available for this purpose.

Does anyone know if there is a good reason to disable net-redirections?

Re: Bashbro – Make Any Comp a Web-Based File Server

#18
post #16

Earlier quoted context omitted.

You can consider the use of Unix sockets (sockets as named files). There are lots of limitations but the most pervasive and frustrating of those is the general lack of support for them across apps. You could set up Nginx and some local subdomains to reverse proxy to the intended applications, regardless of whether they're hosted on Unix sockets or plain ports, if that makes accessing them easier. It definitely makes…

Thanks! But how would I start bashbro in this case, and assign it to the label "myfiles"? I suspect I need additional scripting to make this easy.

https://github.com/victrixsoft/bashbro/blob/c543d5d42ba2425f... needs amending to listen to a Unix socket instead of a port if that's something you'd like to contribute.

As for using Nginx, you should be able to install Nginx and enable its service and in that way immediately get a local HTTP server. You can then edit the config such that requests for the Host `myfiles.localhost` are `proxy_pass ...` to your bashbro server. Then `http://myfiles.localhost` in your browser should just work.

Re: Bashbro – Make Any Comp a Web-Based File Server

#19
post #10

This is cool, but there's currently an overload of ports assigned on my system. Is there a way to manage all these port numbers? And why can't we use strings, even if just locally? And what do people use to allocate port numbers in a way that you'll never get clashes?

You can add things to /etc/services and software that properly uses getservbyname(3) when binding to a port can use those names.

Re: Bashbro – Make Any Comp a Web-Based File Server

#20
post #16

Earlier quoted context omitted.

Thanks! But how would I start bashbro in this case, and assign it to the label "myfiles"? I suspect I need additional scripting to make this easy.

https://github.com/victrixsoft/bashbro/blob/c543d5d42ba2425f... needs amending to listen to a Unix socket instead of a port if that's something you'd like to contribute. As for using Nginx, you should be able to install Nginx and enable its service and in that way immediately get a local HTTP server. You can then edit the config such that requests for the Host `myfiles.localhost` are `proxy_pass ...` to your bashbro…

Ok, I appreciate your suggestions. But now I'm thinking about some utility where you can say:

    run-http-service myfiles bashbro -s -p PORT
And then it would just allocate a new port (clash-free), invoke bashbro with the given flags and substitute PORT by the newly allocated port number, and such that it uses myfiles.localhost as the domain. And when bashbro exits, the port number is garbage collected. Somehow, it feels like this should already exist ...
Post reply on HN