diff --git a/disk/disk.go b/diskwriter/diskwriter.go similarity index 99% rename from disk/disk.go rename to diskwriter/diskwriter.go index e32111b..7bc1914 100644 --- a/disk/disk.go +++ b/diskwriter/diskwriter.go @@ -1,4 +1,4 @@ -package disk +package diskwriter import ( crand "crypto/rand" diff --git a/rtpconn/webclient.go b/rtpconn/webclient.go index 203f516..ca11563 100644 --- a/rtpconn/webclient.go +++ b/rtpconn/webclient.go @@ -12,7 +12,7 @@ import ( "github.com/pion/webrtc/v3" "sfu/conn" - "sfu/disk" + "sfu/diskwriter" "sfu/estimator" "sfu/group" ) @@ -1104,12 +1104,12 @@ func handleClientMessage(c *webClient, m clientMessage) error { return c.error(group.UserError("not authorised")) } for _, cc := range c.group.GetClients(c) { - _, ok := cc.(*disk.Client) + _, ok := cc.(*diskwriter.Client) if ok { return c.error(group.UserError("already recording")) } } - disk := disk.New(c.group) + disk := diskwriter.New(c.group) _, err := group.AddClient(c.group.Name(), disk) if err != nil { disk.Close() @@ -1121,7 +1121,7 @@ func handleClientMessage(c *webClient, m clientMessage) error { return c.error(group.UserError("not authorised")) } for _, cc := range c.group.GetClients(c) { - disk, ok := cc.(*disk.Client) + disk, ok := cc.(*diskwriter.Client) if ok { disk.Close() group.DelClient(disk) diff --git a/sfu.go b/sfu.go index 7e57ab4..53c7934 100644 --- a/sfu.go +++ b/sfu.go @@ -15,7 +15,7 @@ import ( "runtime/pprof" "syscall" - "sfu/disk" + "sfu/diskwriter" "sfu/group" "sfu/webserver" ) @@ -30,7 +30,7 @@ func main() { "data `directory`") flag.StringVar(&group.Directory, "groups", "./groups/", "group description `directory`") - flag.StringVar(&disk.Directory, "recordings", "./recordings/", + flag.StringVar(&diskwriter.Directory, "recordings", "./recordings/", "recordings `directory`") flag.StringVar(&cpuprofile, "cpuprofile", "", "store CPU profile in `file`") diff --git a/webserver/webserver.go b/webserver/webserver.go index 0b90ff7..aa552bb 100644 --- a/webserver/webserver.go +++ b/webserver/webserver.go @@ -20,7 +20,7 @@ import ( "github.com/gorilla/websocket" - "sfu/disk" + "sfu/diskwriter" "sfu/group" "sfu/rtpconn" "sfu/stats" @@ -434,7 +434,7 @@ func recordingsHandler(w http.ResponseWriter, r *http.Request) { p = path.Clean(p) - f, err := os.Open(filepath.Join(disk.Directory, p)) + f, err := os.Open(filepath.Join(diskwriter.Directory, p)) if err != nil { httpError(w, err) return @@ -507,7 +507,7 @@ func handleGroupAction(w http.ResponseWriter, r *http.Request, group string) { return } err := os.Remove( - filepath.Join(disk.Directory, + filepath.Join(diskwriter.Directory, filepath.Join(group, path.Clean("/"+filename), ),