Add Unix socket listener

Closes: https://todo.sr.ht/~emersion/soju/51
This commit is contained in:
Simon Ser 2021-03-16 09:27:40 +01:00
parent 67fb669434
commit 061347f9f9
2 changed files with 12 additions and 0 deletions

View File

@ -114,6 +114,17 @@ func main() {
log.Printf("serving %q: %v", listen, err)
}
}()
case "unix":
ln, err := net.Listen("unix", u.Path)
if err != nil {
log.Fatalf("failed to start listener on %q: %v", listen, err)
}
ln = proxyProtoListener(ln, srv)
go func() {
if err := srv.Serve(ln); err != nil {
log.Printf("serving %q: %v", listen, err)
}
}()
case "wss":
addr := u.Host
if _, _, err := net.SplitHostPort(addr); err != nil {

View File

@ -82,6 +82,7 @@ The following directives are supported:
omitted: 6697)
- _irc+insecure://[host][:port]_ listens with plain-text over TCP (default
port if omitted: 6667)
- _unix:///<path>_ listens on a Unix domain socket
- _wss://[host][:port]_ listens for WebSocket connections over TLS (default
port: 443)
- _ws+insecure://[host][:port]_ listens for plain-text WebSocket