Closed tobychui closed 1 year ago
Hi, you have to implement the 4 request handlers here then you pass it to sftp.NewRequestServer
Hi @drakkan,
Thanks. I didn't notice the 4 request handlers themselves are interface. I just implemented the matching functions for the 4 handlers and everything is working now!
For those who are also confused by the example, you can simply copy the InMemHandler
into a new go file and change the contents of the exported functions for implementing your own sftp.Handlers object. Many of the unexported fields are for handling mutex / lock mechanism. Those are not straightly necessary if your file system abstraction already handle concurrent read write by itself.
Hi there, I think I might need some help on working with the
NewRequestServer
function.I am trying to use sftp module in my project to serve a customized file system interface. I notice the
sftp.NewRequestServer
takes in asftp.Handlers
as the second parameter but there is only one implementation (InMemHandler
) that matches the Handler type.Is there another request server function that I can use by passing in an interface that implement the same functions as
sftp.Handler
? Or if there are any way for me to create asftp.Handlers
struct object by passing in file system abstractions in existing sftp package?Thanks in advance!