package main import ( "fmt" "log" "net" "time" "git.pbiernat.dev/golang/ngkrok/internal/ngkrok" vhost "github.com/inconshreveable/go-vhost" ) func main() { addr, host, port := "::", "hop.pbiernat.dev", "18181" lst, err := net.Listen("tcp", net.JoinHostPort(addr, port)) if err != nil { log.Fatal(err) } vmux, err := vhost.NewHTTPMuxer(lst, 3*time.Second) if err != nil { log.Fatal(err) } defer vmux.Close() srv := ngkrok.NewServer(addr, host, port, vmux) go srv.Serve() log.Printf("NgKrok server [%s] ready!\n", host) for { conn, err := vmux.NextError() fmt.Println("vmux error:", err) if conn != nil { conn.Close() } } }