~emersion/soju

eb524bfea4f364e437dd9871c91f0daa96b5cc92 — Egor a month ago f5612ea
Add unix domain socket listeners for HTTP and WS
2 files changed, 24 insertions(+), 0 deletions(-)

M cmd/soju/main.go
M doc/soju.1.scd
M cmd/soju/main.go => cmd/soju/main.go +20 -0
@@ 275,6 275,16 @@ func main() {
					log.Fatalf("serving %q: %v", listen, err)
				}
			}()
		case "ws+unix":
			ln, err := net.Listen("unix", u.Path)
			if err != nil {
				log.Fatalf("failed to start listener on %q: %v", listen, err)
			}
			go func() {
				if err := http.Serve(ln, srv); err != nil {
					log.Fatalf("serving %q: %v", listen, err)
				}
			}()
		case "ident":
			if srv.Identd == nil {
				srv.Identd = identd.New()


@@ 366,6 376,16 @@ func main() {
					log.Fatalf("serving %q: %v", listen, err)
				}
			}()
		case "http+unix":
			ln, err := net.Listen("unix", u.Path)
			if err != nil {
				log.Fatalf("failed to start listener on %q: %v", listen, err)
			}
			go func() {
				if err := http.Serve(ln, httpMux); err != nil {
					log.Fatalf("serving %q: %v", listen, err)
				}
			}()
		default:
			log.Fatalf("failed to listen on %q: unsupported scheme", listen)
		}

M doc/soju.1.scd => doc/soju.1.scd +4 -0
@@ 92,10 92,14 @@ The following directives are supported:
	  and handles WebSocket requests at endpoint _/socket_
	- _http+insecure://[host][:port]_ listens for plain-text HTTP connections
	  (default port: 80) and handles WebSocket requests at endpoint _/socket_
	- _http+unix://<path>_ listens for plain-text HTTP connections on a Unix
	  domain socket and handles WebSocket requests at endpoint _/socket_
	- _wss://[host][:port]_ listens for WebSocket connections over TLS (default
	  port: 443)
	- _ws+insecure://[host][:port]_ listens for plain-text WebSocket
	  connections (default port: 80)
	- _ws+unix://<path>_ listens for plain-text WebSocket connections on a Unix
	  domain socket
	- _ident://[host][:port]_ listens for plain-text ident connections (default
	  port: 113)
	- _http+prometheus://localhost:<port>_ listens for plain-text HTTP