As a test I built and ran the u-root srvfiles command on 9front.

srvfiles is a dead-simple http server I used at google when I needed an
easy way to get files from here to there and did not have a lot of time to
fool around with keys and such.

I tried it again today, and it works fine, and made it easy for me to get
kernels from my 9front laptop to my mac to run qemu.

on 9front I run the command
srvfiles -d / -h 192.168.0.20
and I can then grab them from safari or whatever on osx.

Core code:
https://github.com/u-root/u-root/blob/main/cmds/exp/srvfiles/srvfiles.go
...
func maxAgeHandler(h http.Handler) http.Handler {
        return http.HandlerFunc(func(w http.ResponseWriter, r
*http.Request) {
                for _, v := range cacheHeaders {
                        if r.Header.Get(v) != "" {
                                r.Header.Del(v)
                        }
                }

                h.ServeHTTP(w, r)
        })
}

func main() {
        flag.Parse()
        http.Handle("/", maxAgeHandler(http.FileServer(http.Dir(*dir))))
        log.Fatal(http.ListenAndServe(net.JoinHostPort(*host, *port), nil))
}

I like using Go on Plan 9. It's the environment I like with the language I
like. I know there's been mention of Rust, but (1) I don't see it being
native, now or ever, and (2) I don't like it as much as Go. If you want a
"starter pack" for Go on Plan 9, I think u-root is not a bad place to look.
If you want to contribute more Plan 9 support to u-root, we would welcome
it.

Thanks

------------------------------------------
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/Tb13f273be9a2d368-M20ccfedae2cbd87a789820f0
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

Reply via email to