almost completely working
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
a36fe665e9
commit
f8ae1dee50
6
https.go
6
https.go
|
@ -6,10 +6,10 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func https() {
|
func https() {
|
||||||
http.HandleFunc("/", okHandler)
|
// http.HandleFunc("/", okHandler)
|
||||||
|
|
||||||
certPath := "/etc/letsencrypt/live/yourdomain.com/fullchain.pem"
|
certPath := "/etc/letsencrypt/live/go.wit.com/fullchain.pem"
|
||||||
keyPath := "/etc/letsencrypt/live/yourdomain.com/privkey.pem"
|
keyPath := "/etc/letsencrypt/live/go.wit.com/privkey.pem"
|
||||||
|
|
||||||
err := http.ListenAndServeTLS(":443", certPath, keyPath, nil)
|
err := http.ListenAndServeTLS(":443", certPath, keyPath, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -0,0 +1,253 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
/*
|
||||||
|
func indexHtml(w http.ResponseWriter) {
|
||||||
|
realurl = "https://" + realurl
|
||||||
|
|
||||||
|
log.Info("go repo =", gourl, "real url =", realurl)
|
||||||
|
fmt.Fprintln(w, "<!DOCTYPE html>")
|
||||||
|
fmt.Fprintln(w, "<html>")
|
||||||
|
fmt.Fprintln(w, "<head>")
|
||||||
|
// fmt.Fprintln(w,
|
||||||
|
fmt.Fprintln(w, "<meta name=\"go-import\" content=\"", gourl, "git", realurl + "\">")
|
||||||
|
fmt.Fprintln(w, "<meta name=\"go-source\" content=\"", gourl, realurl, realurl + "/tree/master{/dir}", realurl + "tree/master{/dir}/{file}#L{line}", "\"", ">")
|
||||||
|
|
||||||
|
fmt.Fprintln(w, "<meta http-equiv=\"refresh\" content=\"0; url=" + realurl + "\">")
|
||||||
|
fmt.Fprintln(w, "</head>")
|
||||||
|
fmt.Fprintln(w, "<body>")
|
||||||
|
fmt.Fprintln(w, "Nothing to see here. Please <a href=\"" + realurl + "\">move along</a>.\"")
|
||||||
|
fmt.Fprintln(w, "</body>")
|
||||||
|
fmt.Fprintln(w, "</html>")
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
indexHeader(w)
|
||||||
|
indexBodyStart(w)
|
||||||
|
indexBodyEnd(w)
|
||||||
|
*/
|
||||||
|
|
||||||
|
func indexHeader(w http.ResponseWriter) {
|
||||||
|
fmt.Fprintln(w, "<!DOCTYPE html>")
|
||||||
|
fmt.Fprintln(w, "<html>")
|
||||||
|
fmt.Fprintln(w, " <head>")
|
||||||
|
fmt.Fprintln(w, " <link rel=\"stylesheet\" href=\"skeleton.v2.css\" />")
|
||||||
|
fmt.Fprintln(w, " <style>")
|
||||||
|
fmt.Fprintln(w, " #footer {")
|
||||||
|
fmt.Fprintln(w, " position: fixed;")
|
||||||
|
fmt.Fprintln(w, " padding: 1% 0% 1% 0%; /* top left bottom right */")
|
||||||
|
fmt.Fprintln(w, " bottom: 0;")
|
||||||
|
fmt.Fprintln(w, " width: 100%;")
|
||||||
|
fmt.Fprintln(w, " /* Height of the footer*/")
|
||||||
|
fmt.Fprintln(w, " height: 40px;")
|
||||||
|
fmt.Fprintln(w, " background: lightgrey;")
|
||||||
|
fmt.Fprintln(w, " }")
|
||||||
|
fmt.Fprintln(w, " </style>")
|
||||||
|
fmt.Fprintln(w, " </head>")
|
||||||
|
fmt.Fprintln(w, "</html>")
|
||||||
|
}
|
||||||
|
|
||||||
|
func indexBodyStart(w http.ResponseWriter) {
|
||||||
|
// fmt.Fprintln(w, "
|
||||||
|
fmt.Fprintln(w, " <body>")
|
||||||
|
fmt.Fprintln(w, " <div class=\"container\">")
|
||||||
|
fmt.Fprintln(w, " <div class=\"row\">")
|
||||||
|
fmt.Fprintln(w, " <table class=\"u-full-width\">")
|
||||||
|
fmt.Fprintln(w, " <thead>")
|
||||||
|
fmt.Fprintln(w, " <tr>")
|
||||||
|
fmt.Fprintln(w, " <th>Package</th>")
|
||||||
|
fmt.Fprintln(w, " <th>go get</th>")
|
||||||
|
fmt.Fprintln(w, " <th>Authoritative sources (IPv6 only)</th>")
|
||||||
|
fmt.Fprintln(w, " <th>github mirror</th>")
|
||||||
|
fmt.Fprintln(w, " <th>Documentation</th>")
|
||||||
|
fmt.Fprintln(w, " </tr>")
|
||||||
|
fmt.Fprintln(w, " </thead>")
|
||||||
|
fmt.Fprintln(w, " <tbody>")
|
||||||
|
fmt.Fprintln(w, "")
|
||||||
|
}
|
||||||
|
|
||||||
|
func indexBodyEnd(w http.ResponseWriter) {
|
||||||
|
// fmt.Fprintln(w, "
|
||||||
|
fmt.Fprintln(w, " </tbody>")
|
||||||
|
fmt.Fprintln(w, " </table>")
|
||||||
|
fmt.Fprintln(w, " </div>")
|
||||||
|
fmt.Fprintln(w, " </div>")
|
||||||
|
fmt.Fprintln(w, " </body>")
|
||||||
|
fmt.Fprintln(w, " </html>")
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
|
||||||
|
|
||||||
|
<tr> <td><h5>log/ (needed for the gui)</h5></td> <td></td> <td></td> <td></td> <td></td> </tr>
|
||||||
|
<tr>
|
||||||
|
<td>log</td>
|
||||||
|
<td> <a href="//go.wit.com/log">go.wit.com/log</a></td>
|
||||||
|
<td> <a href="//git.wit.org/wit/log">git.wit.org/wit/log</a></td>
|
||||||
|
<td> <a href="//github.com/wit-go/log">github.com/wit-go/log</a></td>
|
||||||
|
<td> <a href="//pkg.go.dev/go.wit.com/log"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr> <td></td> <td></td> <td></td> <td></td> <td></td> </tr>
|
||||||
|
|
||||||
|
<tr> <td><h5>gui/ packages</h5></td> <td></td> <td></td> <td></td> <td></td> </tr>
|
||||||
|
<tr>
|
||||||
|
<td>gui/gui</td>
|
||||||
|
<td> <a href="//go.wit.com/gui/gui">go.wit.com/gui/gui</a></td>
|
||||||
|
<td> <a href="//git.wit.org/gui/gui">git.wit.org/gui/gui</a></td>
|
||||||
|
<td> <a href="//github.com/wit-go/gui">github.com/wit-go/gui</a></td>
|
||||||
|
<td> <a href="//pkg.go.dev/go.wit.com/gui/gui"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>gui/widget</td>
|
||||||
|
<td> <a href="//go.wit.com/gui/widget">go.wit.com/gui/widget</a></td>
|
||||||
|
<td> <a href="//git.wit.org/gui/widget">git.wit.org/gui/widget</a></td>
|
||||||
|
<td> <a href="//github.com/wit-go/widget">github.com/wit-go/widget</a></td>
|
||||||
|
<td> <a href="//pkg.go.dev/go.wit.com/gui/widget"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>gui/gadgets</td>
|
||||||
|
<td> <a href="//go.wit.com/gui/gadgets">go.wit.com/gui/gadgets</a></td>
|
||||||
|
<td> <a href="//git.wit.org/gui/gadgets">git.wit.org/gui/gadgets</a></td>
|
||||||
|
<td> <a href="//github.com/wit-go/gadgets">github.com/wit-go/gadgets</a></td>
|
||||||
|
<td> <a href="//pkg.go.dev/go.wit.com/gui/gadgets"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>gui/toolkits</td>
|
||||||
|
<td> <a href="//go.wit.com/gui/toolkits">go.wit.com/gui/toolkits</a></td>
|
||||||
|
<td> <a href="//git.wit.org/gui/toolkits">git.wit.org/gui/toolkits</a></td>
|
||||||
|
<td> <a href="//github.com/wit-go/toolkits">github.com/wit-go/toolkits</a></td>
|
||||||
|
<td> <a href="//pkg.go.dev/go.wit.com/gui/toolkits"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>gui/debugger</td>
|
||||||
|
<td> <a href="//go.wit.com/gui/debugger">go.wit.com/gui/debugger</a></td>
|
||||||
|
<td> <a href="//git.wit.org/gui/debugger">git.wit.org/gui/debugger</a></td>
|
||||||
|
<td> <a href="//github.com/wit-go/debugger">github.com/wit-go/debugger</a></td>
|
||||||
|
<td> <a href="//pkg.go.dev/go.wit.com/gui/debugger"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>gui/examples</td>
|
||||||
|
<td> <a href="//go.wit.com/gui/examples">go.wit.com/gui/examples</a></td>
|
||||||
|
<td> <a href="//git.wit.org/gui/examples">git.wit.org/gui/examples</a></td>
|
||||||
|
<td> <a href="//github.com/wit-go/examples">github.com/wit-go/examples</a></td>
|
||||||
|
<td> </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>gui/digitalocean</td>
|
||||||
|
<td> <a href="//go.wit.com/gui/digitalocean">go.wit.com/gui/digitalocean</a></td>
|
||||||
|
<td> <a href="//git.wit.org/gui/digitalocean">git.wit.org/gui/digitalocean</a></td>
|
||||||
|
<td> </td>
|
||||||
|
<td> <a href="//pkg.go.dev/go.wit.com/gui/digitalocean"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>gui/cloudflare</td>
|
||||||
|
<td> <a href="//go.wit.com/gui/cloudflare">go.wit.com/gui/cloudflare</a></td>
|
||||||
|
<td> <a href="//git.wit.org/gui/cloudflare">git.wit.org/gui/cloudflare</a></td>
|
||||||
|
<td> </td>
|
||||||
|
<td> <a href="//pkg.go.dev/go.wit.com/gui/cloudflare"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr> <td></td> <td></td> <td></td> <td></td> <td></td> </tr>
|
||||||
|
<tr> <td><h5>Applications</h5></td> <td></td> <td></td> <td></td> <td></td> </tr>
|
||||||
|
<tr>
|
||||||
|
<td>control-panel-dns</td>
|
||||||
|
<td> <a href="//go.wit.com/apps/control-panel-dns">go.wit.com/apps/control-panel-dns</a></td>
|
||||||
|
<td> <a href="//git.wit.org/jcarr/control-panel-dns">git.wit.org/jcarr/control-panel-dns</a></td>
|
||||||
|
<td></td>
|
||||||
|
<td> <a href="//pkg.go.dev/go.wit.com/apps/control-panels-dns"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>control-panel-digitalocean</td>
|
||||||
|
<td> <a href="//go.wit.com/apps/control-panel-digitalocean">go.wit.com/apps/control-panel-digitalocean</a></td>
|
||||||
|
<td> <a href="//git.wit.org/wit/control-panel-digitalocean">git.wit.org/wit/control-panel-digitalocean</a></td>
|
||||||
|
<td></td>
|
||||||
|
<td> <a href="//pkg.go.dev/go.wit.com/apps/control-panel-digitalocean"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>control-panel-cloudflare</td>
|
||||||
|
<td> <a href="//go.wit.com/apps/control-panel-cloudflare">go.wit.com/apps/control-panel-cloudflare</a></td>
|
||||||
|
<td> <a href="//git.wit.org/wit/control-panel-cloudflare">git.wit.org/wit/control-panel-cloudflare</a></td>
|
||||||
|
<td></td>
|
||||||
|
<td> <a href="//pkg.go.dev/go.wit.com/control-panels/cloudflare"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<tr>
|
||||||
|
<td>control-panel-cloudflare</td>
|
||||||
|
<td> <a href="//go.wit.com/control-panel-cloudflare">go.wit.com/control-panel-cloudflare</a></td>
|
||||||
|
<td> <a href="//git.wit.org/wit/control-panel-cloudflare">git.wit.org/wit/control-panel-cloudflare</a></td>
|
||||||
|
<td> <a href="//github.com/wit-go/control-panel-cloudflare">github.com/wit-go/control-panel-cloudflare</a></td>
|
||||||
|
<td> <a href="//pkg.go.dev/go.wit.com/control-panel-cloudflare"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||||
|
</tr>
|
||||||
|
-->
|
||||||
|
|
||||||
|
<tr> <td></td> <td></td> <td></td> <td></td> <td></td> </tr>
|
||||||
|
<tr> <td><h5>Support packages</h5></td> <td></td> <td></td> <td></td> <td></td> </tr>
|
||||||
|
<!--
|
||||||
|
<tr>
|
||||||
|
<td>go-arg</td>
|
||||||
|
<td> <a href="//go.wit.com/arg">go.wit.com/arg</a></td>
|
||||||
|
<td> <a href="//git.wit.org/gui/arg">git.wit.org/gui/arg</a></td>
|
||||||
|
<td> <a href="//github.com/wit-go/shell">github.com/alexflint/go-arg</a></td>
|
||||||
|
<td> <a href="//pkg.go.dev/go.wit.com/shell"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||||
|
</tr>
|
||||||
|
-->
|
||||||
|
<tr>
|
||||||
|
<td>arg</td>
|
||||||
|
<td> <a href="//go.wit.com/arg">go.wit.com/arg</a></td>
|
||||||
|
<td> <a href="//git.wit.org/wit/arg">git.wit.org/wit/arg</a></td>
|
||||||
|
<td> <a href="//github.com/wit-go/go-arg">github.com/wit-go/go-arg</a></td>
|
||||||
|
<td> <a href="//pkg.go.dev/go.wit.com/arg"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>spew</td>
|
||||||
|
<td> <a href="//go.wit.com/spew">go.wit.com/spew</a></td>
|
||||||
|
<td> <a href="//git.wit.org/wit/spew">git.wit.org/wit/spew</a></td>
|
||||||
|
<td> <a href="//github.com/wit-go/spew">github.com/wit-go/spew</a></td>
|
||||||
|
<td> <a href="//pkg.go.dev/go.wit.com/spew"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>dnssec</td>
|
||||||
|
<td> <a href="//go.wit.com/dnssec">go.wit.com/dnssec</a></td>
|
||||||
|
<td> <a href="//git.wit.org/wit/dnssec">git.wit.org/wit/dnssec</a></td>
|
||||||
|
<td> <a href="//github.com/wit-go/dnssec">github.com/wit-go/dnssec</a></td>
|
||||||
|
<td> <a href="//pkg.go.dev/go.wit.com/dnssec"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>shell</td>
|
||||||
|
<td> <a href="//go.wit.com/shell">go.wit.com/shell</a></td>
|
||||||
|
<td> <a href="//git.wit.org/wit/shell">git.wit.org/wit/shell</a></td>
|
||||||
|
<td> <a href="//github.com/wit-go/shell">github.com/wit-go/shell</a></td>
|
||||||
|
<td> <a href="//pkg.go.dev/go.wit.com/shell"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td> <a href=""></a> </td>
|
||||||
|
<td> <a href=""> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||||
|
</tr>
|
||||||
|
-->
|
||||||
|
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--
|
||||||
|
<center>
|
||||||
|
<div id="footer">
|
||||||
|
simple go git repo list like <a href=http://go.uber.org/>go.uber.org</a><p>
|
||||||
|
</div>
|
||||||
|
</center>
|
||||||
|
-->
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
*/
|
15
main.go
15
main.go
|
@ -20,6 +20,16 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
doGui(w, url, repourl)
|
doGui(w, url, repourl)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if tmp == "/" {
|
||||||
|
findFile(w, "files/index.html")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if tmp == "/new" {
|
||||||
|
indexHeader(w)
|
||||||
|
indexBodyStart(w)
|
||||||
|
indexBodyEnd(w)
|
||||||
|
return
|
||||||
|
}
|
||||||
if tmp == "/test" {
|
if tmp == "/test" {
|
||||||
findFile(w, "files/repo.html")
|
findFile(w, "files/repo.html")
|
||||||
return
|
return
|
||||||
|
@ -28,10 +38,6 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
findFile(w, "files/skeleton.v2.css")
|
findFile(w, "files/skeleton.v2.css")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if tmp == "/gui" {
|
|
||||||
// doGui(w, "/gui/gui")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
fmt.Fprintln(w, "BAD", tmp)
|
fmt.Fprintln(w, "BAD", tmp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,6 +74,7 @@ func main() {
|
||||||
*/
|
*/
|
||||||
readconfigfile()
|
readconfigfile()
|
||||||
http.HandleFunc("/", okHandler)
|
http.HandleFunc("/", okHandler)
|
||||||
|
https()
|
||||||
err := http.ListenAndServe(":80", nil)
|
err := http.ListenAndServe(":80", nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("Error starting server:", err)
|
log.Println("Error starting server:", err)
|
||||||
|
|
Loading…
Reference in New Issue