-
Notifications
You must be signed in to change notification settings - Fork 140
Description
I've stumbled upon this interesting package during my research on how to serve contents of iso file over http.
Definitely, I could loop-mount it and just serve static files from mount point, but the idea of implementing it completely in go took me over.
So, my web part is implemented using gin-gonik and it has a very handy FileFromFS method, that operates through standard io.FS interface.
I'm quite a new gopher and do not have enough knowlegde to improve such a big go projects, so I've started with a wrapper around go-diskfs. It, actually work, but, it's very much suboptimal in many ways as it does not have access to the internals of this project.
If this would be implemented, the actual code of serving files from iso will boil down to the following:
func main() {
app := gin.Default()
disk, err := diskfs.Open("/path/to/image.iso")
if err != nil {
log.Fatalf("failed to open file: %s", err)
}
isofs, err := disk.GetFilesystem(0)
if err != nil {
log.Fatalf("failed to get partition 0: %s", err)
}
app.GET("/iso/*path", func(c *gin.Context) {
c.FileFromFS(c.Param("path"), http.FS(isofs))
})
a.Run(":8080")
}Any help will be appreciated!
If you're interested in the idea behind this - it's quite trivial: to serve linux distribution repos from the iso file over http for group access.