This commit is contained in:
parent
c82256e5a1
commit
c185854e14
2 changed files with 8 additions and 3 deletions
9
main.go
9
main.go
|
@ -28,13 +28,14 @@ func init() {
|
||||||
flag.StringVar(&certificatePath, "certificatePath", "", "capsule certificate path")
|
flag.StringVar(&certificatePath, "certificatePath", "", "capsule certificate path")
|
||||||
flag.StringVar(&fileSrvHost, "fileSrvHost", "", "file push server host")
|
flag.StringVar(&fileSrvHost, "fileSrvHost", "", "file push server host")
|
||||||
flag.StringVar(&fileSrvPort, "fileSrvPort", "", "file push server port")
|
flag.StringVar(&fileSrvPort, "fileSrvPort", "", "file push server port")
|
||||||
|
flag.Parse()
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
certificates := &certificate.Store{}
|
certificates := &certificate.Store{}
|
||||||
certificates.Register(hostname)
|
certificates.Register(hostname)
|
||||||
if err := certificates.Load(certificatePath); err != nil {
|
if err := certificates.Load(certificatePath); err != nil {
|
||||||
log.Fatal(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
mux := &gemini.Mux{}
|
mux := &gemini.Mux{}
|
||||||
|
@ -74,7 +75,11 @@ func renderIndex(lang string, w gemini.ResponseWriter) {
|
||||||
summery := GetSummery()
|
summery := GetSummery()
|
||||||
fmt.Println(summery)
|
fmt.Println(summery)
|
||||||
tree := TSummery{}
|
tree := TSummery{}
|
||||||
json.Unmarshal([]byte(summery), &tree)
|
err = json.Unmarshal([]byte(summery), &tree)
|
||||||
|
if err != nil {
|
||||||
|
w.WriteHeader(gemini.StatusTemporaryFailure, "Internal server error")
|
||||||
|
return
|
||||||
|
}
|
||||||
fmt.Println(tree)
|
fmt.Println(tree)
|
||||||
|
|
||||||
categories := ""
|
categories := ""
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetSummery() string {
|
func GetSummery() string {
|
||||||
conn, err := net.Dial("tcp", "127.0.0.1:8301")
|
conn, err := net.Dial("tcp", fileSrvHost+":"+fileSrvPort)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err.Error())
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue