Remove a bunch of cruft (that also really exist in exampes/)

This commit is contained in:
James Mills 2017-06-20 23:36:40 -07:00
parent 1c3e82ceec
commit e670ccffff
No known key found for this signature in database
GPG Key ID: AC4C014F1440EBD6
3 changed files with 0 additions and 106 deletions

View File

@ -1,18 +0,0 @@
FROM golang:alpine
EXPOSE 70/tcp
ENTRYPOINT ["gopherd"]
CMD []
RUN \
apk add --update git && \
rm -rf /var/cache/apk/*
RUN mkdir -p /go/src/github.com/prologic/gopherproxy
WORKDIR /go/src/github.com/prologic/go-gopher
COPY . /go/src/github.com/prologic/go-gopher
RUN go get -v -d
RUN go install -v github.com/prologic/go-gopher/...

View File

@ -1,56 +0,0 @@
package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
"github.com/prologic/go-gopher"
)
var (
json = flag.Bool("json", false, "display gopher directory as JSON")
)
func main() {
var uri string
flag.Parse()
if len(flag.Args()) == 1 {
uri = flag.Arg(0)
} else {
uri = "gopher://gopher.floodgap.com/"
}
res, err := gopher.Get(uri)
if err != nil {
log.Fatal(err)
}
if res.Body != nil {
contents, err := ioutil.ReadAll(res.Body)
if err != nil {
log.Fatal(err)
}
fmt.Print(string(contents))
} else {
var (
bytes []byte
err error
)
if *json {
bytes, err = res.Dir.ToJSON()
} else {
bytes, err = res.Dir.ToText()
}
if err != nil {
log.Fatal(err)
}
fmt.Println(string(bytes))
}
}

View File

@ -1,32 +0,0 @@
package main
import (
"flag"
"log"
"os"
"github.com/prologic/go-gopher"
)
func cwd() string {
dir, err := os.Getwd()
if err != nil {
log.Fatal(err)
}
return dir
}
func main() {
var (
bind = flag.String("bind", ":70", "port to listen on")
host = flag.String("host", "localhost", "fqdn hostname")
root = flag.String("root", cwd(), "root directory to serve")
)
flag.Parse()
gopher.Handle("/", gopher.FileServer(gopher.Dir(*root)))
server := gopher.Server{Addr: *bind, Hostname: *host}
log.Fatal(server.ListenAndServe())
}