···11+just a simple implementation of lrcd!
22+33+lrc.example.com.conf is an example nginx config file, probably if you wanna
44+self-host this you know what you're doing better than me, but for me, i wanted
55+to serve lrcdaemon with nginx, so my setup was just to copy the config file
66+into conf.d, rename the server_name directive to be correct for my base
77+domain, and then run `sudo certbot --nginx`
88+99+then you'd connect to the server through e.g. tty!xcvr by doing `:dial
1010+lrc.example.com`
1111+1212+it should be running right now at `lrc.moth11.net`, check it out with your
1313+lrc client!
1414+1515+of course to run the server, `go run .`
···1717 panic(err)
1818 }
1919 fmt.Println("serving lrcd on localhost:8080")
2020- http.ListenAndServe(":8080", server.WSHandler())
2020+ http.ListenAndServe(":8080", guessIfUpgradeFail(server))
2121+}
2222+2323+func guessIfUpgradeFail(server *lrcd.Server) http.HandlerFunc {
2424+ return func(w http.ResponseWriter, r *http.Request) {
2525+ if r.Header.Get("Connection") != "upgrade" {
2626+ fmt.Fprintf(w, `hi! i am an lrc server
2727+ i think you should try connecting to me with an lrc client (e.g. tty!xcvr)
2828+ it'll be more fun for us both.
2929+ currently connected: %d`, server.Connected())
3030+ } else {
3131+ server.WSHandler()(w, r)
3232+ }
3333+ }
2134}