would be great if you can add support for unix socket as it provides better performance and security, and with Go it's very simple to add it.
for example,
regular tcp host:port
net.Listen("tcp", "127.0.0.1:8080")
With Unix socket it's simply that:
net.Listen("unix", "/run/leafwiki/leafwiki.sock")
the path for it is just my example but it will be set to whatever the user wants
the only thing to do is chmod the file to 660 after it is created.
os.Chmod("/run/leafwiki/leafwiki.sock", 0660);
Also a good idea is before doing "net.Listen" just check if the file already exist from a previous run and delete it if it exists and then net.listen + chmod.
I am transferring to leafwiki from memos which was what I was using before. They have unix socket support and I was using that.
line 100 starts the code:
https://github.com/usememos/memos/blob/5f7e038aa76a604e63122eca23684b3b68342841/server/server.go#L110
and on the command line they have "--unix-sock" where I put "/path/to/file.sock" and with that it's no need for any host:port
It's a useful feature for anybody who knows it ;)
would be great if you can add support for unix socket as it provides better performance and security, and with Go it's very simple to add it.
for example,
regular tcp host:port
net.Listen("tcp", "127.0.0.1:8080")With Unix socket it's simply that:
net.Listen("unix", "/run/leafwiki/leafwiki.sock")the path for it is just my example but it will be set to whatever the user wants
the only thing to do is chmod the file to 660 after it is created.
os.Chmod("/run/leafwiki/leafwiki.sock", 0660);Also a good idea is before doing "net.Listen" just check if the file already exist from a previous run and delete it if it exists and then net.listen + chmod.
I am transferring to leafwiki from memos which was what I was using before. They have unix socket support and I was using that.
line 100 starts the code:
https://github.com/usememos/memos/blob/5f7e038aa76a604e63122eca23684b3b68342841/server/server.go#L110
and on the command line they have "--unix-sock" where I put "/path/to/file.sock" and with that it's no need for any host:port
It's a useful feature for anybody who knows it ;)